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
|
cmake_minimum_required(VERSION 3.25)
project(biometryd
VERSION 0.4.0
LANGUAGES CXX)
set(BIOMETRYD_VERSION_MAJOR 1)
set(BIOMETRYD_VERSION_MINOR 0)
set(BIOMETRYD_VERSION_PATCH 1)
option(ENABLE_WERROR "Treat all build warnings as errors" ON)
option(ENABLE_QT6 "Enable Qt6 build" OFF)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -pedantic -Wextra")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
if(ENABLE_WERROR)
add_compile_options("-Werror")
endif()
include(GNUInstallDirs)
if(ENABLE_QT6)
find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick QuickTest)
set(QT_VERSION_MAJOR 6)
# FIXME disabled due to issue building tests with GMock if CMAKE_AUTOMOC is
# enabled
# qt_standard_project_setup()
else()
find_package(Qt5 REQUIRED COMPONENTS Core Qml Quick QuickTest)
set(QT_VERSION_MAJOR 5)
endif()
set(
BIOMETRYD_DEFAULT_PLUGIN_DIRECTORY "${CMAKE_INSTALL_FULL_LIBDIR}/biometryd/plugins"
CACHE STRING "Default plugin installation directory")
set(
BIOMETRYD_CUSTOM_PLUGIN_DIRECTORY "/custom/vendor/biometryd/plugins"
CACHE STRING "Custom plugin installation directory")
enable_testing()
find_package(PkgConfig)
find_package(Boost COMPONENTS filesystem program_options REQUIRED)
find_package(nlohmann_json 3.11 REQUIRED)
pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
pkg_check_modules(DBUS dbus-1 REQUIRED)
pkg_check_modules(LIBAPPARMOR libapparmor REQUIRED)
pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
pkg_check_modules(SQLITE3 sqlite3 REQUIRED)
# Opt-out of depending on systemd at build-time
option(USE_SYSTEMD "Install systemd service" ON)
if (USE_SYSTEMD)
pkg_check_modules(SYSTEMD systemd)
if (NOT SYSTEMD_FOUND)
message(FATAL_ERROR "systemd pkg-config not found (required for figuring out service install location)")
endif()
endif()
# Opt-in to enable hybris support
option(WITH_HYBRIS "Enable libhybris integration support" OFF)
if (WITH_HYBRIS)
# Try to find hybris, and disable hybris from build if not found
find_library(Hybris
NAMES hybris-common REQUIRED
)
endif()
include_directories(
include
src
# Make sure that files generated during build are available for compilation.
# Most notably, this refers to include/biometry/version.h
${CMAKE_BINARY_DIR}/include
${Boost_INCLUDE_DIRS}
${DBUS_CPP_INCLUDE_DIRS}
${DBUS_INCLUDE_DIRS}
${LIBAPPARMOR_INCLUDE_DIRS}
${PROCESS_CPP_INCLUDE_DIRS}
${SQLITE3_INCLUDE_DIRS})
add_subdirectory(data)
add_subdirectory(doc)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(tests)
|