From 078be8ba2186cf095a2f4c162665a4a265cab3d6 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Mon, 6 Dec 2021 10:17:08 +0100 Subject: Add ENABLE_LOMIRI_FEATURES switch --- CMakeLists.txt | 22 +++++++++++++++------- src/CMakeLists.txt | 7 +++---- tests/CMakeLists.txt | 7 +++---- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b98b697..dbb9b50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ set(ABI_VERSION 0) option(ENABLE_TESTS "Enable all tests and checks" OFF) option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF) option(ENABLE_WERROR "Treat all build warnings as errors" OFF) +option(ENABLE_LOMIRI_FEATURES "Build with Lomiri-specific libraries, schemas and media" OFF) if(ENABLE_COVERAGE) set(ENABLE_TESTS ON) @@ -39,17 +40,22 @@ set (CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_ find_package (PkgConfig REQUIRED) include (FindPkgConfig) -pkg_check_modules(GLIB REQUIRED +set ( + DEPS glib-2.0>=2.36 gio-2.0>=2.36 ) -include_directories (${GLIB_INCLUDE_DIRS}) -pkg_check_modules( - URLDISPATCHER - lomiri-url-dispatcher>=0 -) -include_directories(${URLDISPATCHER_INCLUDE_DIRS}) +if (ENABLE_LOMIRI_FEATURES) + list ( + APPEND + DEPS + lomiri-url-dispatcher>=0 + ) +endif () + +pkg_check_modules (DEPS REQUIRED ${DEPS}) +include_directories (${DEPS_INCLUDE_DIRS}) # for GIR and Vala bindings find_package (GObjectIntrospection QUIET) @@ -91,3 +97,5 @@ if (INTROSPECTION_FOUND) else() message(STATUS "Build GObjectIntrospection: NO") endif() + +message(STATUS "Build with Lomiri features: ${ENABLE_LOMIRI_FEATURES}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e4d529..7ca0f5f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,12 +4,11 @@ add_library(ayatana-common SHARED ) target_link_libraries(ayatana-common - ${GLIB_LIBRARIES} - ${URLDISPATCHER_LIBRARIES} + ${DEPS_LIBRARIES} ) -if(URLDISPATCHER_FOUND) - add_definitions( -DHAS_URLDISPATCHER ) +if(ENABLE_LOMIRI_FEATURES) + add_definitions( -DLOMIRI_FEATURES_ENABLED ) endif() set(PUBLIC_HEADERS diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 44ceb0e..7758e59 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,8 +25,7 @@ target_include_directories(tst_utils PUBLIC "${CMAKE_SOURCE_DIR}/src") target_link_libraries(tst_utils ayatana-common - ${GLIB_LIBRARIES} - ${URL_DISPATCHER_LIBRARIES} + ${DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES} @@ -59,8 +58,8 @@ add_custom_command( if (VALA_COMPILER) add_executable("tst_utils_vala" "${CMAKE_CURRENT_BINARY_DIR}/tst_utils.c") - target_include_directories("tst_utils_vala" PUBLIC "${GLIB_INCLUDE_DIRS};${CMAKE_BINARY_DIR}/src") - target_link_libraries("tst_utils_vala" "${GLIB_LIBRARIES} -layatana-common -L${CMAKE_BINARY_DIR}/src") + target_include_directories("tst_utils_vala" PUBLIC "${DEPS_INCLUDE_DIRS};${CMAKE_BINARY_DIR}/src") + target_link_libraries("tst_utils_vala" "${DEPS_LIBRARIES} -layatana-common -L${CMAKE_BINARY_DIR}/src") target_link_directories("tst_utils_vala" PUBLIC "${CMAKE_BINARY_DIR}/src") add_dependencies("tst_utils_vala" "src") -- cgit v1.2.3