diff --git a/CMakeLists.txt b/CMakeLists.txt index d390146..53aa832 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,11 @@ cmake_minimum_required(VERSION 3.13) include(${CMAKE_SOURCE_DIR}/version.txt) -project(gsmartcontrol VERSION ${CMAKE_PROJECT_VERSION}) +project(gsmartcontrol + VERSION ${CMAKE_PROJECT_VERSION} + HOMEPAGE_URL "https://gsmartcontrol.shaduri.dev" + LANGUAGES CXX +) # Provide DATADIR, etc... diff --git a/toolchains/common-dev.cmake b/toolchains/common-dev.cmake deleted file mode 100644 index 58d927a..0000000 --- a/toolchains/common-dev.cmake +++ /dev/null @@ -1,8 +0,0 @@ -############################################################################### -# License: BSD Zero Clause License file -# Copyright: -# (C) 2021 Alexander Shaduri -############################################################################### - -# Enable building examples by default -set(APP_BUILD_EXAMPLES ON) diff --git a/toolchains/common-gcc-clang.cmake b/toolchains/common-gcc-clang.cmake deleted file mode 100644 index 4170ca1..0000000 --- a/toolchains/common-gcc-clang.cmake +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################### -# License: BSD Zero Clause License file -# Copyright: -# (C) 2021 Alexander Shaduri -############################################################################### - - -# Enable LTO for Release mode -set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON) - -# Add compiler options for development -add_compile_options( - -Wall - -Wextra - -Wpedantic - -Wshadow - -Wpointer-arith - -Wundef - -Wunused-macros - -Wcast-qual - -Wcast-align - -Wconversion - -Wmissing-declarations - -Wpacked - -Wredundant-decls - -Wvla - -Woverlength-strings - -Wnon-virtual-dtor - -Woverloaded-virtual - -Wno-missing-field-initializers - -Wdate-time - -Wregister -) - -# -fvisibility-inlines-hidden hides inline functions of exported classes. -# This switch declares that the user does not attempt to compare pointers to inline functions -# or methods where the addresses of the two functions are taken in different shared objects. -# Dramatically improves load an link times with DSOs (with templates). -set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE) - -# -fvisibility=hidden hides all symbols by default (like MSVC); this reduces symbol tables -# for shared libraries and avoids unneeded exports. -add_compile_options( - -fvisibility=hidden -) - -#target_compile_options(foo PUBLIC "$<$:${MY_DEBUG_OPTIONS}>") diff --git a/toolchains/linux-dev-clang-debug.cmake b/toolchains/linux-dev-clang-debug.cmake deleted file mode 100644 index 2508a0b..0000000 --- a/toolchains/linux-dev-clang-debug.cmake +++ /dev/null @@ -1,33 +0,0 @@ -############################################################################### -# License: BSD Zero Clause License file -# Copyright: -# (C) 2021 Alexander Shaduri -############################################################################### - -# Linux development version with clang, debug mode. -# Use with: -# cmake -DCMAKE_TOOLCHAIN_FILE=... - -set(CMAKE_SYSTEM_NAME Linux) - -# Specify the compiler -set(CMAKE_C_COMPILER clang) -set(CMAKE_CXX_COMPILER clang++) - -# Common options for gcc/clang -include(${CMAKE_CURRENT_LIST_DIR}/common-gcc-clang.cmake) - -# Common options for development -include(${CMAKE_CURRENT_LIST_DIR}/common-dev.cmake) - -# Clang-specific options -add_compile_options( - -Wdocumentation - -Wheader-guard - -Wloop-analysis - -Wno-keyword-macro -) - - -# Enable clang-tidy by default, reading from /.clang-tidy file -set(CMAKE_CXX_CLANG_TIDY "clang-tidy") diff --git a/toolchains/linux-dev.cmake b/toolchains/linux-dev.cmake new file mode 100644 index 0000000..6d1e2ec --- /dev/null +++ b/toolchains/linux-dev.cmake @@ -0,0 +1,11 @@ + + +# Enable clang-tidy by default, reading from /.clang-tidy file +set(CMAKE_CXX_CLANG_TIDY "clang-tidy") + + +# Developer options +set(APP_COMPILER_ENABLE_WARNINGS ON) +set(APP_BUILD_EXAMPLES ON) +set(APP_BUILD_TESTS ON) + diff --git a/toolchains/win32-mingw-cross.cmake b/toolchains/win32-mingw-cross.cmake new file mode 100644 index 0000000..42bdbbc --- /dev/null +++ b/toolchains/win32-mingw-cross.cmake @@ -0,0 +1,52 @@ +############################################################################### +# License: BSD Zero Clause License file +# Copyright: +# (C) 2021 Alexander Shaduri +############################################################################### + +# Windows 32-bit production version with mingw/gcc. +# Use with: +# cmake -DCMAKE_TOOLCHAIN_FILE=... + +# Target OS +set(CMAKE_SYSTEM_NAME Windows) + +# Specify the compiler +set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) +#set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) + +# The target environment +set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32/sys-root/mingw) + +# Adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +IF (CMAKE_CROSSCOMPILING) + set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig") +endif() + +#set(APP_NSIS_PATH /usr/bin/makensis) + + +# Enable LTO for Release build +set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON) + +# Increase optimizations of Release builds +add_compile_options("$<$:-g0 -O3 -s>") + +# Enable common CPU optimizations +add_compile_options(-march=i686 -mtune=generic) + + +# Developer options +set(APP_COMPILER_ENABLE_WARNINGS ON) +set(APP_BUILD_EXAMPLES ON) +set(APP_BUILD_TESTS ON) + + diff --git a/toolchains/win32-prod-gcc-release.cmake b/toolchains/win64-mingw-cross.cmake similarity index 58% rename from toolchains/win32-prod-gcc-release.cmake rename to toolchains/win64-mingw-cross.cmake index 730ccbd..2b0677c 100644 --- a/toolchains/win32-prod-gcc-release.cmake +++ b/toolchains/win64-mingw-cross.cmake @@ -8,24 +8,16 @@ # 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 - +# Target OS set(CMAKE_SYSTEM_NAME Windows) # Specify the compiler set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) -set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +#set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) # The target environment -set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32/sys-root/mingw) +set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32/sys-root/mingw) # Adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search @@ -35,8 +27,26 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -# Common options for gcc -include(${CMAKE_CURRENT_LIST_DIR}/common-gcc-clang.cmake) +IF (CMAKE_CROSSCOMPILING) + set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig") +endif() + +#set(APP_NSIS_PATH /usr/bin/makensis) + + +# Enable LTO for Release build +set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON) + +# Increase optimizations of Release builds +add_compile_options("$<$:-g0 -O3 -s>") + +# Enable common CPU optimizations +add_compile_options(-mtune=generic) + + +# Developer options +set(APP_COMPILER_ENABLE_WARNINGS ON) +set(APP_BUILD_EXAMPLES ON) +set(APP_BUILD_TESTS ON) -set(APP_NSIS_PATH /usr/bin/makensis)