Merge branch 'issue-1428'

Install all the relevant CMake, libcalamares and libcalamaresui
files -- config and headers -- so that external modules can be
created (again). This support had severely bitrotted, so
that the only effective way to add modules was to do so inside
the Calamares build tree. Now it's independent again.

FIXES 
main
Adriaan de Groot
commit 6c40d69574

@ -162,7 +162,13 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
) )
endif() endif()
# CMake Modules
include( CMakePackageConfigHelpers )
include( CTest ) include( CTest )
include( FeatureSummary )
# Calamares Modules
include( CMakeColors )
### C++ SETUP ### C++ SETUP
# #
@ -248,9 +254,6 @@ if( CMAKE_COMPILER_IS_GNUCXX )
endif() endif()
endif() endif()
include( FeatureSummary )
include( CMakeColors )
### DEPENDENCIES ### DEPENDENCIES
# #
@ -520,16 +523,10 @@ endif()
# make predefined install dirs available everywhere # make predefined install dirs available everywhere
include( GNUInstallDirs ) include( GNUInstallDirs )
# make uninstall support # This is used by CalamaresAddLibrary; once Calamares is installed,
configure_file( # the CalamaresConfig.cmake module sets this variable to the IMPORTED
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" # libraries for Calamares.
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" set( Calamares_LIBRARIES calamares )
IMMEDIATE @ONLY
)
# Early configure these files as we need them later on
set( CALAMARES_CMAKE_DIR "${CMAKE_SOURCE_DIR}/CMakeModules" )
set( CALAMARES_LIBRARIES calamares )
add_subdirectory( src ) add_subdirectory( src )
@ -539,32 +536,39 @@ add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration")
add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash") add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash")
add_feature_info(KDBusAddons ${WITH_KF5DBus} "Unique-application via DBus") add_feature_info(KDBusAddons ${WITH_KF5DBus} "Unique-application via DBus")
# Add all targets to the build-tree export set ### CMake infrastructure installation
#
#
set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" ) set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" )
set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" ) set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
export( TARGETS calamares
FILE "${PROJECT_BINARY_DIR}/CalamaresLibraryDepends.cmake" )
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export( PACKAGE Calamares ) export( PACKAGE Calamares )
configure_package_config_file(
# Create a CalamaresBuildTreeSettings.cmake file for the use from the build tree "CalamaresConfig.cmake.in"
configure_file( CalamaresBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/CalamaresBuildTreeSettings.cmake" @ONLY ) "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
# Create the CalamaresConfig.cmake and CalamaresConfigVersion files PATH_VARS
file( RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_CMAKEDIR}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ) CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_LIBDIR
configure_file( CalamaresConfig.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" @ONLY ) CMAKE_INSTALL_DATADIR
configure_file( CalamaresConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" @ONLY ) )
configure_file( CalamaresUse.cmake.in "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" @ONLY ) write_basic_package_version_file(
${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(
EXPORT Calamares
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
FILE "CalamaresTargets.cmake"
NAMESPACE Calamares::
)
# Install the cmake files # Install the cmake files
install( install(
FILES FILES
"${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake"
"${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/CalamaresUse.cmake"
"CMakeModules/CalamaresAddBrandingSubdirectory.cmake" "CMakeModules/CalamaresAddBrandingSubdirectory.cmake"
"CMakeModules/CalamaresAddLibrary.cmake" "CMakeModules/CalamaresAddLibrary.cmake"
"CMakeModules/CalamaresAddModuleSubdirectory.cmake" "CMakeModules/CalamaresAddModuleSubdirectory.cmake"
@ -573,48 +577,36 @@ install(
"CMakeModules/CalamaresAddTranslations.cmake" "CMakeModules/CalamaresAddTranslations.cmake"
"CMakeModules/CalamaresAutomoc.cmake" "CMakeModules/CalamaresAutomoc.cmake"
"CMakeModules/CMakeColors.cmake" "CMakeModules/CMakeColors.cmake"
"CMakeModules/FindYAMLCPP.cmake"
DESTINATION DESTINATION
"${CMAKE_INSTALL_CMAKEDIR}" "${CMAKE_INSTALL_CMAKEDIR}"
) )
# Install the export set for use with the install-tree ### Miscellaneous installs
install( #
EXPORT #
CalamaresLibraryDepends
DESTINATION
"${CMAKE_INSTALL_CMAKEDIR}"
)
if( INSTALL_CONFIG ) if( INSTALL_CONFIG )
install( install(
FILES FILES settings.conf
settings.conf DESTINATIONshare/calamares
DESTINATION
share/calamares
) )
endif() endif()
if( INSTALL_POLKIT ) if( INSTALL_POLKIT )
install( install(
FILES FILES com.github.calamares.calamares.policy
com.github.calamares.calamares.policy DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}"
DESTINATION
"${POLKITQT-1_POLICY_FILES_INSTALL_DIR}"
) )
endif() endif()
install( install(
FILES FILES calamares.desktop
calamares.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
DESTINATION
${CMAKE_INSTALL_DATADIR}/applications
) )
install( install(
FILES FILES man/calamares.8
man/calamares.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/
DESTINATION
${CMAKE_INSTALL_MANDIR}/man8/
) )
# uninstall target # uninstall target

@ -93,11 +93,10 @@ function(calamares_add_library)
# add link targets # add link targets
target_link_libraries(${target} target_link_libraries(${target}
LINK_PUBLIC ${CALAMARES_LIBRARIES} LINK_PUBLIC ${Calamares_LIBRARIES}
Qt5::Core Qt5::Core
Qt5::Gui Qt5::Gui
Qt5::Widgets Qt5::Widgets
${LIBRARY_QT5_MODULES}
) )
if(LIBRARY_LINK_LIBRARIES) if(LIBRARY_LINK_LIBRARIES)
target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES}) target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES})

@ -1,4 +0,0 @@
set(CALAMARES_INCLUDE_DIRS
"@PROJECT_SOURCE_DIR@/src/libcalamares"
"@PROJECT_BINARY_DIR@/src/libcalamares"
)

@ -1,32 +1,78 @@
# Config file for the Calamares package # Config file for the Calamares package
# #
# It defines the following variables # The following IMPORTED targets are defined:
# CALAMARES_INCLUDE_DIRS - include directories for Calamares # - Calamares::calamares - the core library
# CALAMARES_LIBRARIES - libraries to link against # - Calamares::calamaresui - the UI (and QML) library
# CALAMARES_USE_FILE - name of a convenience include #
# CALAMARES_APPLICATION_NAME - human-readable application name # For legacy use it defines the following variables:
# - Calamares_INCLUDE_DIRS - include directories for Calamares
# - Calamares_LIB_DIRS - library directories
# - Calamares_LIBRARIES - libraries to link against
@PACKAGE_INIT@
### Versioning and IMPORTED targets
# #
# Typical use is:
# #
# find_package(Calamares REQUIRED) include(${CMAKE_CURRENT_LIST_DIR}/CalamaresConfigVersion.cmake)
# include("${CALAMARES_USE_FILE}") include(${CMAKE_CURRENT_LIST_DIR}/CalamaresTargets.cmake)
### Dependencies
#
# The libraries can depend on a variety of Qt and KDE Frameworks
# components, so accumulate them and find (just once).
# #
macro(accumulate_deps outvar target namespace)
string(LENGTH ${namespace} _nslen)
get_target_property(_libs ${target} INTERFACE_LINK_LIBRARIES)
foreach(_lib ${_libs})
if (_lib MATCHES ^${namespace})
string(SUBSTRING ${_lib} ${_nslen} -1 _component)
list(APPEND ${outvar} ${_component})
endif()
endforeach()
endmacro()
# Qt5 infrastructure for translations is required
set(qt5_required Core Widgets LinguistTools)
accumulate_deps(qt5_required Calamares::calamares Qt5::)
accumulate_deps(qt5_required Calamares::calamaresui Qt5::)
find_package(Qt5 CONFIG REQUIRED ${qt5_required})
# Compute paths set(kf5_required "")
get_filename_component(CALAMARES_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) accumulate_deps(kf5_required Calamares::calamares KF5::)
if(EXISTS "${CALAMARES_CMAKE_DIR}/CMakeCache.txt") accumulate_deps(kf5_required Calamares::calamaresui KF5::)
# In build tree if(kf5_required)
include("${CALAMARES_CMAKE_DIR}/CalamaresBuildTreeSettings.cmake") find_package(ECM ${ECM_VERSION} NO_MODULE)
else() if( ECM_FOUND )
set(CALAMARES_INCLUDE_DIRS "${CALAMARES_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@/libcalamares") list(PREPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(KF5 REQUIRED COMPONENTS ${kf5_required})
endif()
endif() endif()
# Our library dependencies (contains definitions for IMPORTED targets) ### Legacy support
include("${CALAMARES_CMAKE_DIR}/CalamaresLibraryDepends.cmake") #
#
set(Calamares_LIB_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
set(Calamares_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set(Calamares_LIBRARIES Calamares::calamares)
### CMake support
#
#
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
# These are IMPORTED targets created by CalamaresLibraryDepends.cmake include(CalamaresAddBrandingSubdirectory)
set(CALAMARES_LIBRARIES calamares) include(CalamaresAddLibrary)
include(CalamaresAddModuleSubdirectory)
include(CalamaresAddPlugin)
# Convenience variables # These are feature-settings that affect consumers of Calamares
set(CALAMARES_USE_FILE "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake") # libraries as well; without Python-support in the libs, for instance,
set(CALAMARES_APPLICATION_NAME "Calamares") # there's no point in having a Python plugin.
#
# This list should match the one in libcalamares/CalamaresConfig.h,
# which is the C++-language side of the same configuration.
set(Calamares_WITH_PYTHON @WITH_PYTHON@)
set(Calamares_WITH_PYTHONQT @WITH_PYTHONQT@)
set(Calamares_WITH_QML @WITH_QML@)

@ -1,12 +0,0 @@
set(PACKAGE_VERSION "@CALAMARES_VERSION@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

@ -1,29 +0,0 @@
# 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 LinguistTools )
include( CalamaresAddLibrary )
include( CalamaresAddModuleSubdirectory )
include( CalamaresAddPlugin )
include( CalamaresAddBrandingSubdirectory )

@ -166,7 +166,7 @@ dont-chroot: false
# If this is set to true, Calamares refers to itself as a "setup program" # If this is set to true, Calamares refers to itself as a "setup program"
# rather than an "installer". Defaults to the value of dont-chroot, but # rather than an "installer". Defaults to the value of dont-chroot, but
# Calamares will complain if this is not explicitly set. # Calamares will complain if this is not explicitly set.
# oem-setup: true oem-setup: false
# If this is set to true, the "Cancel" button will be disabled entirely. # If this is set to true, the "Cancel" button will be disabled entirely.
# The button is also hidden from view. # The button is also hidden from view.

@ -1,5 +1,5 @@
# === This file is part of Calamares - <https://github.com/calamares> === # === This file is part of Calamares - <https://github.com/calamares> ===
# #
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org> # SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# #
# Calamares is free software: you can redistribute it and/or modify # Calamares is free software: you can redistribute it and/or modify
@ -163,21 +163,25 @@ set_target_properties( calamares
PROPERTIES PROPERTIES
VERSION ${CALAMARES_VERSION_SHORT} VERSION ${CALAMARES_VERSION_SHORT}
SOVERSION ${CALAMARES_VERSION_SHORT} SOVERSION ${CALAMARES_VERSION_SHORT}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
) )
calamares_automoc( calamares ) calamares_automoc( calamares )
target_link_libraries( calamares target_link_libraries( calamares
LINK_PRIVATE LINK_PRIVATE
${OPTIONAL_PRIVATE_LIBRARIES} ${OPTIONAL_PRIVATE_LIBRARIES}
LINK_PUBLIC
yamlcpp yamlcpp
LINK_PUBLIC
Qt5::Core Qt5::Core
KF5::CoreAddons KF5::CoreAddons
${OPTIONAL_PUBLIC_LIBRARIES} ${OPTIONAL_PUBLIC_LIBRARIES}
) )
### Installation
#
#
install( TARGETS calamares install( TARGETS calamares
EXPORT CalamaresLibraryDepends EXPORT Calamares
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
@ -192,13 +196,18 @@ install( CODE "
# Install header files # Install header files
file( GLOB rootHeaders "*.h" ) file( GLOB rootHeaders "*.h" )
file( GLOB kdsingleapplicationguardHeaders "kdsingleapplicationguard/*.h" ) install(
file( GLOB utilsHeaders "utils/*.h" ) FILES
${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h
${rootHeaders}
DESTINATION include/libcalamares
)
# Install each subdir-worth of header files
foreach( subdir geoip locale modulesystem network partition utils )
file( GLOB subdir_headers "${subdir}/*.h" )
install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} )
endforeach()
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h DESTINATION include/libcalamares )
install( FILES ${rootHeaders} DESTINATION include/libcalamares )
install( FILES ${kdsingleapplicationguardHeaders} DESTINATION include/libcalamares/kdsingleapplicationguard )
install( FILES ${utilsHeaders} DESTINATION include/libcalamares/utils )
### TESTING ### TESTING
# #

@ -1,5 +1,5 @@
/* === This file is part of Calamares - <https://github.com/calamares> === /* === This file is part of Calamares - <https://github.com/calamares> ===
* *
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org> * SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
* *
* Calamares is free software: you can redistribute it and/or modify * Calamares is free software: you can redistribute it and/or modify
@ -29,7 +29,14 @@
#define CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/calamares" #define CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/calamares"
#define CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}" #define CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}"
//cmakedefines for CMake variables (e.g. for optdepends) go here /*
* These are feature-settings that affect consumers of Calamares
* libraries as well; without Python-support in the libs, for instance,
* there's no point in having a Python plugin.
*
* This list should match the one in CalamaresConfig.cmake
* which is the CMake-time side of the same configuration.
*/
#cmakedefine WITH_PYTHON #cmakedefine WITH_PYTHON
#cmakedefine WITH_PYTHONQT #cmakedefine WITH_PYTHONQT
#cmakedefine WITH_QML #cmakedefine WITH_QML

@ -66,8 +66,9 @@ calamares_add_library( calamaresui
EXPORT_MACRO UIDLLEXPORT_PRO EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES LINK_LIBRARIES
Qt5::Svg Qt5::Svg
yamlcpp
RESOURCES libcalamaresui.qrc RESOURCES libcalamaresui.qrc
EXPORT CalamaresLibraryDepends EXPORT Calamares
VERSION ${CALAMARES_VERSION_SHORT} VERSION ${CALAMARES_VERSION_SHORT}
) )
@ -82,3 +83,25 @@ endif()
if( WITH_QML ) if( WITH_QML )
target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets ) target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets )
endif() endif()
### Installation
#
#
# The library is already installed through calamares_add_library(),
# so we only need to do headers. Unlike the Calamares source tree,
# where libcalamares and libcalamaresui live in different branches,
# we're going to glom it all together in the installed headers location.
install(
FILES
Branding.h
ViewManager.h
DESTINATION include/libcalamares
)
# Install each subdir-worth of header files
foreach( subdir modulesystem utils viewpages widgets )
file( GLOB subdir_headers "${subdir}/*.h" )
install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} )
endforeach()

@ -26,5 +26,6 @@ calamares_add_test(
PackageModel.cpp PackageModel.cpp
LIBRARIES LIBRARIES
Qt5::Gui Qt5::Gui
yamlcpp
) )

Loading…
Cancel
Save