2023-11-30 17:39:15 +08:00
|
|
|
cmake_minimum_required(VERSION 3.25.0)
|
2023-08-03 20:43:23 +08:00
|
|
|
|
2024-10-11 15:08:15 +08:00
|
|
|
project(Treeland
|
2024-03-07 17:04:01 +08:00
|
|
|
VERSION 0.2.2
|
2023-08-04 10:43:08 +08:00
|
|
|
LANGUAGES CXX C)
|
2023-08-03 20:43:23 +08:00
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
2023-11-24 14:50:10 +08:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
2024-05-07 18:04:45 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2023-08-03 20:43:23 +08:00
|
|
|
|
2024-03-27 14:20:24 +08:00
|
|
|
# Standard installation paths
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
# Macros
|
|
|
|
|
include(FeatureSummary)
|
|
|
|
|
|
2024-12-12 20:54:47 +08:00
|
|
|
include(cmake/DefineTarget.cmake)
|
|
|
|
|
|
2025-07-22 15:41:33 +08:00
|
|
|
option(WITH_SUBMODULE_WAYLIB "Use the waylib from git submodule" ON)
|
2024-03-27 14:20:24 +08:00
|
|
|
add_feature_info(submodule_waylib WITH_SUBMODULE_WAYLIB "Use waylib from submodule")
|
2023-08-04 10:43:08 +08:00
|
|
|
|
2024-05-27 14:17:02 +08:00
|
|
|
option(ADDRESS_SANITIZER "Enable address sanitize" OFF)
|
|
|
|
|
add_feature_info(ASanSupport ADDRESS_SANITIZER "https://github.com/google/sanitizers/wiki/AddressSanitizer")
|
|
|
|
|
|
2024-11-15 14:17:41 +08:00
|
|
|
option(BUILD_TREELAND_EXAMPLES "Build clients demo to test treeland" OFF)
|
2024-06-21 13:34:47 +08:00
|
|
|
add_feature_info(DemoClents BUILD_TEST_CLIENTS "clients demo for testing")
|
|
|
|
|
|
2024-11-21 20:25:52 +08:00
|
|
|
option(DISABLE_DDM "Disable DDM and greeter" OFF)
|
|
|
|
|
|
|
|
|
|
if (DISABLE_DDM)
|
|
|
|
|
add_compile_definitions("DISABLE_DDM")
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-05-27 14:17:02 +08:00
|
|
|
if (ADDRESS_SANITIZER)
|
|
|
|
|
add_compile_options(-fsanitize=address -fno-optimize-sibling-calls -fno-omit-frame-pointer)
|
|
|
|
|
add_link_options(-fsanitize=address)
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-09-20 16:57:24 +08:00
|
|
|
set(LOCAL_QML_IMPORT_PATH "${PROJECT_BINARY_DIR}/qt/qml")
|
2024-05-30 11:07:05 +08:00
|
|
|
|
2023-09-14 17:20:08 +08:00
|
|
|
if(WITH_SUBMODULE_WAYLIB)
|
|
|
|
|
set(WITH_SUBMODULE_QWLROOTS ON)
|
2025-07-22 15:41:33 +08:00
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/qwlroots/cmake/WaylandScannerHelpers.cmake)
|
2023-08-04 10:43:08 +08:00
|
|
|
add_subdirectory(waylib)
|
2024-09-20 16:57:24 +08:00
|
|
|
list(APPEND LOCAL_QML_IMPORT_PATH "${PROJECT_BINARY_DIR}/waylib/src/server")
|
2023-09-14 17:20:08 +08:00
|
|
|
else()
|
|
|
|
|
find_package(Waylib REQUIRED Server)
|
2023-08-04 10:43:08 +08:00
|
|
|
endif()
|
2023-08-03 20:43:23 +08:00
|
|
|
|
2024-09-20 16:57:24 +08:00
|
|
|
set(QML_IMPORT_PATH "${LOCAL_QML_IMPORT_PATH}" CACHE STRING "For LSP" FORCE)
|
|
|
|
|
|
2023-08-03 20:43:23 +08:00
|
|
|
# PKG-CONFIG
|
2024-09-04 17:42:57 +08:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2023-08-04 10:43:08 +08:00
|
|
|
find_package(Qt6 CONFIG REQUIRED Core DBus Gui Qml Quick QuickControls2 LinguistTools Test QuickTest)
|
2024-11-21 13:04:10 +08:00
|
|
|
|
2025-06-18 16:27:54 +08:00
|
|
|
pkg_check_modules(WLROOTS REQUIRED IMPORTED_TARGET wlroots-0.19)
|
2024-11-21 13:04:10 +08:00
|
|
|
|
2025-01-21 18:08:55 +08:00
|
|
|
qt_standard_project_setup(REQUIRES 6.8)
|
2023-08-03 20:43:23 +08:00
|
|
|
|
|
|
|
|
# Set constants
|
2024-09-20 18:29:54 +08:00
|
|
|
set(TREELAND_DATA_DIR "${CMAKE_INSTALL_DATADIR}/treeland/" CACHE PATH "treeland data install directory")
|
2024-11-20 17:47:38 +08:00
|
|
|
set(TREELAND_COMPONENTS_TRANSLATION_DIR "${TREELAND_DATA_DIR}/translations" CACHE PATH "Components translations directory")
|
2024-11-18 10:01:53 +08:00
|
|
|
set(TREELAND_PLUGINS_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib/plugins" CACHE PATH "treeland plugins output directory")
|
|
|
|
|
set(TREELAND_PLUGINS_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}/treeland/plugins" CACHE PATH "treeland plugins install directory")
|
|
|
|
|
|
|
|
|
|
GNUInstallDirs_get_absolute_install_dir(
|
|
|
|
|
TREELAND_FULL_DATA_DIR
|
|
|
|
|
TREELAND_DATA_DIR
|
|
|
|
|
DATADIR
|
2024-11-19 11:08:14 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
GNUInstallDirs_get_absolute_install_dir(
|
|
|
|
|
TREELAND_FULL_PLUGINS_INSTALL_PATH
|
2024-11-18 10:01:53 +08:00
|
|
|
TREELAND_PLUGINS_INSTALL_PATH
|
2024-11-19 11:08:14 +08:00
|
|
|
LIBDIR
|
2024-11-18 10:01:53 +08:00
|
|
|
)
|
2023-08-03 20:43:23 +08:00
|
|
|
|
2024-11-20 17:47:38 +08:00
|
|
|
GNUInstallDirs_get_absolute_install_dir(
|
|
|
|
|
TREELAND_FULL_COMPONENTS_TRANSLATION_DIR
|
|
|
|
|
TREELAND_COMPONENTS_TRANSLATION_DIR
|
|
|
|
|
DATADIR
|
|
|
|
|
)
|
|
|
|
|
|
2024-09-20 18:29:54 +08:00
|
|
|
add_compile_definitions("TREELAND_DATA_DIR=\"${TREELAND_FULL_DATA_DIR}\"")
|
2024-11-08 11:37:33 +08:00
|
|
|
# NOTE:: remove force assert before stable version
|
|
|
|
|
add_compile_definitions("QT_FORCE_ASSERTS")
|
2023-08-03 20:43:23 +08:00
|
|
|
|
2024-11-19 11:08:14 +08:00
|
|
|
add_compile_definitions("TREELAND_PLUGINS_INSTALL_PATH=\"${TREELAND_FULL_PLUGINS_INSTALL_PATH}\"")
|
2024-11-18 10:01:53 +08:00
|
|
|
add_compile_definitions("TREELAND_PLUGINS_OUTPUT_PATH=\"${TREELAND_PLUGINS_OUTPUT_PATH}\"")
|
|
|
|
|
|
2024-11-20 17:47:38 +08:00
|
|
|
add_compile_definitions("TREELAND_COMPONENTS_TRANSLATION_DIR=\"${TREELAND_FULL_COMPONENTS_TRANSLATION_DIR}\"")
|
|
|
|
|
|
2024-09-05 16:35:24 +08:00
|
|
|
set(PROJECT_RESOURCES_DIR "${CMAKE_SOURCE_DIR}/misc")
|
|
|
|
|
|
2024-11-11 15:27:04 +08:00
|
|
|
enable_testing(true)
|
|
|
|
|
|
2023-08-03 20:43:23 +08:00
|
|
|
add_subdirectory(src)
|
2024-09-05 16:35:24 +08:00
|
|
|
add_subdirectory(misc)
|
2024-11-11 15:27:04 +08:00
|
|
|
add_subdirectory(tests)
|
2024-05-27 14:17:02 +08:00
|
|
|
|
2024-11-15 14:17:41 +08:00
|
|
|
if (BUILD_TREELAND_EXAMPLES)
|
2024-11-11 15:27:04 +08:00
|
|
|
add_subdirectory(examples)
|
2024-06-14 17:04:58 +08:00
|
|
|
endif()
|
|
|
|
|
|
2024-05-27 14:17:02 +08:00
|
|
|
# Display feature summary
|
|
|
|
|
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|