1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
cmake_minimum_required(VERSION 3.22)
project(CoreCtrl HOMEPAGE_URL "https://gitlab.com/corectrl/corectrl")
set(PROJECT_FQDN "org.corectrl.CoreCtrl")
set(PROJECT_VERSION 1.4.3)
include(GNUInstallDirs)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
set(CMAKE_CXX_STANDARD 20)
option (WITH_DEBUG_INFO "Add debug information (to Debug builds)" OFF)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions("-D_DEBUG")
add_compile_options("-W;-Wall;-Wextra")
add_compile_options("-Wno-redundant-move;-Wno-sign-compare")
if (WITH_DEBUG_INFO)
add_compile_options("-ggdb;-fno-omit-frame-pointer")
endif()
endif()
# require libatomic on architectures without atomics support
include(CheckAtomic)
if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB)
list(APPEND ATOMIC_LIB "atomic")
endif()
find_package(Qt5 5.15 COMPONENTS Core DBus Quick Charts Widgets Network Svg REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
find_package(QuaZip-Qt5 1.0 REQUIRED)
find_package(spdlog 1.4 REQUIRED)
find_package(pugixml 1.11 REQUIRED)
find_package(Botan QUIET)
if(NOT Botan_FOUND)
message(FATAL_ERROR "Botan library not found")
endif()
find_package(units 2.3.1 QUIET)
if(NOT units_FOUND)
message("Using bundled units library")
list(APPEND 3RDPARTY_INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/3rdparty/units)
endif()
list(APPEND 3RDPARTY_DEFINITIONS
UNIT_LIB_DISABLE_IOSTREAM
DISABLE_PREDEFINED_UNITS
ENABLE_PREDEFINED_DATA_UNITS
ENABLE_PREDEFINED_ANGLE_UNITS
ENABLE_PREDEFINED_TIME_UNITS
ENABLE_PREDEFINED_ANGULAR_VELOCITY_UNITS
ENABLE_PREDEFINED_FREQUENCY_UNITS
ENABLE_PREDEFINED_VOLTAGE_UNITS
ENABLE_PREDEFINED_POWER_UNITS
ENABLE_PREDEFINED_TEMPERATURE_UNITS
ENABLE_PREDEFINED_CONVERT_UNITS
ENABLE_PREDEFINED_CONCENTRATION_UNITS
)
# Allow pci.ids path customization using -DWITH_PCI_IDS_PATH=<path-to-pci.ids-file> (#136)
set(WITH_PCI_IDS_PATH "/usr/share/hwdata/pci.ids" CACHE FILEPATH "Path to pci.ids file")
add_subdirectory(src)
# Tests
#
# NOTE: CTest provides a BUILD_TESTING option set by default to ON. This setting
# is useful for developers but not for most users, who will only waste time and
# energy compiling the testing suite when -DBUILD_TESTING=OFF is omitted at
# configuration time.
#
# Do not build the testing suite by default.
include(CTest)
option(BUILD_TESTING "Build the testing suite" OFF)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
# Icons
string(TOLOWER "${PROJECT_NAME}" ICON_NAME)
foreach(ICON_SIZE 16 22 24 32 48 64 72 96 128 192 256)
install(
FILES resources/icon/app_${ICON_SIZE}.svg
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/${ICON_SIZE}x${ICON_SIZE}/apps
RENAME ${ICON_NAME}.svg
)
endforeach()
# .desktop file
install(
FILES resources/launcher.desktop
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications
RENAME ${PROJECT_FQDN}.desktop
)
# AppStream metadata
configure_file(resources/appdata.xml.in resources/appdata.xml)
install(
FILES ${CMAKE_BINARY_DIR}/resources/appdata.xml
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/metainfo
RENAME ${PROJECT_FQDN}.appdata.xml
)
|