mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
parent
64a6771dc8
commit
f77a103209
3 changed files with 29 additions and 19 deletions
|
@ -9,7 +9,10 @@ include(GNUInstallDirs)
|
||||||
# Include Qt basic functions
|
# Include Qt basic functions
|
||||||
include(QtCommon)
|
include(QtCommon)
|
||||||
|
|
||||||
project(nheko LANGUAGES C CXX VERSION 0.2.0)
|
project(nheko LANGUAGES C CXX)
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR "2")
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH "1")
|
||||||
|
|
||||||
# Set PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK to 0 if not present, needed by add_project_meta
|
# Set PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK to 0 if not present, needed by add_project_meta
|
||||||
fix_project_version()
|
fix_project_version()
|
||||||
|
@ -83,32 +86,27 @@ else(NOT CMAKE_BUILD_TYPE)
|
||||||
message("Build type set to '${CMAKE_BUILD_TYPE}'")
|
message("Build type set to '${CMAKE_BUILD_TYPE}'")
|
||||||
endif(NOT CMAKE_BUILD_TYPE)
|
endif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
find_program(GIT git)
|
||||||
set(PATCH_OUT "0")
|
if(GIT)
|
||||||
else("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
|
||||||
find_program(GIT git)
|
|
||||||
if(GIT)
|
|
||||||
execute_process(
|
execute_process(
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
COMMAND ${GIT} rev-parse --short HEAD
|
COMMAND ${GIT} rev-parse --short HEAD
|
||||||
OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
set(PATCH_OUT "0-${GIT_OUT}")
|
set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${GIT_OUT}")
|
||||||
else(GIT)
|
endif(GIT)
|
||||||
set(PATCH_OUT "0")
|
|
||||||
endif(GIT)
|
|
||||||
endif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
|
||||||
|
|
||||||
set(PROJECT_VERSION_PATCH ${PATCH_OUT})
|
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR "1")
|
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
|
||||||
set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
|
set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
|
||||||
set(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
|
set(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
|
||||||
set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})
|
set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})
|
||||||
|
|
||||||
message(STATUS "Version: ${PROJECT_VERSION}")
|
message(STATUS "Version: ${PROJECT_VERSION}")
|
||||||
|
|
||||||
|
cmake_host_system_information(RESULT BUILD_HOST QUERY HOSTNAME)
|
||||||
|
cmake_host_system_information(RESULT BUILD_OS QUERY OS_NAME)
|
||||||
|
set(BUILD_USER $ENV{USER})
|
||||||
|
configure_file(cmake/version.hpp config/version.hpp)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
|
||||||
-Wall \
|
-Wall \
|
||||||
|
@ -231,6 +229,7 @@ include_directories(${LMDBXX_INCLUDE_DIRS})
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
include_directories(include/ui)
|
include_directories(include/ui)
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/config)
|
||||||
|
|
||||||
include_directories(${LMDB_INCLUDE_DIR})
|
include_directories(${LMDB_INCLUDE_DIR})
|
||||||
|
|
||||||
|
|
5
cmake/version.hpp
Normal file
5
cmake/version.hpp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
namespace nheko {
|
||||||
|
static constexpr const char *version = "${PROJECT_VERSION}";
|
||||||
|
static constexpr const char *build_user = "${BUILD_USER}@${BUILD_HOST}";
|
||||||
|
static constexpr const char *build_os = "${BUILD_OS}";
|
||||||
|
}
|
|
@ -28,6 +28,8 @@
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
#include <ToggleButton.h>
|
#include <ToggleButton.h>
|
||||||
|
|
||||||
|
#include "version.hpp"
|
||||||
|
|
||||||
UserSettings::UserSettings() { load(); }
|
UserSettings::UserSettings() { load(); }
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -117,6 +119,9 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
auto heading_ = new QLabel(tr("User Settings"));
|
auto heading_ = new QLabel(tr("User Settings"));
|
||||||
heading_->setStyleSheet("font-weight: bold; font-size: 22px;");
|
heading_->setStyleSheet("font-weight: bold; font-size: 22px;");
|
||||||
|
|
||||||
|
auto versionInfo = new QLabel(
|
||||||
|
QString("%1 | %2 | %3").arg(nheko::version).arg(nheko::build_user).arg(nheko::build_os));
|
||||||
|
|
||||||
topBarLayout_ = new QHBoxLayout;
|
topBarLayout_ = new QHBoxLayout;
|
||||||
topBarLayout_->setSpacing(0);
|
topBarLayout_->setSpacing(0);
|
||||||
topBarLayout_->setMargin(0);
|
topBarLayout_->setMargin(0);
|
||||||
|
@ -215,6 +220,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
topLayout_->addLayout(topBarLayout_);
|
topLayout_->addLayout(topBarLayout_);
|
||||||
topLayout_->addLayout(mainLayout_);
|
topLayout_->addLayout(mainLayout_);
|
||||||
topLayout_->addStretch(1);
|
topLayout_->addStretch(1);
|
||||||
|
topLayout_->addWidget(versionInfo);
|
||||||
|
|
||||||
connect(themeCombo_,
|
connect(themeCombo_,
|
||||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
||||||
|
|
Loading…
Reference in a new issue