From ca4ad58a06fac3db38e5f6238a84fa26516cc7bc Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 22 Sep 2017 10:32:38 +0200 Subject: [PATCH] Packaging: Add options for fine-grained builds #5957 Extracted and adjusted from packaging.diff by @jnweiger and @dschmidt --- CMakeLists.txt | 78 ++++++++++++++++++++------------ shell_integration/CMakeLists.txt | 24 ++++++---- 2 files changed, 65 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 123b3f85dd4..c8ea1982023 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,22 @@ if(NO_MSG_HANDLER) add_definitions(-DNO_MSG_HANDLER=1) endif() -# this option creates only libocsync and libowncloudsync +# this option builds the shell integration +option(BUILD_SHELL_INTEGRATION "BUILD_SHELL_INTEGRATION" ON) + +# this option builds/installs the generic shell integration icons +option(BUILD_SHELL_INTEGRATION_ICONS "BUILD_SHELL_INTEGRATION_ICONS" ON) + +# this options builds the dolphin integration plugin +option(BUILD_SHELL_INTEGRATION_DOLPHIN "BUILD_SHELL_INTEGRATION_DOLPHIN" ON) + +# this options builds the nautilus (like) integration plugins +option(BUILD_SHELL_INTEGRATION_NAUTILUS "BUILD_SHELL_INTEGRATION_NAUTILUS" ON) + +# this option builds the client +option(BUILD_CLIENT "BUILD_CLIENT" ON) + +# this option creates only libocsync and libowncloudsync (NOTE: BUILD_CLIENT needs to be on) option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF) # When this option is enabled, 5xx errors are not added to the blacklist @@ -162,28 +177,30 @@ if(APPLE) set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" ) endif() -if(APPLE) - find_package(Sparkle) -endif(APPLE) - -if(UNIX) - find_package(INotify REQUIRED) -else() - find_package(INotify) -endif() -find_package(Sphinx) -find_package(PdfLatex) +if(BUILD_CLIENT) + if(APPLE) + find_package(Sparkle) + endif(APPLE) -find_package(SQLite3 3.8.0 REQUIRED) -# On some OS, we want to use our own, not the system sqlite -if (USE_OUR_OWN_SQLITE3) - include_directories(BEFORE ${SQLITE3_INCLUDE_DIR}) - if (WIN32) - add_definitions(-DSQLITE_API=__declspec\(dllimport\)) + if(UNIX) + find_package(INotify REQUIRED) + else() + find_package(INotify) + endif() + find_package(Sphinx) + find_package(PdfLatex) + + find_package(SQLite3 3.8.0 REQUIRED) + # On some OS, we want to use our own, not the system sqlite + if (USE_OUR_OWN_SQLITE3) + include_directories(BEFORE ${SQLITE3_INCLUDE_DIR}) + if (WIN32) + add_definitions(-DSQLITE_API=__declspec\(dllimport\)) + endif() endif() -endif() -find_package(ZLIB) + find_package(ZLIB) +endif() if (NOT DEFINED APPLICATION_ICON_NAME) set(APPLICATION_ICON_NAME ${APPLICATION_SHORTNAME}) @@ -223,13 +240,18 @@ set(TRANSLATIONS ${TRANS_FILES}) # Make sure we set this before recursing into child folders. set(WITH_TESTING ${UNIT_TESTING}) -add_subdirectory(src) -if(NOT BUILD_LIBRARIES_ONLY) -add_subdirectory(shell_integration) -add_subdirectory(doc) -add_subdirectory(doc/dev) -add_subdirectory(admin) -endif(NOT BUILD_LIBRARIES_ONLY) +if(BUILD_CLIENT) + add_subdirectory(src) + if(NOT BUILD_LIBRARIES_ONLY) + add_subdirectory(doc) + add_subdirectory(doc/dev) + add_subdirectory(admin) + endif(NOT BUILD_LIBRARIES_ONLY) +endif() + +if(BUILD_SHELL_INTEGRATION) + add_subdirectory(shell_integration) +endif() if(UNIT_TESTING) include(CTest) @@ -243,7 +265,7 @@ configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) if(BUILD_OWNCLOUD_OSX_BUNDLE) install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/) configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY) -else() +elseif(BUILD_CLIENT) install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} ) configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY) endif() diff --git a/shell_integration/CMakeLists.txt b/shell_integration/CMakeLists.txt index 03b2bbc340a..87c453bf2d5 100644 --- a/shell_integration/CMakeLists.txt +++ b/shell_integration/CMakeLists.txt @@ -1,17 +1,23 @@ if (APPLE) add_subdirectory(MacOSX) endif() -add_subdirectory(icons) +if(BUILD_SHELL_INTEGRATION_ICONS) + add_subdirectory(icons) +endif() if( UNIX AND NOT APPLE ) - add_subdirectory(nautilus) + if(BUILD_SHELL_INTEGRATION_NAUTILUS) + add_subdirectory(nautilus) + endif() - find_package(ECM 1.2.0 NO_MODULE QUIET) - set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - find_package(KF5 "5.16" COMPONENTS KIO) - if(KF5_FOUND) - add_subdirectory(dolphin) - else() - message("Dolphin plugin disabled: KDE Frameworks 5.16 not found") + if(BUILD_SHELL_INTEGRATION_DOLPHIN) + find_package(ECM 1.2.0 NO_MODULE QUIET) + set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + find_package(KF5 "5.16" COMPONENTS KIO) + if(KF5_FOUND) + add_subdirectory(dolphin) + else() + message("Dolphin plugin disabled: KDE Frameworks 5.16 not found") + endif() endif() endif()