From 83639b182baaf4d992e7e98083852b664f8a757e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 13 Feb 2018 10:26:04 -0500 Subject: [PATCH 1/5] CMake: try installing outside of regular lib/ - Install unversioned libraries - Install to lib/calamares instead of directly to lib/ --- src/libcalamares/CMakeLists.txt | 13 ++----------- src/libcalamaresui/CMakeLists.txt | 3 ++- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 2a1cfeb20..3ee03dd96 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -83,8 +83,6 @@ add_library( calamares SHARED ${libSources} ${kdsagSources} ${utilsSources} ) set_target_properties( calamares PROPERTIES AUTOMOC TRUE - VERSION ${CALAMARES_VERSION_SHORT} - SOVERSION ${CALAMARES_VERSION_SHORT} ) target_link_libraries( calamares @@ -95,17 +93,10 @@ target_link_libraries( calamares install( TARGETS calamares EXPORT CalamaresLibraryDepends RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/ + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/ ) -# Make symlink lib/calamares/libcalamares.so to lib/libcalamares.so.VERSION so -# lib/calamares can be used as module path for the Python interpreter. -install( CODE " - file( MAKE_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" ) - execute_process( COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ../libcalamares.so.${CALAMARES_VERSION_SHORT} libcalamares.so WORKING_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" ) -") - # Install header files file( GLOB rootHeaders "*.h" ) file( GLOB kdsingleapplicationguardHeaders "kdsingleapplicationguard/*.h" ) diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index 7c3e8fca2..9ef52716b 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -78,5 +78,6 @@ calamares_add_library( calamaresui Qt5::QuickWidgets RESOURCES libcalamaresui.qrc EXPORT CalamaresLibraryDepends - VERSION ${CALAMARES_VERSION_SHORT} + NO_VERSION + INSTALL_BINDIR ${CMAKE_INSTALL_LIBDIR}/calamares/ ) From af67ab27229cb23a05337b6a93e3f668130da021 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 14 Feb 2018 04:55:21 -0500 Subject: [PATCH 2/5] CMake: install missing module - The CMake modules for Calamares expect to find CMakeColors - Also the translation support macro - Restore CalamaresUse.cmake - File was removed after 3.1 in db105079, but it is actually useful for out-of-tree modules. Restore it and massage into better shape. - Simplify by adding path to the search path (otherwise the individual macro files would also have to switch to including with a full path). --- CMakeLists.txt | 4 ++++ CalamaresUse.cmake.in | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 CalamaresUse.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index f051e49c6..5ccc8b1c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -340,16 +340,20 @@ file( RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_CMAKEDIR}" "${CMA configure_file( CalamaresConfig.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" @ONLY ) configure_file( CalamaresConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" @ONLY ) +configure_file( CalamaresUse.cmake.in "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" @ONLY ) # Install the cmake files install( FILES "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" + "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" "CMakeModules/CalamaresAddPlugin.cmake" "CMakeModules/CalamaresAddModuleSubdirectory.cmake" "CMakeModules/CalamaresAddLibrary.cmake" "CMakeModules/CalamaresAddBrandingSubdirectory.cmake" + "CMakeModules/CalamaresAddTranslations.cmake" + "CMakeModules/CMakeColors.cmake" DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" ) diff --git a/CalamaresUse.cmake.in b/CalamaresUse.cmake.in new file mode 100644 index 000000000..474704ec1 --- /dev/null +++ b/CalamaresUse.cmake.in @@ -0,0 +1,29 @@ +# A setup-cmake-things-for-Calamares module. +# +# This module handles looking for dependencies and including +# all of the Calamares macro modules, so that you can focus +# on just using the macros to build Calamares modules. +# Typical use looks like this: +# +# ``` +# find_package( Calamares REQUIRED ) +# include( "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake" ) +# ``` +# +# The first CMake command finds Calamares (which will contain +# this file), then adds the found location to the search path, +# and then includes this file. After that, you can use +# Calamares module and plugin macros. + +if( NOT CALAMARES_CMAKE_DIR ) + message( FATAL_ERROR "Use find_package(Calamares) first." ) +endif() +set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CALAMARES_CMAKE_DIR} ) + +find_package( Qt5 @QT_VERSION@ CONFIG REQUIRED Core Widgets ) + +include( CalamaresAddLibrary ) +include( CalamaresAddModuleSubdirectory ) +include( CalamaresAddPlugin ) +include( CalamaresAddBrandingSubdirectory ) + From f047b0b110c9feafc229f42729e5810a7c0ac6be Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 14 Feb 2018 13:41:12 -0500 Subject: [PATCH 3/5] CMake: reduce duplicate ECM searches --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ccc8b1c8..5f8c96777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,16 +126,12 @@ set( QT_VERSION 5.6.0 ) find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core Gui Widgets LinguistTools Svg Quick QuickWidgets ) find_package( YAMLCPP 0.5.1 REQUIRED ) find_package( PolkitQt5-1 REQUIRED ) -find_package(ECM 5.18 NO_MODULE) -if( ECM_FOUND ) - set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) -endif() # Find ECM once, and add it to the module search path; Calamares # modules that need ECM can do # find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE), # no need to mess with the module path after. -set( ECM_VERSION 5.10.0 ) +set( ECM_VERSION 5.18 ) find_package(ECM ${ECM_VERSION} NO_MODULE) if( ECM_FOUND ) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) From db0c1ffd6de9dd8d6b8f83519f7d3a973c884950 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 19 Feb 2018 04:23:56 -0500 Subject: [PATCH 4/5] CMake: just install unversioned .so - Applies to libcalamares and libcalamaresui.so, install with no version, just the bare .so. Since Calamares doesn't do versioning anyway, and its plugins should be re-compiled for any change, putting them in lib as unversioned .so's should make Calamares happy and silence lintian. --- src/calamares/CMakeLists.txt | 2 +- src/libcalamares/CMakeLists.txt | 5 ++--- src/libcalamaresui/CMakeLists.txt | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index f47a0a9f5..fc4e508a2 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -42,7 +42,7 @@ add_calamares_translations( ${CALAMARES_TRANSLATION_LANGUAGES} ) set( final_src ${calamaresUi_H} ${calamaresSources} ${calamaresRc} ${trans_outfile} ) add_executable( calamares_bin ${final_src} ) -SET_TARGET_PROPERTIES(calamares_bin +set_target_properties(calamares_bin PROPERTIES AUTOMOC TRUE ENABLE_EXPORTS TRUE diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 3ee03dd96..94e9145d6 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -92,9 +92,8 @@ target_link_libraries( calamares install( TARGETS calamares EXPORT CalamaresLibraryDepends - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/ - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/ + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) # Install header files diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index 9ef52716b..4d0ec8281 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -79,5 +79,4 @@ calamares_add_library( calamaresui RESOURCES libcalamaresui.qrc EXPORT CalamaresLibraryDepends NO_VERSION - INSTALL_BINDIR ${CMAKE_INSTALL_LIBDIR}/calamares/ ) From 56ce22908e61924edff14471839992ebda37ec42 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 21 Feb 2018 05:34:54 -0500 Subject: [PATCH 5/5] CMake: drop empty calamaresUi - Empty variable and some unused wrappings doing nothing. --- src/calamares/CMakeLists.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index fc4e508a2..270abbb88 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -18,10 +18,6 @@ set( calamaresSources progresstree/ViewStepItem.cpp ) -set( calamaresUi - #nothing to do here -) - include_directories( . ${CMAKE_CURRENT_BINARY_DIR} @@ -33,13 +29,11 @@ include_directories( include( GNUInstallDirs ) -qt5_wrap_ui( calamaresUi_H ${calamaresUi} ) - # Translations include( CalamaresAddTranslations ) add_calamares_translations( ${CALAMARES_TRANSLATION_LANGUAGES} ) -set( final_src ${calamaresUi_H} ${calamaresSources} ${calamaresRc} ${trans_outfile} ) +set( final_src ${calamaresSources} ${calamaresRc} ${trans_outfile} ) add_executable( calamares_bin ${final_src} ) set_target_properties(calamares_bin