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.5.2) 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(Qt6 6.8 COMPONENTS Core DBus Quick Charts Widgets Network Svg REQUIRED) find_package(Qt6LinguistTools REQUIRED) find_package(QuaZip-Qt6 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= (#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 )