Refactored the build config header and macros; Added OS- and compiler-specific options and macros to cmake.

This commit is contained in:
Alexander Shaduri
2021-03-01 14:04:35 +04:00
parent f0dfeaf8c0
commit 698500fd3e
26 changed files with 228 additions and 147 deletions
+10
View File
@@ -12,15 +12,25 @@ include(${CMAKE_SOURCE_DIR}/version.txt)
project(gsmartcontrol VERSION ${CMAKE_PROJECT_VERSION})
# Provide DATADIR, etc...
include(GNUInstallDirs)
include(src/build_config/compiler_options.cmake)
# Disable RPATH manipulation, we don't have shared libraries
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
option(APP_BUILD_EXAMPLES "Build examples" ON)
configure_file(gsmartcontrol.in.spec gsmartcontrol.spec)
add_subdirectory(contrib)
add_subdirectory(data)
add_subdirectory(debian.dist)
+1 -1
View File
@@ -51,12 +51,12 @@ if (WIN32)
target_sources(gsmartcontrol PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/gsc_winres.rc")
endif()
target_link_libraries(gsmartcontrol
PRIVATE
applib
app_pcrecpp_interface
app_gtkmm_interface
compiler_warnings
build_config
)
-1
View File
@@ -59,7 +59,6 @@ target_link_libraries(applib
app_pcrecpp_interface
app_gettext_interface
PRIVATE
compiler_warnings
build_config
)
-4
View File
@@ -17,7 +17,6 @@ target_sources(smartctl_executor_example PRIVATE
)
target_link_libraries(smartctl_executor_example PRIVATE
applib
compiler_warnings
)
@@ -27,7 +26,6 @@ target_sources(smartctl_parser_example PRIVATE
)
target_link_libraries(smartctl_parser_example PRIVATE
applib
compiler_warnings
)
@@ -37,7 +35,6 @@ target_sources(spawn_example PRIVATE
)
target_link_libraries(spawn_example PRIVATE
applib
compiler_warnings
)
@@ -47,5 +44,4 @@ target_sources(storage_detector_example PRIVATE
)
target_link_libraries(storage_detector_example PRIVATE
applib
compiler_warnings
)
+1 -1
View File
@@ -16,7 +16,7 @@ Copyright:
#include <glibmm/i18n.h>
#include <algorithm>
#include "config.h" // CONFIG_*
#include "build_config.h" // CONFIG_*
#include "hz/debug.h"
+1
View File
@@ -21,6 +21,7 @@ Copyright:
#include <glibmm.h> // Glib::shell_quote(), compose
#include <glibmm/i18n.h>
#include "build_config.h"
#include "executor_factory.h"
#include "storage_device.h"
#include "rconfig/rconfig.h"
+2 -2
View File
@@ -9,7 +9,7 @@ Copyright:
/// \weakgroup applib
/// @{
#include "config.h" // CONFIG_*
#include "build_config.h" // CONFIG_*
#if defined CONFIG_KERNEL_LINUX
@@ -26,7 +26,7 @@ Copyright:
#include "hz/debug.h"
#include "hz/fs.h"
#include "hz/string_num.h"
#include "rconfig/config.h"
#include "rconfig/rconfig.h"
#include "app_pcrecpp.h"
#include "storage_detector_linux.h"
#include "storage_detector_helpers.h"
+1 -1
View File
@@ -12,7 +12,7 @@ Copyright:
#ifndef STORAGE_DETECTOR_LINUX_H
#define STORAGE_DETECTOR_LINUX_H
#include "config.h" // CONFIG_*
#include "build_config.h" // CONFIG_*
#if defined CONFIG_KERNEL_LINUX
+1 -1
View File
@@ -9,7 +9,7 @@ Copyright:
/// \weakgroup applib
/// @{
#include "config.h" // CONFIG_*
#include "build_config.h" // CONFIG_*
#if !defined CONFIG_KERNEL_LINUX && !defined CONFIG_KERNEL_FAMILY_WINDOWS
+1 -1
View File
@@ -12,7 +12,7 @@ Copyright:
#ifndef STORAGE_DETECTOR_OTHER_H
#define STORAGE_DETECTOR_OTHER_H
#include "config.h" // CONFIG_*
#include "build_config.h" // CONFIG_*
#if !defined CONFIG_KERNEL_LINUX && !defined CONFIG_KERNEL_FAMILY_WINDOWS
+1 -1
View File
@@ -9,7 +9,7 @@ Copyright:
/// \weakgroup applib
/// @{
#include "config.h" // CONFIG_*
#include "build_config.h" // CONFIG_*
#if defined CONFIG_KERNEL_FAMILY_WINDOWS
+1 -1
View File
@@ -12,7 +12,7 @@ Copyright:
#ifndef STORAGE_DETECTOR_WIN32_H
#define STORAGE_DETECTOR_WIN32_H
#include "config.h" // CONFIG_*
#include "build_config.h" // CONFIG_*
#if defined CONFIG_KERNEL_FAMILY_WINDOWS
+75 -69
View File
@@ -4,56 +4,83 @@
# (C) 2021 Alexander Shaduri <ashaduri@gmail.com>
###############################################################################
# We print these here (as opposed to compiler_options.cmake) because it's the final state of these variables.
# Host system
message(STATUS "Host system:")
message(STATUS "CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
message(STATUS "CMAKE_HOST_SYSTEM_VERSION: ${CMAKE_HOST_SYSTEM_VERSION}")
message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
# Target system
message(STATUS "Target system:")
message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
message(STATUS "CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CMAKE_SIZEOF_VOID_P: ${CMAKE_SIZEOF_VOID_P}")
# Compiler
message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
message(STATUS "CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN: ${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
message(STATUS "CMAKE_CXX_COMPILER_TARGET: ${CMAKE_CXX_COMPILER_TARGET}")
message(STATUS "CMAKE_CXX_COMPILE_FEATURES: ${CMAKE_CXX_COMPILE_FEATURES}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL: ${CMAKE_CXX_FLAGS_MINSIZEREL}")
message(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
message(STATUS "CMAKE_STATIC_LINKER_FLAGS: ${CMAKE_STATIC_LINKER_FLAGS}")
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_DEBUG: ${CMAKE_STATIC_LINKER_FLAGS_DEBUG}")
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL: ${CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL}")
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_RELEASE: ${CMAKE_STATIC_LINKER_FLAGS_RELEASE}")
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO: ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_DEBUG: ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL: ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_RELEASE: ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO: ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS_DEBUG: ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL: ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS_RELEASE: ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO: ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
# These variables are used in build_config.in.h
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Windows"
OR "${CMAKE_SYSTEM_NAME}" MATCHES "CYGWIN.*")
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CONFIG_KERNEL_WINDOWS32 TRUE)
else()
set(CONFIG_KERNEL_WINDOWS64 TRUE)
endif()
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(CONFIG_KERNEL_LINUX TRUE)
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD"
OR "${CMAKE_SYSTEM_NAME}" MATCHES "GNU/kFreeBSD")
set(CONFIG_KERNEL_FREEBSD TRUE)
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "DragonFly")
set(CONFIG_KERNEL_DRAGONFLY TRUE)
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "NetBSD")
set(CONFIG_KERNEL_NETBSD TRUE)
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
set(CONFIG_KERNEL_OPENBSD TRUE)
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS" OR "${CMAKE_SYSTEM_NAME}" MATCHES "Solaris")
set(CONFIG_KERNEL_SOLARIS TRUE)
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(CONFIG_KERNEL_DARWIN TRUE)
elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "QNX")
set(CONFIG_KERNEL_QNX TRUE)
endif()
# TODO Add these flags
# Additionally, these macros are defined by OS / compilers:
# Note: Some operating systems / compilers have built-in defines.
# For gcc, check with
# $ gcc -dM -E - < /dev/null
# -mms-bitfields (target os env = mingw32, mingw64, cygwin; compiler = gnu, clang)
# gcc warnings: -Wall -Wcast-align -Wcast-qual -Wconversion
#-Wfloat-equal -Wnon-virtual-dtor -Woverloaded-virtual
#-Wpointer-arith -Wshadow -Wsign-compare -Wsign-promo -Wundef -Wwrite-strings
# clang warnings: gcc warnings plus:
# -Wno-sign-conversion -Wno-format-security
# debug builds:
# -DDEBUG=1 -DDEBUG_BUILD=1 -O0 -g3
# optimized builds (target mingw32):
# -g0 -O3 -s -march=i686
# optimized builds (target mingw64, cygwin):
# -g0 -O3 -s
# optimized builds (i686, x86_64 only; others don't have "generic")
# -mtune=generic
# host, target OS kernels (pattern, os name, C macro):
# *linux*, linux, LINUX
# i*86-*mingw* | i*86-*cygwin*, windows32, WINDOWS32
# x86_64-*-mingw* | x86_64-*-cygwin*, windows64, WINDOWS64
# *freebsd*, freebsd, FREEBSD
# *dragonfly*, dragonfly, DRAGONFLY
# *openbsd*, openbsd, OPENBSD
# *netbsd*, netbsd, NETBSD
# *solaris*, solaris, SOLARIS
# *darwin*, darwin, DARWIN
# *qnx*, qnx, QNX
# *, unknown, UNKNOWN
# Notes:
# Linux: gcc defines __linux__ on linux. Other defines include: __linux, __unix__, __gnu_linux__,
# linux, unix, __i386__, i386.
@@ -70,41 +97,20 @@ message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
# See http://glibc-bsd.alioth.debian.org/porting/PORTING .
# OS environments:
# *-gnu | gnu* (This includes gnu/linux, debian gnu/kfreebsd, debian gnu/netbsd...)
# cygwin
# mingw32
# mingw64
# freebsd (FreeBSD libc)
# dragonfly
# openbsd
# netbsd
# solaris
# darwin
# qnx
# unknown
# MT flags
# -pthread -D_MT -D_THREAD_SAFE (linux/gcc, linux/clang, freebsd, dragonfly)
# -mthreads -D_THREAD_SAFE (win/gcc, win/clang)
# -pthread -D_REENTRANT (openbsd, netbsd)
# -pthreads -D_MT -D_THREAD_SAFE -D_REENTRANT (solaris)
# darwin, qnx - MT enabled by default.
include(CheckSymbolExists)
#include(CheckSymbolExists)
# getrawpartition() for netbsd and openbsd in -lutil.
check_symbol_exists(getrawpartition "util.h" HAVE_GETRAWPARTITION)
# This is just a check to see whether we have it. The code uses getrawpartition() without any checks on *BSD.
#check_symbol_exists(getrawpartition "util.h" HAVE_GETRAWPARTITION)
#message(STATUS "getrawpartition() detected: ${HAVE_GETRAWPARTITION}")
# System-specific definitions
add_library(build_config INTERFACE)
configure_file("config.in.h" "config.h" ESCAPE_QUOTES @ONLY)
configure_file("build_config.in.h" "build_config.h" ESCAPE_QUOTES @ONLY)
target_sources(build_config INTERFACE
config.in.h
build_config.in.h
)
target_include_directories(build_config INTERFACE "${CMAKE_CURRENT_BINARY_DIR}")
@@ -15,14 +15,32 @@ Copyright:
// Parts of this file are replaced by cmake
#define PACKAGE "@CMAKE_PROJECT_NAME@"
#define VERSION "@CMAKE_PROJECT_VERSION@"
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
#define PACKAGE_VERSION "@CMAKE_PROJECT_VERSION@"
#define PACKAGE_PKGDATA_DIR "@CMAKE_INSTALL_DATADIR@/gsmartcontrol"
#define PACKAGE_SYSCONF_DIR "@CMAKE_INSTALL_SYSCONFDIR@"
#define PACKAGE_LOCALE_DIR "@CMAKE_INSTALL_LOCALEDIR@"
#define PACKAGE_DOC_DIR "@CMAKE_INSTALL_DOCDIR@"
#ifdef DEBUG_BUILD
#define PACKAGE_TOP_SOURCE_DIR "@CMAKE_SOURCE_DIR@"
#endif
#cmakedefine CONFIG_KERNEL_WINDOWS32
#cmakedefine CONFIG_KERNEL_WINDOWS64
#cmakedefine CONFIG_KERNEL_LINUX
#cmakedefine CONFIG_KERNEL_FREEBSD
#cmakedefine CONFIG_KERNEL_OPENBSD
#cmakedefine CONFIG_KERNEL_NETBSD
#cmakedefine CONFIG_KERNEL_DRAGONFLY
#cmakedefine CONFIG_KERNEL_SOLARIS
#cmakedefine CONFIG_KERNEL_DARWIN
#cmakedefine CONFIG_KERNEL_QNX
#if defined CONFIG_KERNEL_WINDOWS32 || defined CONFIG_KERNEL_WINDOWS64
#define CONFIG_KERNEL_FAMILY_WINDOWS
#endif
+62 -23
View File
@@ -6,15 +6,28 @@
# This file is included from root CMakeLists.txt
# Set the default C++ standard
# --- Set the default C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# We need OS/compiler extensions, if available.
# Enable PIC, required on many systems
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# --- OS / compiler extensions
# These extensions are useful to enable OS-specific functionality like 64-bit file offsets.
# Enable compiler extensions (like -std=gnu++17 instead of -std=c++17)
set(CMAKE_CXX_EXTENSIONS ON)
# glibc: all-extensions macro: _GNU_SOURCE.
# Defined automatically when used with glibc, but not others.
# We define it for all gcc systems.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_definitions(_GNU_SOURCE)
endif()
# Solaris: The problem with solaris is that it has too many incompatible
# feature test macros, and there is no enable-all macro. Autoconf
@@ -30,32 +43,58 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# by default if one of the usual macros are encountered (_XOPEN_SOURCE,
# _GNU_SOURCE, etc...).
# See _mingw.h for details.
# TODO
# -D__USE_MINGW_ANSI_STDIO=1 -DWINVER=0x0600
if (WIN32)
# No effect in MSVC, doesn't hurt.
add_compile_definitions(__USE_MINGW_ANSI_STDIO=1)
# Enable Vista winapi
add_compile_definitions(WINVER=0x0600)
endif()
# Darwin: Enable large file support
# -D_DARWIN_USE_64_BIT_INODE=1
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
add_compile_definitions(_DARWIN_USE_64_BIT_INODE=1)
endif()
# In many environments this enables large file support
# -D_FILE_OFFSET_BITS=64
set(CMAKE_CXX_EXTENSIONS ON)
#set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# In many environments this enables large file support. For others, it's harmless.
add_compile_definitions(_FILE_OFFSET_BITS=64)
# Add various OS/compiler-specific options that should always be there
# regardless of the machine.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_definitions(_GNU_SOURCE)
# --- Compiler flags
# Note: Some operating systems / compilers have built-in defines.
# For gcc, check with
# $ gcc -dM -E - < /dev/null
# MT flags
# -pthread -D_MT -D_THREAD_SAFE (linux/gcc, linux/clang, freebsd, dragonfly)
# -mthreads -D_THREAD_SAFE (win/gcc, win/clang)
# -pthread -D_REENTRANT (openbsd, netbsd)
# -pthreads -D_MT -D_THREAD_SAFE -D_REENTRANT (solaris)
# darwin, qnx - MT enabled by default.
# Enable compiler warnings
if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang
OR ${CMAKE_CXX_COMPILER_ID} STREQUAL GNU
OR ${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang)
add_compile_options(-Wall -Wextra
-Wcast-qual -Wconversion -Wfloat-equal -Wnon-virtual-dtor -Woverloaded-virtual
-Wpointer-arith -Wshadow -Wsign-compare -Wsign-promo -Wundef -Wwrite-strings
)
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
add_compile_options(/W4)
endif()
# Enable warnings
add_library(compiler_warnings INTERFACE)
target_compile_options(compiler_warnings INTERFACE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra>
$<$<CXX_COMPILER_ID:MSVC>:
/W4>
)
# GTK uses MS bitfields, so we need this in mingw
if (MINGW)
add_compile_options(-mms-bitfields)
endif()
# Define macros to check the debug build
add_compile_definitions("$<$<CONFIG:DEBUG>:DEBUG>")
add_compile_definitions("$<$<CONFIG:DEBUG>:DEBUG_BUILD>")
+21 -20
View File
@@ -9,8 +9,6 @@ Copyright:
/// \weakgroup gsc
/// @{
#include "config.h" // VERSION
#include <vector>
#include "hz/debug.h"
@@ -21,6 +19,8 @@ Copyright:
#include "gsc_about_dialog.h"
#include "build_config.h" // VERSION
// GtkBuilder needs this constructor
@@ -31,35 +31,36 @@ GscAboutDialog::GscAboutDialog(BaseObjectType* gtkcobj, Glib::RefPtr<Gtk::Builde
// Note: The dialogs have ESC accelerator attached by default.
set_version(VERSION);
set_version(PACKAGE_VERSION);
// set these properties here (after setting hooks) to make the links work.
set_website("https://gsmartcontrol.sourceforge.io/");
// set_license_type(Gtk::LICENSE_GPL_3_0_ONLY); // this overrides set_license()
// set_license(hz::data_file_get_contents("doc", "LICENSE_gsmartcontrol.txt", 1*1024*1024)); // 1M
// set_license(hz::data_file_get_contents("doc", "LICENSE.txt", 1*1024*1024)); // 1M
// spammers go away
set_copyright(Glib::ustring::compose("Copyright (C) %1", "2008 - 2018 Alexander Shaduri " "<ashaduri" "" "@" "" "" "gmail.com>"));
set_copyright(Glib::ustring::compose("Copyright (C) %1",
"2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>"));
std::string authors_str = hz::data_file_get_contents("doc", "AUTHORS.txt", 1*1024*1024); // 1M
hz::string_any_to_unix(authors_str);
// std::string authors_str = hz::data_file_get_contents("doc", "AUTHORS.txt", 1*1024*1024); // 1M
// hz::string_any_to_unix(authors_str);
std::vector<Glib::ustring> authors;
hz::string_split(authors_str, '\n', authors, true);
// std::vector<Glib::ustring> authors;
// hz::string_split(authors_str, '\n', authors, true);
//
// for (auto& author : authors) {
// std::string s = author;
// hz::string_replace(s, " '@' ", "@"); // despammer
// hz::string_replace(s, " 'at' ", "@"); // despammer
// author = s;
// }
// set_authors(authors);
for (auto& author : authors) {
std::string s = author;
hz::string_replace(s, " '@' ", "@"); // despammer
hz::string_replace(s, " 'at' ", "@"); // despammer
author = s;
}
set_authors(authors);
// set_documenters(authors);
set_documenters(authors);
std::string translators_str = hz::data_file_get_contents("doc", "TRANSLATORS.txt", 10*1024*1024); // 10M
set_translator_credits(translators_str);
// std::string translators_str = hz::data_file_get_contents("doc", "TRANSLATORS.txt", 10*1024*1024); // 10M
// set_translator_credits(translators_str);
// run(); // don't use run - it's difficult to exit it manually.
// show(); // shown by the caller to enable setting the parent window.
+1
View File
@@ -23,6 +23,7 @@ Copyright:
#include "gsc_add_device_window.h"
#include "gsc_main_window.h"
#include "build_config.h"
+12 -12
View File
@@ -30,8 +30,6 @@ Copyright:
#include <versionhelpers.h>
#endif
#include "config.h" // VERSION, *PACKAGE*
#include "libdebug/libdebug.h" // include full libdebug here (to add domains, etc...)
#include "rconfig/rconfig.h"
#include "rconfig/loadsave.h"
@@ -43,6 +41,7 @@ Copyright:
#include "hz/win32_tools.h" // win32_get_registry_value_string()
#include "hz/env_tools.h"
#include "hz/string_num.h"
#include "build_config.h" // VERSION, *PACKAGE*, ...
#include "gsc_main_window.h"
#include "gsc_executor_log_window.h"
@@ -228,7 +227,7 @@ namespace {
{ "gdk-dpi-scale", 'l', 0, G_OPTION_ARG_DOUBLE, &(args.arg_gdk_dpi_scale),
N_("The value of GDK_DPI_SCALE environment variable (useful when executing with pkexec)"), nullptr },
#endif
{ nullptr }
{ nullptr, '\0', 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr }
};
GError* error = nullptr;
@@ -270,12 +269,13 @@ namespace {
/// Print application version information
inline void app_print_version_info()
{
std::string versiontext = "\n" + Glib::ustring::compose(_("GSmartControl version %1"), VERSION) + "\n";
std::string versiontext = "\n" + Glib::ustring::compose(_("GSmartControl version %1"), PACKAGE_VERSION) + "\n";
std::string warningtext = std::string("\n") + _("Warning: GSmartControl comes with ABSOLUTELY NO WARRANTY.\n"
"See LICENSE_gsmartcontrol.txt file for details.") + "\n\n";
"See LICENSE.txt file for details.") + "\n\n";
/// %1 is years, %2 is email address
warningtext += Glib::ustring::compose(_("Copyright (C) %1 Alexander Shaduri %2"), "2008 - 2018", "<ashaduri\" \"\" \"@\" \"\" \"\" \"gmail.com>") + "\n\n";
warningtext += Glib::ustring::compose(_("Copyright (C) %1 Alexander Shaduri %2"), "2008 - 2021",
"<ashaduri@gmail.com>") + "\n\n";
std::fprintf(stdout, "%s%s", versiontext.c_str(), warningtext.c_str());
}
@@ -293,9 +293,9 @@ bool app_init_and_loop(int& argc, char**& argv)
#endif
// Set up gettext. This has to be before gtk is initialized.
bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
bindtextdomain(PACKAGE_NAME, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
textdomain(PACKAGE_NAME);
// Glib needs the C locale set to system locale for command line args.
// We will reset it later if needed.
@@ -448,9 +448,9 @@ bool app_init_and_loop(int& argc, char**& argv)
// Paths in source tree
#ifdef DEBUG_BUILD
hz::data_file_add_search_directory("icons", hz::fs::u8path(TOP_SOURCE_DIR) / "data");
hz::data_file_add_search_directory("ui", hz::fs::u8path(TOP_SOURCE_DIR) / "src/ui");
hz::data_file_add_search_directory("doc", hz::fs::u8path(TOP_SOURCE_DIR) / "doc");
hz::data_file_add_search_directory("icons", hz::fs::u8path(PACKAGE_TOP_SOURCE_DIR) / "data");
hz::data_file_add_search_directory("ui", hz::fs::u8path(PACKAGE_TOP_SOURCE_DIR) / "src/ui");
hz::data_file_add_search_directory("doc", hz::fs::u8path(PACKAGE_TOP_SOURCE_DIR) / "doc");
#endif
+1
View File
@@ -18,6 +18,7 @@ Copyright:
#include <glibmm/i18n.h>
#include <gdk/gdk.h> // GDK_KEY_Escape
#include "build_config.h"
#include "hz/fs_ns.h"
#include "hz/string_sprintf.h"
#include "hz/scoped_ptr.h"
-3
View File
@@ -17,7 +17,6 @@ target_sources(format_unit_example PRIVATE
)
target_link_libraries(format_unit_example PRIVATE
hz
compiler_warnings
)
@@ -27,7 +26,6 @@ target_sources(string_algo_example PRIVATE
)
target_link_libraries(string_algo_example PRIVATE
hz
compiler_warnings
)
@@ -37,5 +35,4 @@ target_sources(string_num_example PRIVATE
)
target_link_libraries(string_num_example PRIVATE
hz
compiler_warnings
)
+3 -1
View File
@@ -25,10 +25,12 @@ target_sources(libdebug PRIVATE
libdebug_mini.h
)
target_include_directories(libdebug INTERFACE "${CMAKE_SOURCE_DIR}/src")
target_link_libraries(libdebug
PRIVATE
hz
compiler_warnings
app_gtkmm_interface # .cpp only
)
+1 -1
View File
@@ -206,7 +206,7 @@ GOptionGroup* debug_get_option_group()
&(args->debug_colorize), "Enable colored output", nullptr },
{ "debug-no-colorize", '\0', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE,
&(args->debug_colorize), "Disable colored output", nullptr },
{ nullptr }
{ nullptr, '\0', 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr }
};
g_option_group_add_entries(group, entries);
-1
View File
@@ -17,6 +17,5 @@ target_sources(libdebug_example PRIVATE
)
target_link_libraries(libdebug_example PRIVATE
libdebug
compiler_warnings
)
+3
View File
@@ -12,10 +12,13 @@ target_sources(rconfig INTERFACE
rconfig.h
)
target_include_directories(rconfig INTERFACE "${CMAKE_SOURCE_DIR}/src")
target_link_libraries(rconfig
INTERFACE
hz
json
app_gtkmm_interface
)
-1
View File
@@ -17,6 +17,5 @@ target_sources(rconfig_example PRIVATE
)
target_link_libraries(rconfig_example PRIVATE
rconfig
compiler_warnings
)
+9
View File
@@ -8,6 +8,15 @@
# Use with:
# cmake -DCMAKE_TOOLCHAIN_FILE=...
# TODO
# # optimized builds (target mingw32):
## -g0 -O3 -s -march=i686
#
## optimized builds (target mingw64, cygwin):
## -g0 -O3 -s
# -mtune=generic
set(CMAKE_SYSTEM_NAME Windows)
# Specify the compiler