# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
###
#
# Calamares is Free Software: see the License-Identifier above.
#
# Individual files may have different licenses (like the CMake
# infrastructure, which is BSD-2-Clause licensed). Check the SPDX
# identifiers in each file.
#
###
#
# Generally, this CMakeLists.txt will find all the dependencies for Calamares
# and complain appropriately. See below (later in this file) for CMake-level
# options. There are some "secret" options as well:
#
# SKIP_MODULES : a space or semicolon-separated list of directory names
# under src/modules that should not be built.
# USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>
# WITH_<foo> : try to enable <foo> (these usually default to ON). For
# a list of WITH_<foo> grep CMakeCache.txt after running
# CMake once. These affect the ABI offered by Calamares.
# - PYTHON (enable Python Job modules)
# - QML (enable QML UI View modules)
# - PYTHONQT # TODO:3.3: remove
# BUILD_<foo> : choose additional things to build
# - TESTING (standard CMake option)
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
# DEBUG_<foo> : special developer flags for debugging
#
# Example usage:
#
# cmake . -DSKIP_MODULES="partition luksbootkeycfg"
#
# One special target is "show-version", which can be built
# to obtain the version number from here.
# TODO:3.3: Require CMake 3.12
cmake_minimum_required ( VERSION 3.3 FATAL_ERROR )
project ( CALAMARES
V E R S I O N 3 . 2 . 4 0
L A N G U A G E S C C X X
)
set ( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development
### OPTIONS
#
option ( INSTALL_CONFIG "Install configuration files" OFF )
option ( INSTALL_POLKIT "Install Polkit configuration" ON )
option ( INSTALL_COMPLETION "Install shell completions" OFF )
# Options for the calamares executable
option ( WITH_KF5Crash "Enable crash reporting with KCrash." ON ) # TODO:3.3: WITH->BUILD (this isn't an ABI thing)
option ( WITH_KF5DBus "Use DBus service for unique-application." OFF ) # TODO:3.3: WITH->BUILD
# When adding WITH_* that affects the ABI offered by libcalamares,
# also update libcalamares/CalamaresConfig.h.in
option ( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
option ( WITH_PYTHONQT "Enable Python view modules API (deprecated, requires PythonQt)." OFF ) # TODO:3.3: remove
option ( WITH_QML "Enable QML UI options." ON )
#
# Additional parts to build
option ( BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON )
# Possible debugging flags are:
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
# widget and enables chatty debug logging, for dealing with the timezone
# location database.
# - DEBUG_FILESYSTEMS does extra logging and checking when looking at
# partition configuration. Lists known KPMCore FS types.
# - DEBUG_PARTITION_UNSAFE (see partition/CMakeLists.txt)
# - DEBUG_PARTITION_LAME (see partition/CMakeLists.txt)
### USE_*
#
# By convention, when there are multiple modules that implement similar
# functionality, and it only makes sense to have **at most one** of them
# enabled at any time, those modules are named <foo>-<implementation>.
# For example, services-systemd and services-openrc.
#
# Setting up SKIP_MODULES to ignore "the ones you don't want" can be
# annoying and error-prone (e.g. if a new module shows up). The USE_*
# modules provide a way to do automatic selection. To pick exactly
# one of the implementations from group <foo>, set USE_<foo> to the
# name of the implementation. If USE_<foo> is unset, or empty, then
# all the implementations are enabled (this just means they are
# **available** to `settings.conf`, not that they are used).
#
# To explicitly disable a set of modules, set USE_<foo>=none
# (e.g. the literal string none), which won't match any of the
# modules but is handled specially.
#
# The following USE_* functionalities are available:
# - *services* picks one of the two service-configuration modules,
# for either systemd or openrc. This defaults to empty so that
# **both** modules are available.
set ( USE_services "" CACHE STRING "Select the services module to use" )
### Calamares application info
#
set ( CALAMARES_ORGANIZATION_NAME "Calamares" )
set ( CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares" )
set ( CALAMARES_APPLICATION_NAME "Calamares" )
set ( CALAMARES_DESCRIPTION_SUMMARY
" T h e d i s t r i b u t i o n - i n d e p e n d e n t i n s t a l l e r f r a m e w o r k " )
### Transifex (languages) info
#
# complete = 100% translated,
# good = nearly complete (use own judgement, right now >= 75%)
# ok = incomplete (more than 25% untranslated, at least 5% translated),
# incomplete = <5% translated, placeholder in tx; these are not included.
#
# Language en (source language) is added later. It isn't listed in
# Transifex either. Get the list of languages and their status
# from https://transifex.com/calamares/calamares/ , or (preferably)
# use ci/txstats.py to automatically check.
#
# When adding a new language, take care that it is properly loaded
# by the translation framework. Languages with alternate scripts
# (sr@latin in particular) may need special handling in CalamaresUtils.cpp.
#
# TODO: drop the es_ES translation from Transifex
#
# NOTE: move eo (Esperanto) to _ok once Qt can actually create a
# locale for it. (Qt 5.12.2 can, see Translation Status section).
# NOTE: move ie (Interlingue) to _ok once Qt supports it.
# NOTE: update these lines by running `txstats.py`, or for full automation
# `txstats.py -e`. See also
#
# Total 77 languages
set ( _tx_complete ca lt pt_PT sq uk zh_TW )
set ( _tx_good as az az_AZ be ca@valencia cs_CZ da de fi_FI fr fur
h e h i h r i t _ I T j a k o m l n l p t _ B R r u s k s v t g t r _ T R v i z h _ C N )
set ( _tx_ok ar ast bg bn el en_GB es es_MX es_PR et eu fa gl hu id
i s m r n b p l r o s l s r s r @ l a t i n t h )
set ( _tx_incomplete eo es_PE fr_CH gu id_ID ie kk kn lo lv mk ne
n e _ N P r u _ R U s i t e u r u z z h )
### Required versions
#
# See DEPENDENCIES section below.
set ( QT_VERSION 5.9.0 )
set ( YAMLCPP_VERSION 0.5.1 )
set ( ECM_VERSION 5.18 )
set ( PYTHONLIBS_VERSION 3.3 )
set ( BOOSTPYTHON_VERSION 1.55.0 )
### CMAKE SETUP
#
set ( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" )
# Enable IN_LIST
if ( POLICY CMP0057 )
cmake_policy ( SET CMP0057 NEW )
endif ( )
# Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files.
if ( POLICY CMP0071 )
cmake_policy ( SET CMP0071 NEW )
endif ( )
# Recognize more macros to trigger automoc
if ( NOT CMAKE_VERSION VERSION_LESS "3.10.0" )
list ( APPEND CMAKE_AUTOMOC_MACRO_NAMES
" K _ P L U G I N _ F A C T O R Y _ W I T H _ J S O N "
" K _ E X P O R T _ P L A S M A _ D A T A E N G I N E _ W I T H _ J S O N "
" K _ E X P O R T _ P L A S M A _ R U N N E R "
)
endif ( )
# CMake Modules
include ( CMakePackageConfigHelpers )
include ( CTest )
include ( FeatureSummary )
# Calamares Modules
include ( CMakeColors )
### C++ SETUP
#
set ( CMAKE_CXX_STANDARD 17 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type" )
set ( CMAKE_CXX_FLAGS_DEBUG "-Og -g ${CMAKE_CXX_FLAGS_DEBUG}" )
set ( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
set ( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" )
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" )
set ( CMAKE_C_STANDARD 99 )
set ( CMAKE_C_STANDARD_REQUIRED ON )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
set ( CMAKE_C_FLAGS_DEBUG "-Og -g" )
set ( CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
set ( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" )
set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--fatal-warnings" )
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
message ( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." )
# Clang warnings: doing *everything* is counter-productive, since it warns
# about things which we can't fix (e.g. C++98 incompatibilities, but
# Calamares is C++17).
foreach ( CLANG_WARNINGS
- W e v e r y t h i n g
- W n o - c + + 9 8 - c o m p a t
- W n o - c + + 9 8 - c o m p a t - p e d a n t i c
- W n o - p a d d e d
- W n o - u n d e f i n e d - r e i n t e r p r e t - c a s t
- W n o - g l o b a l - c o n s t r u c t o r s
- W n o - e x i t - t i m e - d e s t r u c t o r s
- W n o - m i s s i n g - p r o t o t y p e s
- W n o - d o c u m e n t a t i o n - u n k n o w n - c o m m a n d
- W n o - u n k n o w n - w a r n i n g - o p t i o n
)
string ( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" )
endforeach ( )
# The dwarf-debugging flags are slightly different, too
string ( APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf" )
string ( APPEND CMAKE_C_FLAGS_DEBUG " -gdwarf" )
# Third-party code where we don't care so much about compiler warnings
# (because it's uncomfortable to patch) get different flags; use
# mark_thirdparty_code( <file> [<file>...] )
# to switch off warnings for those sources.
set ( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" )
set ( CMAKE_TOOLCHAIN_PREFIX "llvm-" )
# The path prefix is only relevant for CMake 3.16 and later, fixes #1286
set ( CMAKE_AUTOMOC_PATH_PREFIX OFF )
set ( CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h" )
set ( CALAMARES_AUTOUIC_OPTIONS --include utils/moc-warnings.h )
else ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual" )
set ( SUPPRESS_3RDPARTY_WARNINGS "" )
endif ( )
# Use mark_thirdparty_code() to reduce warnings from the compiler
# on code that we're not going to fix. Call this with a list of files.
macro ( mark_thirdparty_code )
set_source_files_properties ( ${ ARGV }
P R O P E R T I E S
C O M P I L E _ F L A G S " $ { S U P P R E S S _ 3 R D P A R T Y _ W A R N I N G S } "
C O M P I L E _ D E F I N I T I O N S " T H I R D P A R T Y "
)
endmacro ( )
if ( CMAKE_COMPILER_IS_GNUCXX )
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR
C M A K E _ C X X _ C O M P I L E R _ V E R S I O N V E R S I O N _ E Q U A L 4 . 9 )
message ( STATUS "Found GNU g++ ${CMAKE_CXX_COMPILER_VERSION}, enabling colorized error messages." )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto" )
endif ( )
endif ( )
### DEPENDENCIES
#
find_package ( Qt5 ${ QT_VERSION } CONFIG REQUIRED Concurrent Core Gui LinguistTools Network Svg Widgets )
if ( WITH_QML )
find_package ( Qt5 ${ QT_VERSION } CONFIG REQUIRED Quick QuickWidgets )
endif ( )
# Optional Qt parts
find_package ( Qt5DBus CONFIG )
find_package ( YAMLCPP ${ YAMLCPP_VERSION } REQUIRED )
if ( INSTALL_POLKIT )
find_package ( PolkitQt5-1 REQUIRED )
else ( )
# Find it anyway, for dependencies-reporting
find_package ( PolkitQt5-1 )
endif ( )
set_package_properties (
P o l k i t Q t 5 - 1 P R O P E R T I E S
D E S C R I P T I O N " Q t 5 s u p p o r t f o r P o l k i t "
U R L " h t t p s : / / c g i t . k d e . o r g / p o l k i t - q t - 1 . g i t "
P U R P O S E " P o l k i t Q t 5 - 1 h e l p s w i t h i n s t a l l i n g P o l k i t c o n f i g u r a t i o n "
)
# 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.
find_package ( ECM ${ ECM_VERSION } NO_MODULE )
if ( ECM_FOUND )
set ( CMAKE_MODULE_PATH ${ ECM_MODULE_PATH } ${ CMAKE_MODULE_PATH } )
if ( BUILD_TESTING )
# ECM implies that we can build the tests, too
find_package ( Qt5 COMPONENTS Test REQUIRED )
include ( ECMAddTests )
endif ( )
include ( KDEInstallDirs )
endif ( )
find_package ( KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons )
set_package_properties (
K F 5 : : C o r e A d d o n s P R O P E R T I E S
T Y P E R E Q U I R E D
D E S C R I P T I O N " C l a s s e s b u i l t o n Q t C o r e f o r A b o u t D a t a "
U R L " h t t p s : / / a p i . k d e . o r g / f r a m e w o r k s / k c o r e a d d o n s / "
P U R P O S E " A b o u t C a l a m a r e s "
)
if ( NOT KF5Crash_FOUND )
if ( WITH_KF5Crash )
message ( WARNING "WITH_KF5Crash is set, but KF5::Crash is not available." )
endif ( )
set ( WITH_KF5Crash OFF )
endif ( )
if ( NOT KF5DBusAddons_FOUND )
if ( WITH_KF5DBus )
message ( WARNING "WITH_KF5DBus is set, but KF5::DBusAddons is not available." )
endif ( )
set ( WITH_KF5DBus OFF )
endif ( )
# TODO:3.3: Use FindPython3 instead
find_package ( PythonInterp ${ PYTHONLIBS_VERSION } )
set_package_properties (
P y t h o n I n t e r p P R O P E R T I E S
D E S C R I P T I O N " P y t h o n 3 i n t e r p r e t e r . "
U R L " h t t p s : / / p y t h o n . o r g "
P U R P O S E " P y t h o n 3 i n t e r p r e t e r f o r c e r t a i n t e s t s . "
)
set ( _schema_explanation "" )
if ( PYTHONINTERP_FOUND )
if ( BUILD_SCHEMA_TESTING )
# The configuration validator script has some dependencies,
# and if they are not installed, don't run. If errors out
# with exit(1) on missing dependencies.
if ( CALAMARES_CONFIGVALIDATOR_CHECKED )
set ( _validator_deps ${ CALAMARES_CONFIGVALIDATOR_RESULT } )
else ( )
exec_program ( ${ PYTHON_EXECUTABLE } ARGS "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" -x RETURN_VALUE _validator_deps )
set ( CALAMARES_CONFIGVALIDATOR_CHECKED TRUE CACHE INTERNAL "Dependencies for configvalidator checked" )
set ( CALAMARES_CONFIGVALIDATOR_RESULT ${ _validator_deps } CACHE INTERNAL "Result of configvalidator dependency check" )
endif ( )
# It should never succeed, but only returns 1 when the imports fail
if ( _validator_deps EQUAL 1 )
set ( _schema_explanation " Missing dependencies for configvalidator.py." )
set ( BUILD_SCHEMA_TESTING OFF )
endif ( )
endif ( )
else ( )
# Can't run schema tests without Python3.
set ( _schema_explanation " Missing Python3." )
set ( BUILD_SCHEMA_TESTING OFF )
endif ( )
add_feature_info ( yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}" )
find_package ( PythonLibs ${ PYTHONLIBS_VERSION } )
set_package_properties (
P y t h o n L i b s P R O P E R T I E S
D E S C R I P T I O N " C i n t e r f a c e l i b r a r i e s f o r t h e P y t h o n 3 i n t e r p r e t e r . "
U R L " h t t p s : / / p y t h o n . o r g "
P U R P O S E " P y t h o n 3 i s u s e d f o r P y t h o n j o b m o d u l e s . "
)
if ( PYTHONLIBS_FOUND )
# TODO:3.3: Require Boost + CMake; sort out Boost::Python
# Since Boost provides CMake config files (starting with Boost 1.70.
# or so) the mess that is the Calamares find code picks the wrong
# bits. Suppress those CMake config files, as suggested by @jmrcpn
set ( Boost_NO_BOOST_CMAKE ON )
include ( BoostPython3 )
find_boost_python3 ( ${ BOOSTPYTHON_VERSION } ${ PYTHONLIBS_VERSION_STRING } CALAMARES_BOOST_PYTHON3_FOUND )
set_package_properties (
B o o s t P R O P E R T I E S
P U R P O S E " B o o s t . P y t h o n i s u s e d f o r P y t h o n j o b m o d u l e s . "
)
# TODO:3.3: Remove PythonQt support
find_package ( PythonQt )
set_package_properties ( PythonQt PROPERTIES
D E S C R I P T I O N " A P y t h o n e m b e d d i n g s o l u t i o n f o r Q t a p p l i c a t i o n s . "
U R L " h t t p : / / p y t h o n q t . s o u r c e f o r g e . n e t "
P U R P O S E " P y t h o n Q t i s u s e d f o r P y t h o n v i e w m o d u l e s . "
)
endif ( )
if ( NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND )
message ( STATUS "Disabling Boost::Python modules" )
set ( WITH_PYTHON OFF )
endif ( )
if ( NOT PYTHONLIBS_FOUND OR NOT PYTHONQT_FOUND )
message ( STATUS "Disabling PythonQt modules" )
set ( WITH_PYTHONQT OFF )
endif ( )
# Now we know the state of the ABI-options, copy them into "Calamares_"
# prefixed variables, to match how the variables would-be-named
# when building out-of-tree.
set ( Calamares_WITH_PYTHON ${ WITH_PYTHON } )
set ( Calamares_WITH_PYTHONQT ${ WITH_PYTHONQT } )
set ( Calamares_WITH_QML ${ WITH_QML } )
### Transifex Translation status
#
# Construct language lists for use.
#
if ( Qt5_VERSION VERSION_GREATER 5.12.1 )
# At least Qt 5.12.2 seems to support Esperanto in QLocale
if ( "eo" IN_LIST _tx_incomplete )
message ( STATUS "Esperanto support since Qt 5.12.2, enabling Esperanto locale" )
list ( REMOVE_ITEM _tx_incomplete "eo" )
list ( APPEND _tx_ok "eo" )
endif ( )
endif ( )
set ( curr_tx ${ _tx_complete } ${ _tx_good } ${ _tx_ok } ${ _tx_incomplete } )
set ( tx_errors OFF )
if ( curr_tx )
# New in list
foreach ( l ${ curr_tx } )
set ( p_l "lang/calamares_${l}.ts" )
if ( NOT EXISTS ${ CMAKE_CURRENT_SOURCE_DIR } / ${ p_l } )
message ( WARNING "Language ${l} has no .ts file yet." )
set ( tx_errors ON )
endif ( )
endforeach ( )
unset ( p_l )
unset ( l )
endif ( )
unset ( curr_tx )
if ( tx_errors )
message ( FATAL_ERROR "Translation warnings, see above." )
endif ( )
set ( CALAMARES_TRANSLATION_LANGUAGES en ${ _tx_complete } ${ _tx_good } ${ _tx_ok } )
list ( SORT CALAMARES_TRANSLATION_LANGUAGES )
add_subdirectory ( lang ) # i18n tools
### Example Distro
#
# For testing purposes Calamares includes a very, very, limited sample
# distro called "Generic". The root filesystem of "Generic" lives in
# data/example-root and can be squashed up as part of the build, so
# that a pure-upstream run of ./calamares -d from the build directory
# (with all the default settings and configurations) can actually
# do an complete example run.
#
# Some binaries from the build host (e.g. /bin and /lib) are also
# squashed into the example filesystem.
#
# To build the example distro (for use by the default, example,
# unsquashfs module), build the target 'example-distro', eg.:
#
# make example-distro
#
find_program ( mksquashfs_PROGRAM mksquashfs )
if ( mksquashfs_PROGRAM )
set ( mksquashfs_FOUND ON )
set ( src_fs ${ CMAKE_SOURCE_DIR } /data/example-root/ )
set ( dst_fs ${ CMAKE_BINARY_DIR } /example.sqfs )
if ( EXISTS ${ src_fs } )
# based on the build host. If /lib64 exists, assume it is needed.
# Collect directories needed for a minimal binary distro,
# Note that the last path component is added to the root, so
# if you add /usr/sbin here, it will be put into /sbin_1.
# Add such paths to /etc/profile under ${src_fs}.
set ( candidate_fs /sbin /bin /lib /lib64 )
set ( host_fs "" )
foreach ( c_fs ${ candidate_fs } )
if ( EXISTS ${ c_fs } )
list ( APPEND host_fs ${ c_fs } )
endif ( )
endforeach ( )
add_custom_command (
O U T P U T $ { d s t _ f s }
C O M M A N D $ { m k s q u a s h f s _ P R O G R A M } $ { s r c _ f s } $ { d s t _ f s } - a l l - r o o t
C O M M A N D $ { m k s q u a s h f s _ P R O G R A M } $ { h o s t _ f s } $ { d s t _ f s } - a l l - r o o t
)
add_custom_target ( example-distro DEPENDS ${ dst_fs } )
endif ( )
else ( )
set ( mksquashfs_FOUND OFF )
endif ( )
# Doesn't list mksquashfs as an optional dep, though, because it
# hasn't been sent through the find_package() scheme.
#
# "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html"
add_feature_info ( ExampleDistro ${ mksquashfs_FOUND } "Create example-distro target." )
### CALAMARES PROPER
#
set ( CALAMARES_VERSION ${ CALAMARES_VERSION_MAJOR } . ${ CALAMARES_VERSION_MINOR } . ${ CALAMARES_VERSION_PATCH } )
# In rare cases we have hotfix-releases with a tweak
if ( CALAMARES_VERSION_TWEAK )
set ( CALAMARES_VERSION "${CALAMARES_VERSION}.${CALAMARES_VERSION_TWEAK}" )
endif ( )
set ( CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}" )
# Additional info for non-release builds. The "extended" version information
# with date and git information (commit, dirty status) is used only
# by CalamaresVersionX.h, which is included by consumers that need a full
# version number with all that information; normal consumers can include
# CalamaresVersion.h with more stable numbers.
if ( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" )
include ( ExtendedVersion )
extend_version ( "${CALAMARES_VERSION}" OFF CALAMARES_VERSION_SHORT CALAMARES_VERSION )
endif ( )
# Special target for not-RC (e.g. might-be-release) builds.
# This is used by the release script to get the version.
if ( CALAMARES_VERSION_RC EQUAL 0 )
add_custom_target ( show-version
$ { C M A K E _ C O M M A N D } - E e c h o C A L A M A R E S _ V E R S I O N = $ { C A L A M A R E S _ V E R S I O N _ S H O R T }
U S E S _ T E R M I N A L
)
endif ( )
# enforce using constBegin, constEnd for const-iterators
add_definitions (
- D Q T _ S T R I C T _ I T E R A T O R S
- D Q T _ S H A R E D
- D Q T _ S H A R E D P O I N T E R _ T R A C K _ P O I N T E R S
)
# set paths
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
set ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# Better default installation paths: GNUInstallDirs defines
# CMAKE_INSTALL_FULL_SYSCONFDIR to be CMAKE_INSTALL_PREFIX/etc by default
# but we really want /etc
if ( NOT DEFINED CMAKE_INSTALL_SYSCONFDIR )
set ( CMAKE_INSTALL_SYSCONFDIR "/etc" )
endif ( )
# make predefined install dirs available everywhere
include ( GNUInstallDirs )
# This is used by CalamaresAddLibrary; once Calamares is installed,
# the CalamaresConfig.cmake module sets this variable to the IMPORTED
# libraries for Calamares.
set ( Calamares_LIBRARIES calamares )
add_subdirectory ( src )
add_feature_info ( Python ${ WITH_PYTHON } "Python job modules" )
add_feature_info ( PythonQt ${ WITH_PYTHONQT } "Python view modules" )
add_feature_info ( Config ${ INSTALL_CONFIG } "Install Calamares configuration" )
add_feature_info ( KCrash ${ WITH_KF5Crash } "Crash dumps via KCrash" )
add_feature_info ( KDBusAddons ${ WITH_KF5DBus } "Unique-application via DBus" )
### CMake infrastructure installation
#
#
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}" )
export ( PACKAGE Calamares )
configure_package_config_file (
" C a l a m a r e s C o n f i g . c m a k e . i n "
" $ { P R O J E C T _ B I N A R Y _ D I R } / C a l a m a r e s C o n f i g . c m a k e "
I N S T A L L _ D E S T I N A T I O N " $ { C M A K E _ I N S T A L L _ C M A K E D I R } "
P A T H _ V A R S
C M A K E _ I N S T A L L _ I N C L U D E D I R
C M A K E _ I N S T A L L _ L I B D I R
C M A K E _ I N S T A L L _ D A T A D I R
)
write_basic_package_version_file (
$ { P R O J E C T _ B I N A R Y _ D I R } / C a l a m a r e s C o n f i g V e r s i o n . c m a k e
V E R S I O N $ { P R O J E C T _ V E R S I O N }
C O M P A T I B I L I T Y S a m e M a j o r V e r s i o n
)
install (
E X P O R T C a l a m a r e s
D E S T I N A T I O N " $ { C M A K E _ I N S T A L L _ C M A K E D I R } "
F I L E " C a l a m a r e s T a r g e t s . c m a k e "
N A M E S P A C E C a l a m a r e s : :
)
# Install the cmake files
install (
F I L E S
" $ { P R O J E C T _ B I N A R Y _ D I R } / C a l a m a r e s C o n f i g . c m a k e "
" $ { P R O J E C T _ B I N A R Y _ D I R } / C a l a m a r e s C o n f i g V e r s i o n . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s A d d B r a n d i n g S u b d i r e c t o r y . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s A d d L i b r a r y . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s A d d M o d u l e S u b d i r e c t o r y . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s A d d P l u g i n . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s A d d T e s t . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s A d d T r a n s l a t i o n s . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s A u t o m o c . c m a k e "
" C M a k e M o d u l e s / C a l a m a r e s C h e c k M o d u l e S e l e c t i o n . c m a k e "
" C M a k e M o d u l e s / C M a k e C o l o r s . c m a k e "
" C M a k e M o d u l e s / F i n d Y A M L C P P . c m a k e "
D E S T I N A T I O N
" $ { C M A K E _ I N S T A L L _ C M A K E D I R } "
)
### Miscellaneous installs
#
#
if ( INSTALL_CONFIG )
install (
F I L E S s e t t i n g s . c o n f
D E S T I N A T I O N s h a r e / c a l a m a r e s
)
endif ( )
if ( INSTALL_POLKIT )
install (
F I L E S c o m . g i t h u b . c a l a m a r e s . c a l a m a r e s . p o l i c y
D E S T I N A T I O N " $ { P O L K I T Q T - 1 _ P O L I C Y _ F I L E S _ I N S T A L L _ D I R } "
)
endif ( )
if ( INSTALL_COMPLETION )
if ( NOT CMAKE_INSTALL_BASHCOMPLETIONDIR )
set ( CMAKE_INSTALL_BASHCOMPLETIONDIR "${CMAKE_INSTALL_DATADIR}/bash-completion/completions" )
endif ( )
install ( FILES ${ CMAKE_SOURCE_DIR } /data/completion/bash/calamares DESTINATION "${CMAKE_INSTALL_BASHCOMPLETIONDIR}" )
endif ( )
install (
F I L E S c a l a m a r e s . d e s k t o p
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ D A T A D I R } / a p p l i c a t i o n s
)
install (
F I L E S m a n / c a l a m a r e s . 8
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ M A N D I R } / m a n 8 /
)
# uninstall target
configure_file (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y
)
add_custom_target ( uninstall
C O M M A N D $ { C M A K E _ C O M M A N D } - P $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e
)
### CMAKE SUMMARY REPORT
#
get_directory_property ( SKIPPED_MODULES
D I R E C T O R Y s r c / m o d u l e s
D E F I N I T I O N L I S T _ S K I P P E D _ M O D U L E S
)
calamares_explain_skipped_modules ( ${ SKIPPED_MODULES } )
feature_summary (
W H A T D I S A B L E D _ F E A T U R E S
D E S C R I P T I O N " T h e f o l l o w i n g f e a t u r e s h a v e b e e n d i s a b l e d : "
Q U I E T _ O N _ E M P T Y
)
feature_summary (
W H A T O P T I O N A L _ P A C K A G E S _ N O T _ F O U N D
D E S C R I P T I O N " T h e f o l l o w i n g O P T I O N A L p a c k a g e s w e r e n o t f o u n d : "
Q U I E T _ O N _ E M P T Y
)
feature_summary (
W H A T R E Q U I R E D _ P A C K A G E S _ N O T _ F O U N D
F A T A L _ O N _ M I S S I N G _ R E Q U I R E D _ P A C K A G E S
D E S C R I P T I O N " T h e f o l l o w i n g R E Q U I R E D p a c k a g e s w e r e n o t f o u n d : "
Q U I E T _ O N _ E M P T Y
)
### PACKAGING
#
# Note: most distro's will do distro-specific packaging rather than
# using CPack, and this duplicates information in the AppStream, too.
# TODO:3.3 With newer CMake, move HOMEPAGE_URL to the project()call
set ( CPACK_PACKAGE_VENDOR calamares )
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Linux system installer" )
set ( CPACK_PACKAGE_DESCRIPTION "Calamares is a Linux system installer, intended for Linux distributions to use on their ISOs and other bootable media to install the distribution to the end-user's computer. Calamares can also be used as an OEM configuration tool. It is modular, extensible and highly-configurable for Linux distributions from all five major Linux families." )
set ( CPACK_PACKAGE_HOMEPAGE_URL "https://calamares.io" )
set ( CPACK_PACKAGE_ICON "data/images/squid.png" )
include ( CPack )