diff --git a/CMakeLists.txt b/CMakeLists.txt index dde16b77d..6a67c4fcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,43 +41,39 @@ # One special target is "show-version", which can be built # to obtain the version number from here. -cmake_minimum_required( VERSION 3.16 FATAL_ERROR ) +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -set( CALAMARES_VERSION 3.3.0 ) -set( CALAMARES_RELEASE_MODE OFF ) # Set to ON during a release +set(CALAMARES_VERSION 3.3.0) +set(CALAMARES_RELEASE_MODE OFF) # Set to ON during a release -if ( CMAKE_SCRIPT_MODE_FILE ) - include( ${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake ) - set( CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} ) +if(CMAKE_SCRIPT_MODE_FILE) + include(${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake) + set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) extend_version( ${CALAMARES_VERSION} OFF _vshort _vlong ) - message( "${_vlong}" ) + message("${_vlong}") return() endif() -project( CALAMARES - VERSION ${CALAMARES_VERSION} - LANGUAGES C CXX -) +project(CALAMARES VERSION ${CALAMARES_VERSION} LANGUAGES C CXX) -if( CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) - message( FATAL_ERROR "Do not build development versions in the source-directory." ) +if(CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + message(FATAL_ERROR "Do not build development versions in the source-directory.") endif() ### OPTIONS # -option( INSTALL_CONFIG "Install configuration files" OFF ) -option( INSTALL_POLKIT "Install Polkit configuration" ON ) -option( INSTALL_COMPLETION "Install shell completions" OFF ) +option(INSTALL_CONFIG "Install configuration files" OFF) +option(INSTALL_POLKIT "Install Polkit configuration" ON) +option(INSTALL_COMPLETION "Install shell completions" OFF) # 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_QML "Enable QML UI options." ON ) +option(WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON) +option(WITH_QML "Enable QML UI options." ON) # # Additional parts to build that do not affect ABI -option( BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON ) +option(BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON) # Options for the calamares executable -option( BUILD_KF5Crash "Enable crash reporting with KCrash." ON ) - +option(BUILD_KF5Crash "Enable crash reporting with KCrash." ON) # Possible debugging flags are: # - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone @@ -88,7 +84,6 @@ option( BUILD_KF5Crash "Enable crash reporting with KCrash." ON ) # - 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 @@ -112,15 +107,14 @@ option( BUILD_KF5Crash "Enable crash reporting with KCrash." ON ) # - *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" ) +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 - "The distribution-independent installer framework" ) +set(CALAMARES_ORGANIZATION_NAME "Calamares") +set(CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares") +set(CALAMARES_APPLICATION_NAME "Calamares") +set(CALAMARES_DESCRIPTION_SUMMARY "The distribution-independent installer framework") ### Transifex (languages) info # @@ -147,40 +141,114 @@ set( CALAMARES_DESCRIPTION_SUMMARY # `txstats.py -e`. See also # # Total 74 languages -set( _tx_complete az az_AZ ca de fa fi_FI he hi hr ja ko lt pt_BR - pt_PT si sq sv tr_TR uk zh_TW ) -set( _tx_good as be ca@valencia cs_CZ da fr fur it_IT ml nl ru sk - tg vi zh_CN ) -set( _tx_ok ar ast bg bn el en_GB es es_MX et eu gl hu id is mr nb - pl ro sl sr sr@latin th ) -set( _tx_incomplete eo es_PR gu ie kk kn lo lv mk ne ne_NP ta_IN te - ur zh zh_HK ) +set(_tx_complete + az + az_AZ + ca + de + fa + fi_FI + he + hi + hr + ja + ko + lt + pt_BR + pt_PT + si + sq + sv + tr_TR + uk + zh_TW +) +set(_tx_good + as + be + ca@valencia + cs_CZ + da + fr + fur + it_IT + ml + nl + ru + sk + tg + vi + zh_CN +) +set(_tx_ok + ar + ast + bg + bn + el + en_GB + es + es_MX + et + eu + gl + hu + id + is + mr + nb + pl + ro + sl + sr + sr@latin + th +) +set(_tx_incomplete + eo + es_PR + gu + ie + kk + kn + lo + lv + mk + ne + ne_NP + ta_IN + te + ur + zh + zh_HK +) ### Required versions # # See DEPENDENCIES section below. -set( QT_VERSION 5.15.0 ) -set( YAMLCPP_VERSION 0.5.1 ) -set( ECM_VERSION 5.18 ) -set( PYTHONLIBS_VERSION 3.6 ) -set( BOOSTPYTHON_VERSION 1.67.0 ) - +set(QT_VERSION 5.15.0) +set(YAMLCPP_VERSION 0.5.1) +set(ECM_VERSION 5.18) +set(PYTHONLIBS_VERSION 3.6) +set(BOOSTPYTHON_VERSION 1.67.0) ### CMAKE SETUP # -set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" ) +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules") # Enable IN_LIST -if( POLICY CMP0057 ) - cmake_policy( SET CMP0057 NEW ) +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) endif() # Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files. -if( POLICY CMP0071 ) - cmake_policy( SET CMP0071 NEW ) +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 + list( + APPEND + CMAKE_AUTOMOC_MACRO_NAMES "K_PLUGIN_FACTORY_WITH_JSON" "K_EXPORT_PLASMA_DATAENGINE_WITH_JSON" "K_EXPORT_PLASMA_RUNNER" @@ -188,49 +256,50 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") endif() # CMake Modules -include( CMakePackageConfigHelpers ) -include( CTest ) -include( FeatureSummary ) +include(CMakePackageConfigHelpers) +include(CTest) +include(FeatureSummary) # Calamares Modules -include( CMakeColors ) +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_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_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" ) +set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--fatal-warnings") # If no build type is set, pick a reasonable one -if( NOT CMAKE_BUILD_TYPE ) - if ( CALAMARES_RELEASE_MODE ) - set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) +if(NOT CMAKE_BUILD_TYPE) + if(CALAMARES_RELEASE_MODE) + set(CMAKE_BUILD_TYPE "RelWithDebInfo") else() - set( CMAKE_BUILD_TYPE "Debug" ) + set(CMAKE_BUILD_TYPE "Debug") endif() endif() -if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) - message( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." ) +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 + foreach( + CLANG_WARNINGS -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic @@ -242,70 +311,69 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) -Wno-documentation-unknown-command -Wno-unknown-warning-option ) - string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" ) + 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" ) + 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( [...] ) # to switch off warnings for those sources. - set( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" ) + set(SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything") - set( CMAKE_TOOLCHAIN_PREFIX "llvm-" ) + 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 ) + 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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual") - set( SUPPRESS_3RDPARTY_WARNINGS "" ) + 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} - PROPERTIES - COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" - COMPILE_DEFINITIONS "THIRDPARTY" + set_source_files_properties( + ${ARGV} + PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" COMPILE_DEFINITIONS "THIRDPARTY" ) endmacro() -if( CMAKE_COMPILER_IS_GNUCXX ) - if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR - CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 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" ) +if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 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() # API that was deprecated before Qt 5.15 causes a compile error -add_compile_definitions( QT_DISABLE_DEPRECATED_BEFORE=0x050f00 ) +add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00) ### 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 ) +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(Qt5DBus CONFIG) -find_package( YAMLCPP ${YAMLCPP_VERSION} REQUIRED ) -if( INSTALL_POLKIT ) - find_package( PolkitQt5-1 REQUIRED ) +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 ) + find_package(PolkitQt5-1) endif() set_package_properties( - PolkitQt5-1 PROPERTIES + PolkitQt5-1 + PROPERTIES DESCRIPTION "Qt5 support for Polkit" URL "https://cgit.kde.org/polkit-qt-1.git" PURPOSE "PolkitQt5-1 helps with installing Polkit configuration" @@ -316,98 +384,108 @@ set_package_properties( # 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 ) +if(ECM_FOUND) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) - if ( BUILD_TESTING ) + if(BUILD_TESTING) # ECM implies that we can build the tests, too - find_package( Qt5 COMPONENTS Test REQUIRED ) - include( ECMAddTests ) + find_package(Qt5 COMPONENTS Test REQUIRED) + include(ECMAddTests) endif() include(KDEInstallDirs) endif() -find_package( KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons ) +find_package(KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons) set_package_properties( - KF5::CoreAddons PROPERTIES + KF5::CoreAddons + PROPERTIES TYPE REQUIRED DESCRIPTION "Classes built on QtCore for About Data" URL "https://api.kde.org/frameworks/kcoreaddons/" PURPOSE "About Calamares" ) set_package_properties( - KF5::DBusAddons PROPERTIES + KF5::DBusAddons + PROPERTIES TYPE REQUIRED DESCRIPTION "Classes for DBus activation" URL "https://api.kde.org/frameworks/dbusaddons/" PURPOSE "Unique instance of Calamares" ) -if( NOT KF5Crash_FOUND ) - if( BUILD_KF5Crash ) +if(NOT KF5Crash_FOUND) + if(BUILD_KF5Crash) message(WARNING "BUILD_KF5Crash is set, but KF5::Crash is not available.") endif() - set( BUILD_KF5Crash OFF ) + set(BUILD_KF5Crash OFF) endif() # TODO:3.3: Use FindPython3 instead -find_package( PythonInterp ${PYTHONLIBS_VERSION} ) +find_package(PythonInterp ${PYTHONLIBS_VERSION}) set_package_properties( - PythonInterp PROPERTIES + PythonInterp + PROPERTIES DESCRIPTION "Python 3 interpreter." URL "https://python.org" PURPOSE "Python 3 interpreter for certain tests." ) -set( _schema_explanation "" ) -if ( PYTHONINTERP_FOUND ) - if ( BUILD_SCHEMA_TESTING ) +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} ) + 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" ) + 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 ) + 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 ) + 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}" ) +add_feature_info(yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}") -find_package( PythonLibs ${PYTHONLIBS_VERSION} ) +find_package(PythonLibs ${PYTHONLIBS_VERSION}) set_package_properties( - PythonLibs PROPERTIES + PythonLibs + PROPERTIES DESCRIPTION "C interface libraries for the Python 3 interpreter." URL "https://python.org" PURPOSE "Python 3 is used for Python job modules." ) -if ( PYTHONLIBS_FOUND ) +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 ) + include(BoostPython3) find_boost_python3( ${BOOSTPYTHON_VERSION} ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND ) - set_package_properties( - Boost PROPERTIES - PURPOSE "Boost.Python is used for Python job modules." - ) + set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") endif() -if( NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND ) +if(NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND) message(STATUS "Disabling Boost::Python modules") - set( WITH_PYTHON OFF ) + set(WITH_PYTHON OFF) endif() # Now we know the state of the ABI-options, copy them into "Calamares_" @@ -423,39 +501,39 @@ set(Calamares_WITH_QML ${WITH_QML}) # for some obvious error. The actual work of compiling translations # is done in the lang/ directory. # -if( Qt5_VERSION VERSION_GREATER 5.12.1 ) +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 ) + 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" ) + 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 ) +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} ) + 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 ) + set(tx_errors ON) endif() endforeach() - unset( p_l ) - unset( l ) + unset(p_l) + unset(l) endif() -unset( curr_tx ) -if( tx_errors ) - message( FATAL_ERROR "Translation warnings, see above." ) +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 ) +set(CALAMARES_TRANSLATION_LANGUAGES en ${_tx_complete} ${_tx_good} ${_tx_ok}) +list(SORT CALAMARES_TRANSLATION_LANGUAGES) -add_subdirectory( lang ) # i18n tools +add_subdirectory(lang) # i18n tools ### Example Distro # @@ -474,22 +552,22 @@ add_subdirectory( lang ) # i18n tools # # 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} ) +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} ) + 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( @@ -500,71 +578,63 @@ if( mksquashfs_PROGRAM ) add_custom_target(example-distro DEPENDS ${dst_fs}) endif() else() - set( mksquashfs_FOUND OFF ) + 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.") - +add_feature_info(ExampleDistro ${mksquashfs_FOUND} "Create example-distro target.") ### CALAMARES PROPER # -set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} ) +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}" ) +if(CALAMARES_VERSION_TWEAK) + set(CALAMARES_VERSION "${CALAMARES_VERSION}.${CALAMARES_VERSION_TWEAK}") endif() -set( CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}" ) +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 ) +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 - ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT} - USES_TERMINAL - ) +if(CALAMARES_VERSION_RC EQUAL 0) + add_custom_target(show-version ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT} USES_TERMINAL) endif() # enforce using constBegin, constEnd for const-iterators -add_definitions( - -DQT_STRICT_ITERATORS - -DQT_SHARED - -DQT_SHAREDPOINTER_TRACK_POINTERS -) +add_definitions(-DQT_STRICT_ITERATORS -DQT_SHARED -DQT_SHAREDPOINTER_TRACK_POINTERS) # 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}" ) +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" ) +if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR) + set(CMAKE_INSTALL_SYSCONFDIR "/etc") endif() # make predefined install dirs available everywhere -include( GNUInstallDirs ) +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 ) +set(Calamares_LIBRARIES calamares) -add_subdirectory( src ) +add_subdirectory(src) add_feature_info(Python ${WITH_PYTHON} "Python job modules") add_feature_info(Qml ${WITH_QML} "QML UI support") @@ -575,30 +645,22 @@ add_feature_info(KCrash ${BUILD_KF5Crash} "Crash dumps via KCrash") ### 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}" ) +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 ) +export(PACKAGE Calamares) configure_package_config_file( "CalamaresConfig.cmake.in" "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - PATH_VARS - CMAKE_INSTALL_INCLUDEDIR - CMAKE_INSTALL_LIBDIR - CMAKE_INSTALL_DATADIR + PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_DATADIR ) 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(EXPORT Calamares DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" FILE "CalamaresTargets.cmake" NAMESPACE Calamares::) # Install the cmake files install( @@ -615,69 +677,48 @@ install( "CMakeModules/CalamaresCheckModuleSelection.cmake" "CMakeModules/CMakeColors.cmake" "CMakeModules/FindYAMLCPP.cmake" - DESTINATION - "${CMAKE_INSTALL_CMAKEDIR}" + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" ) ### Miscellaneous installs # # -if( INSTALL_CONFIG ) - install( - FILES settings.conf - DESTINATION share/calamares - ) +if(INSTALL_CONFIG) + install(FILES settings.conf DESTINATION share/calamares) endif() -if( INSTALL_POLKIT ) - install( - FILES com.github.calamares.calamares.policy - DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}" - ) +if(INSTALL_POLKIT) + install(FILES com.github.calamares.calamares.policy DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}") endif() -if ( INSTALL_COMPLETION ) - if( NOT CMAKE_INSTALL_BASHCOMPLETIONDIR ) - set( CMAKE_INSTALL_BASHCOMPLETIONDIR "${CMAKE_INSTALL_DATADIR}/bash-completion/completions" ) +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}" ) + install(FILES ${CMAKE_SOURCE_DIR}/data/completion/bash/calamares DESTINATION "${CMAKE_INSTALL_BASHCOMPLETIONDIR}") endif() -install( - FILES calamares.desktop - DESTINATION ${CMAKE_INSTALL_DATADIR}/applications -) +install(FILES calamares.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) -install( - FILES man/calamares.8 - DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/ -) +install(FILES man/calamares.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/) # uninstall target configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY + IMMEDIATE + @ONLY ) -add_custom_target( uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake -) +add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ### CMAKE SUMMARY REPORT # -get_directory_property( SKIPPED_MODULES - DIRECTORY src/modules - DEFINITION LIST_SKIPPED_MODULES -) +get_directory_property(SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES) calamares_explain_skipped_modules( ${SKIPPED_MODULES} ) -feature_summary( - WHAT DISABLED_FEATURES - DESCRIPTION "The following features have been disabled:" - QUIET_ON_EMPTY -) +feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:" QUIET_ON_EMPTY) feature_summary( WHAT OPTIONAL_PACKAGES_NOT_FOUND DESCRIPTION "The following OPTIONAL packages were not found:" @@ -697,7 +738,9 @@ feature_summary( # 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_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") diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt index 72aae9588..7494692c6 100644 --- a/lang/CMakeLists.txt +++ b/lang/CMakeLists.txt @@ -13,15 +13,15 @@ # - defines an OBJECT LIBRARY calamares-i18n for linking the compiled # translations into an executable. -include( CalamaresAddTranslations ) +include(CalamaresAddTranslations) find_package(Qt5 COMPONENTS Xml) -if( Qt5Xml_FOUND ) +if(Qt5Xml_FOUND) add_executable(txload txload.cpp) target_link_libraries(txload Qt5::Xml) endif() -install_calamares_gettext_translations( python +install_calamares_gettext_translations(python SOURCE_DIR ${CMAKE_SOURCE_DIR}/lang/python FILENAME python.mo RENAME calamares-python.mo @@ -30,25 +30,25 @@ install_calamares_gettext_translations( python ### TRANSLATIONS # # -set( TS_FILES "" ) -set( calamares_i18n_qrc_content "" ) +set(TS_FILES "") +set(calamares_i18n_qrc_content "") # calamares and qt language files -foreach( lang ${CALAMARES_TRANSLATION_LANGUAGES} ) - foreach( tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}" ) - if( EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts" ) - string( APPEND calamares_i18n_qrc_content "${tlsource}.qm\n" ) - list( APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts" ) +foreach(lang ${CALAMARES_TRANSLATION_LANGUAGES}) + foreach(tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}") + if(EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts") + string(APPEND calamares_i18n_qrc_content "${tlsource}.qm\n") + list(APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts") endif() endforeach() endforeach() -set( trans_file calamares_i18n ) -set( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc ) -set( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx ) -set( CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile} ) +set(trans_file calamares_i18n) +set(trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc) +set(trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx) +set(CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile}) -configure_file( ${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY ) +configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY) qt5_add_translation(QM_FILES ${TS_FILES}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5ce5349fb..b1a536f91 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,26 +3,26 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -include( CalamaresAddBrandingSubdirectory ) -include( CalamaresAddLibrary ) -include( CalamaresAddModuleSubdirectory ) -include( CalamaresAddPlugin ) -include( CalamaresAddTest ) -include( CalamaresAddTranslations ) +include(CalamaresAddBrandingSubdirectory) +include(CalamaresAddLibrary) +include(CalamaresAddModuleSubdirectory) +include(CalamaresAddPlugin) +include(CalamaresAddTest) +include(CalamaresAddTranslations) # library -add_subdirectory( libcalamares ) +add_subdirectory(libcalamares) -add_subdirectory( libcalamaresui ) +add_subdirectory(libcalamaresui) # all things qml -add_subdirectory( qml/calamares ) +add_subdirectory(qml/calamares) # application -add_subdirectory( calamares ) +add_subdirectory(calamares) # plugins -add_subdirectory( modules ) +add_subdirectory(modules) # branding components -add_subdirectory( branding ) +add_subdirectory(branding) diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index cf9fdd8a7..b132f186a 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -4,14 +4,12 @@ # SPDX-License-Identifier: BSD-2-Clause # -set( calamaresSources +set(calamaresSources main.cpp CalamaresApplication.cpp CalamaresWindow.cpp - DebugWindow.cpp VariantModel.cpp - progresstree/ProgressTreeDelegate.cpp progresstree/ProgressTreeView.cpp ) @@ -31,42 +29,30 @@ include_directories( # The calamares-i18n.cxx file -- full path in CALAMARES_TRANSLATIONS_SOURCE -- # is created as a target in the lang/ directory. This is compiled to a # library (it's just the result of a QRC compile). -add_executable( calamares_bin ${calamaresSources} calamares.qrc ) -target_include_directories( calamares_bin PRIVATE ${CMAKE_SOURCE_DIR} ) -set_target_properties(calamares_bin - PROPERTIES - ENABLE_EXPORTS TRUE - RUNTIME_OUTPUT_NAME calamares -) +add_executable(calamares_bin ${calamaresSources} calamares.qrc) +target_include_directories(calamares_bin PRIVATE ${CMAKE_SOURCE_DIR}) +set_target_properties(calamares_bin PROPERTIES ENABLE_EXPORTS TRUE RUNTIME_OUTPUT_NAME calamares) calamares_automoc( calamares_bin ) calamares_autouic( calamares_bin ) calamares_autorcc( calamares_bin ) -if( kdsagSources ) - set_source_files_properties( ${kdsagSources} PROPERTIES AUTOMOC OFF ) +if(kdsagSources) + set_source_files_properties(${kdsagSources} PROPERTIES AUTOMOC OFF) endif() -target_link_libraries( calamares_bin - PRIVATE - calamares - calamaresui - calamares-i18n - Qt5::Core - Qt5::Widgets - KF5::CoreAddons - KF5::DBusAddons +target_link_libraries( + calamares_bin + PRIVATE calamares calamaresui calamares-i18n Qt5::Core Qt5::Widgets KF5::CoreAddons KF5::DBusAddons ) -if( BUILD_KF5Crash ) - target_link_libraries( calamares_bin PRIVATE KF5::Crash ) - target_compile_definitions( calamares_bin PRIVATE BUILD_KF5Crash ) +if(BUILD_KF5Crash) + target_link_libraries(calamares_bin PRIVATE KF5::Crash) + target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash) endif() -install( TARGETS calamares_bin - BUNDLE DESTINATION . - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) +install(TARGETS calamares_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install( FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg +install( + FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg RENAME calamares.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps ) @@ -74,11 +60,11 @@ install( FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg ### TESTS # # -if( BUILD_TESTING ) +if(BUILD_TESTING) # Don't install, these are just for enable_testing - add_executable( loadmodule testmain.cpp ) - target_link_libraries( loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui ) + add_executable(loadmodule testmain.cpp) + target_link_libraries(loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui) - add_executable( test_conf test_conf.cpp ) - target_link_libraries( test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core ) + add_executable(test_conf test_conf.cpp) + target_link_libraries(test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core) endif() diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index dfb99a068..07f415f75 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -8,7 +8,7 @@ # individual modules can also decide they must be skipped (e.g. OS-specific # modules, or ones with unmet dependencies). Collect the skipped modules # in this list. -set( LIST_SKIPPED_MODULES "" ) +set(LIST_SKIPPED_MODULES "") include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamares @@ -16,46 +16,47 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamaresui ) -string( REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}" ) +string(REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}") -file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" ) -list( SORT SUBDIRECTORIES ) +file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*") +list(SORT SUBDIRECTORIES) -foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) +foreach(SUBDIRECTORY ${SUBDIRECTORIES}) calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES ) endforeach() # TODO:3.3: Use FindPython3 -if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE ) +if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE) # The tests for each config file are independent of whether the # module is enabled or not: the config file should match its schema # regardless. - foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) - set( _schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.schema.yaml" ) + foreach(SUBDIRECTORY ${SUBDIRECTORIES}) + set(_schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.schema.yaml") # Collect config files from the module-directory and from a tests/ subdir, # using the same mechanism to find those test-config-files as function # calamares_add_module_subdirectory() would do. - set( _conf_files "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf" ) - set( _count 1 ) - set( _testdir "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/tests" ) - while ( EXISTS "${_testdir}/${_count}.global" OR EXISTS "${_testdir}/${_count}.job" ) - if ( EXISTS "${_testdir}/${_count}.job" ) - list( APPEND _conf_files "${_testdir}/${_count}.job" ) + set(_conf_files "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf") + set(_count 1) + set(_testdir "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/tests") + while(EXISTS "${_testdir}/${_count}.global" OR EXISTS "${_testdir}/${_count}.job") + if(EXISTS "${_testdir}/${_count}.job") + list(APPEND _conf_files "${_testdir}/${_count}.job") endif() - math( EXPR _count "${_count} + 1" ) + math(EXPR _count "${_count} + 1") endwhile() - if ( EXISTS "${_schema_file}" ) - foreach( _conf_file ${_conf_files} ) - if ( EXISTS ${_conf_file} ) - get_filename_component( _conf_base "${_conf_file}" NAME_WE ) + if(EXISTS "${_schema_file}") + foreach(_conf_file ${_conf_files}) + if(EXISTS ${_conf_file}) + get_filename_component(_conf_base "${_conf_file}" NAME_WE) add_test( NAME validate-${SUBDIRECTORY}-${_conf_base} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + COMMAND + ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" + "${_conf_file}" ) endif() endforeach() endif() endforeach() endif() - diff --git a/src/modules/contextualprocess/CMakeLists.txt b/src/modules/contextualprocess/CMakeLists.txt index d7716bbfb..9520515ce 100644 --- a/src/modules/contextualprocess/CMakeLists.txt +++ b/src/modules/contextualprocess/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( contextualprocess +calamares_add_plugin(contextualprocess TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -15,7 +15,6 @@ calamares_add_test( contextualprocesstest SOURCES Tests.cpp - ContextualProcessJob.cpp # Builds it a second time - LIBRARIES - yamlcpp::yamlcpp + ContextualProcessJob.cpp # Builds it a second time + LIBRARIES yamlcpp::yamlcpp ) diff --git a/src/modules/dracutlukscfg/CMakeLists.txt b/src/modules/dracutlukscfg/CMakeLists.txt index aaa7a8c17..85efccc0c 100644 --- a/src/modules/dracutlukscfg/CMakeLists.txt +++ b/src/modules/dracutlukscfg/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( dracutlukscfg +calamares_add_plugin(dracutlukscfg TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/dummycpp/CMakeLists.txt b/src/modules/dummycpp/CMakeLists.txt index 2916b4d67..b822a03be 100644 --- a/src/modules/dummycpp/CMakeLists.txt +++ b/src/modules/dummycpp/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( dummycpp +calamares_add_plugin(dummycpp TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/finished/CMakeLists.txt b/src/modules/finished/CMakeLists.txt index 619f6d8b0..ab435a9eb 100644 --- a/src/modules/finished/CMakeLists.txt +++ b/src/modules/finished/CMakeLists.txt @@ -3,11 +3,11 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -calamares_add_plugin( finished +calamares_add_plugin(finished TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/finishedq/CMakeLists.txt b/src/modules/finishedq/CMakeLists.txt index facc2d691..2e688c45d 100644 --- a/src/modules/finishedq/CMakeLists.txt +++ b/src/modules/finishedq/CMakeLists.txt @@ -3,21 +3,21 @@ # SPDX-FileCopyrightText: 2021 Anke Boersma # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "finishedq (QML is not supported in this build)" ) return() endif() -find_package( Qt5 ${QT_VERSION} CONFIG COMPONENTS DBus Network ) -if ( NOT TARGET Qt5::DBus OR NOT TARGET Qt5::Network ) +find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS DBus Network) +if(NOT TARGET Qt5::DBus OR NOT TARGET Qt5::Network) calamares_skip_module( "finishedq (missing DBus or Network)" ) return() endif() -set( _finished ${CMAKE_CURRENT_SOURCE_DIR}/../finished ) -include_directories( ${_finished} ) +set(_finished ${CMAKE_CURRENT_SOURCE_DIR}/../finished) +include_directories(${_finished}) -calamares_add_plugin( finishedq +calamares_add_plugin(finishedq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/fsresizer/CMakeLists.txt b/src/modules/fsresizer/CMakeLists.txt index e721d7f6b..189e7c1dc 100644 --- a/src/modules/fsresizer/CMakeLists.txt +++ b/src/modules/fsresizer/CMakeLists.txt @@ -3,18 +3,18 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( KF5Config CONFIG ) -find_package( KF5I18n CONFIG ) -find_package( KF5WidgetsAddons CONFIG ) +find_package(KF5Config CONFIG) +find_package(KF5I18n CONFIG) +find_package(KF5WidgetsAddons CONFIG) -include( KPMcoreHelper ) +include(KPMcoreHelper) -if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND ) - include_directories( ${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition ) +if(KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND) + include_directories(${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition) # The PartitionIterator is a small class, and it's easiest -- but also a # gross hack -- to just compile it again from the partition module tree. - calamares_add_plugin( fsresizer + calamares_add_plugin(fsresizer TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -27,15 +27,14 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND calamares_add_test( fsresizertest - SOURCES - Tests.cpp + SOURCES Tests.cpp LIBRARIES - calamares_job_fsresizer # From above + calamares_job_fsresizer # From above yamlcpp::yamlcpp DEFINITIONS ${KPMcore_API_DEFINITIONS} ) else() - if ( NOT KPMcore_FOUND ) + if(NOT KPMcore_FOUND) calamares_skip_module( "fsresizer (missing suitable KPMcore)" ) else() calamares_skip_module( "fsresizer (missing dependencies for KPMcore)" ) diff --git a/src/modules/grubcfg/tests/CMakeTests.txt b/src/modules/grubcfg/tests/CMakeTests.txt index 54a0721e4..7ecfffceb 100644 --- a/src/modules/grubcfg/tests/CMakeTests.txt +++ b/src/modules/grubcfg/tests/CMakeTests.txt @@ -8,12 +8,10 @@ add_test( NAME make-grubcfg-dirs - COMMAND ${CMAKE_COMMAND} -E make_directory - /tmp/calamares/grubcfg-test-2/etc/default - /tmp/calamares/grubcfg-test-3/etc/default - /tmp/calamares/grubcfg-test-4/etc/default/grub.d - ) + COMMAND + ${CMAKE_COMMAND} -E make_directory /tmp/calamares/grubcfg-test-2/etc/default + /tmp/calamares/grubcfg-test-3/etc/default /tmp/calamares/grubcfg-test-4/etc/default/grub.d +) set_tests_properties(load-grubcfg-2 PROPERTIES DEPENDS make-grubcfg-dirs) set_tests_properties(load-grubcfg-3 PROPERTIES DEPENDS make-grubcfg-dirs) set_tests_properties(load-grubcfg-4 PROPERTIES DEPENDS make-grubcfg-dirs) - diff --git a/src/modules/initcpio/CMakeLists.txt b/src/modules/initcpio/CMakeLists.txt index 48fd09371..1bbb9fdd9 100644 --- a/src/modules/initcpio/CMakeLists.txt +++ b/src/modules/initcpio/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( initcpio +calamares_add_plugin(initcpio TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -13,8 +13,7 @@ calamares_add_plugin( initcpio calamares_add_test( initcpiotest - SOURCES - Tests.cpp + SOURCES Tests.cpp LIBRARIES calamares_job_initcpio # From above yamlcpp::yamlcpp diff --git a/src/modules/initramfs/CMakeLists.txt b/src/modules/initramfs/CMakeLists.txt index 2dec41cba..45f29c387 100644 --- a/src/modules/initramfs/CMakeLists.txt +++ b/src/modules/initramfs/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( initramfs +calamares_add_plugin(initramfs TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -13,8 +13,7 @@ calamares_add_plugin( initramfs calamares_add_test( initramfstest - SOURCES - Tests.cpp + SOURCES Tests.cpp LIBRARIES calamares_job_initramfs # From above yamlcpp::yamlcpp diff --git a/src/modules/interactiveterminal/CMakeLists.txt b/src/modules/interactiveterminal/CMakeLists.txt index 20aee8257..8ade23dbd 100644 --- a/src/modules/interactiveterminal/CMakeLists.txt +++ b/src/modules/interactiveterminal/CMakeLists.txt @@ -5,21 +5,15 @@ # find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) -set( kf5_ver 5.41 ) +set(kf5_ver 5.41) -find_package( KF5Service ${kf5_ver} ) -find_package( KF5Parts ${kf5_ver} ) -set_package_properties( - KF5Service PROPERTIES - PURPOSE "For finding KDE services at runtime" -) -set_package_properties( - KF5Parts PROPERTIES - PURPOSE "For finding KDE parts at runtime" -) +find_package(KF5Service ${kf5_ver}) +find_package(KF5Parts ${kf5_ver}) +set_package_properties(KF5Service PROPERTIES PURPOSE "For finding KDE services at runtime") +set_package_properties(KF5Parts PROPERTIES PURPOSE "For finding KDE parts at runtime") -if ( KF5Parts_FOUND AND KF5Service_FOUND ) - calamares_add_plugin( interactiveterminal +if(KF5Parts_FOUND AND KF5Service_FOUND) + calamares_add_plugin(interactiveterminal TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/keyboard/CMakeLists.txt b/src/modules/keyboard/CMakeLists.txt index fe341cef0..a2e09dc41 100644 --- a/src/modules/keyboard/CMakeLists.txt +++ b/src/modules/keyboard/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( keyboard +calamares_add_plugin(keyboard TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -21,11 +21,4 @@ calamares_add_plugin( keyboard SHARED_LIB ) -calamares_add_test( - keyboardtest - SOURCES - Tests.cpp - SetKeyboardLayoutJob.cpp - RESOURCES - keyboard.qrc -) +calamares_add_test(keyboardtest SOURCES Tests.cpp SetKeyboardLayoutJob.cpp RESOURCES keyboard.qrc) diff --git a/src/modules/keyboardq/CMakeLists.txt b/src/modules/keyboardq/CMakeLists.txt index 2b0577aa7..9c7922d86 100644 --- a/src/modules/keyboardq/CMakeLists.txt +++ b/src/modules/keyboardq/CMakeLists.txt @@ -3,16 +3,16 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "keyboardq (QML is not supported in this build)" ) return() endif() -set( _keyboard ${CMAKE_CURRENT_SOURCE_DIR}/../keyboard ) +set(_keyboard ${CMAKE_CURRENT_SOURCE_DIR}/../keyboard) -include_directories( ${_keyboard} ) +include_directories(${_keyboard}) -calamares_add_plugin( keyboardq +calamares_add_plugin(keyboardq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/license/CMakeLists.txt b/src/modules/license/CMakeLists.txt index 0cd838799..d214d6ca7 100644 --- a/src/modules/license/CMakeLists.txt +++ b/src/modules/license/CMakeLists.txt @@ -3,9 +3,9 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -calamares_add_plugin( license +calamares_add_plugin(license TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/locale/CMakeLists.txt b/src/modules/locale/CMakeLists.txt index 272dea3de..bad6042a6 100644 --- a/src/modules/locale/CMakeLists.txt +++ b/src/modules/locale/CMakeLists.txt @@ -7,14 +7,14 @@ # When debugging the timezone widget, add this debugging definition # to have a debugging-friendly timezone widget, debug logging, # and no intrusive timezone-setting while clicking around. -option( DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF ) -if( DEBUG_TIMEZONES ) - add_definitions( -DDEBUG_TIMEZONES ) +option(DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF) +if(DEBUG_TIMEZONES) + add_definitions(-DDEBUG_TIMEZONES) endif() -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -calamares_add_plugin( locale +calamares_add_plugin(locale TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -39,15 +39,7 @@ calamares_add_plugin( locale calamares_add_test( localetest - SOURCES - Tests.cpp - Config.cpp - LocaleConfiguration.cpp - SetTimezoneJob.cpp - timezonewidget/TimeZoneImage.cpp - DEFINITIONS - SOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/images" - DEBUG_TIMEZONES=1 - LIBRARIES - Qt5::Gui + SOURCES Tests.cpp Config.cpp LocaleConfiguration.cpp SetTimezoneJob.cpp timezonewidget/TimeZoneImage.cpp + DEFINITIONS SOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/images" DEBUG_TIMEZONES=1 + LIBRARIES Qt5::Gui ) diff --git a/src/modules/localeq/CMakeLists.txt b/src/modules/localeq/CMakeLists.txt index ee3f07314..f086676e6 100644 --- a/src/modules/localeq/CMakeLists.txt +++ b/src/modules/localeq/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "localeq (QML is not supported in this build)" ) return() endif() @@ -11,28 +11,22 @@ endif() # When debugging the timezone widget, add this debugging definition # to have a debugging-friendly timezone widget, debug logging, # and no intrusive timezone-setting while clicking around. -option( DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF ) -if( DEBUG_TIMEZONES ) - add_definitions( -DDEBUG_TIMEZONES ) +option(DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF) +if(DEBUG_TIMEZONES) + add_definitions(-DDEBUG_TIMEZONES) endif() find_package(Qt5Location CONFIG) -set_package_properties(Qt5Location PROPERTIES - DESCRIPTION "Used for rendering the map" - TYPE RUNTIME -) +set_package_properties(Qt5Location PROPERTIES DESCRIPTION "Used for rendering the map" TYPE RUNTIME) find_package(Qt5Positioning CONFIG) -set_package_properties(Qt5Positioning PROPERTIES - DESCRIPTION "Used for GeoLocation and GeoCoding" - TYPE RUNTIME -) +set_package_properties(Qt5Positioning PROPERTIES DESCRIPTION "Used for GeoLocation and GeoCoding" TYPE RUNTIME) # Because we're sharing sources with the regular locale module -set( _locale ${CMAKE_CURRENT_SOURCE_DIR}/../locale ) +set(_locale ${CMAKE_CURRENT_SOURCE_DIR}/../locale) -include_directories( ${_locale} ) +include_directories(${_locale}) -calamares_add_plugin( localeq +calamares_add_plugin(localeq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/luksbootkeyfile/CMakeLists.txt b/src/modules/luksbootkeyfile/CMakeLists.txt index 6e98af468..6f5d45062 100644 --- a/src/modules/luksbootkeyfile/CMakeLists.txt +++ b/src/modules/luksbootkeyfile/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( luksbootkeyfile +calamares_add_plugin(luksbootkeyfile TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/luksopenswaphookcfg/CMakeLists.txt b/src/modules/luksopenswaphookcfg/CMakeLists.txt index caede06a7..f186fbdc6 100644 --- a/src/modules/luksopenswaphookcfg/CMakeLists.txt +++ b/src/modules/luksopenswaphookcfg/CMakeLists.txt @@ -6,7 +6,7 @@ # Because LUKS Open Swap Hook (Job) is such a mouthful, we'll # use LOSH all over the place as a shorthand. -calamares_add_plugin( luksopenswaphookcfg +calamares_add_plugin(luksopenswaphookcfg TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -14,9 +14,4 @@ calamares_add_plugin( luksopenswaphookcfg SHARED_LIB ) -calamares_add_test( - luksopenswaphooktest - SOURCES - LOSHJob.cpp - Tests.cpp -) +calamares_add_test(luksopenswaphooktest SOURCES LOSHJob.cpp Tests.cpp) diff --git a/src/modules/machineid/CMakeLists.txt b/src/modules/machineid/CMakeLists.txt index 0ab035ab4..869d11387 100644 --- a/src/modules/machineid/CMakeLists.txt +++ b/src/modules/machineid/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( machineid +calamares_add_plugin(machineid TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -12,10 +12,4 @@ calamares_add_plugin( machineid SHARED_LIB ) -calamares_add_test( - machineidtest - SOURCES - Tests.cpp - MachineIdJob.cpp - Workers.cpp -) +calamares_add_test(machineidtest SOURCES Tests.cpp MachineIdJob.cpp Workers.cpp) diff --git a/src/modules/notesqml/CMakeLists.txt b/src/modules/notesqml/CMakeLists.txt index 5eab06663..c76ab5179 100644 --- a/src/modules/notesqml/CMakeLists.txt +++ b/src/modules/notesqml/CMakeLists.txt @@ -3,12 +3,12 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "notesqml (QML is not supported in this build)" ) return() endif() -calamares_add_plugin( notesqml +calamares_add_plugin(notesqml TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/oemid/CMakeLists.txt b/src/modules/oemid/CMakeLists.txt index af7fe1ff7..45825c85e 100644 --- a/src/modules/oemid/CMakeLists.txt +++ b/src/modules/oemid/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( oemid +calamares_add_plugin(oemid TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/packagechooser/CMakeLists.txt b/src/modules/packagechooser/CMakeLists.txt index d2e6ff118..e565fd05e 100644 --- a/src/modules/packagechooser/CMakeLists.txt +++ b/src/modules/packagechooser/CMakeLists.txt @@ -3,45 +3,46 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 COMPONENTS Core Gui Widgets REQUIRED ) -set( _extra_libraries "" ) -set( _extra_src "" ) +find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) +set(_extra_libraries "") +set(_extra_src "") ### OPTIONAL AppData XML support in PackageModel # # # TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) -option( WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON ) -if ( WITH_APPDATA ) +option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) +if(WITH_APPDATA) find_package(Qt5 COMPONENTS Xml) - if ( Qt5Xml_FOUND ) - add_definitions( -DHAVE_APPDATA ) - list( APPEND _extra_libraries Qt5::Xml ) - list( APPEND _extra_src ItemAppData.cpp ) + if(Qt5Xml_FOUND) + add_definitions(-DHAVE_APPDATA) + list(APPEND _extra_libraries Qt5::Xml) + list(APPEND _extra_src ItemAppData.cpp) endif() endif() ### OPTIONAL AppStream support in PackageModel # # -option( WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON ) -if ( WITH_APPSTREAM ) +option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) +if(WITH_APPSTREAM) find_package(AppStreamQt) set_package_properties( - AppStreamQt PROPERTIES + AppStreamQt + PROPERTIES DESCRIPTION "Support for AppStream (cache) data" URL "https://github.com/ximion/appstream" PURPOSE "AppStream provides package data" TYPE OPTIONAL ) - if ( AppStreamQt_FOUND ) - add_definitions( -DHAVE_APPSTREAM ) - list( APPEND _extra_libraries AppStreamQt ) - list( APPEND _extra_src ItemAppStream.cpp ) + if(AppStreamQt_FOUND) + add_definitions(-DHAVE_APPSTREAM) + list(APPEND _extra_libraries AppStreamQt) + list(APPEND _extra_src ItemAppStream.cpp) endif() endif() -calamares_add_plugin( packagechooser +calamares_add_plugin(packagechooser TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -62,9 +63,6 @@ calamares_add_plugin( packagechooser calamares_add_test( packagechoosertest GUI - SOURCES - Tests.cpp - LIBRARIES - calamares_viewmodule_packagechooser - ${_extra_libraries} + SOURCES Tests.cpp + LIBRARIES calamares_viewmodule_packagechooser ${_extra_libraries} ) diff --git a/src/modules/packagechooserq/CMakeLists.txt b/src/modules/packagechooserq/CMakeLists.txt index 51a17e215..0b2c4b23a 100644 --- a/src/modules/packagechooserq/CMakeLists.txt +++ b/src/modules/packagechooserq/CMakeLists.txt @@ -4,55 +4,56 @@ # SPDX-FileCopyrightText: 2021 Anke Boersma # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "packagechooserq (QML is not supported in this build)" ) return() endif() -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core) # Add optional libraries here -set( USER_EXTRA_LIB ) +set(USER_EXTRA_LIB) # include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser ) -set( _packagechooser ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser ) -include_directories( ${_packagechooser} ) +set(_packagechooser ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser) +include_directories(${_packagechooser}) ### OPTIONAL AppData XML support in PackageModel # # # TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) -option( WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON ) -if ( WITH_APPDATA ) +option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) +if(WITH_APPDATA) find_package(Qt5 COMPONENTS Xml) - if ( Qt5Xml_FOUND ) - add_definitions( -DHAVE_APPDATA ) - list( APPEND _extra_libraries Qt5::Xml ) - list( APPEND _extra_src ${_packagechooser}/ItemAppData.cpp ) + if(Qt5Xml_FOUND) + add_definitions(-DHAVE_APPDATA) + list(APPEND _extra_libraries Qt5::Xml) + list(APPEND _extra_src ${_packagechooser}/ItemAppData.cpp) endif() endif() ### OPTIONAL AppStream support in PackageModel # # -option( WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON ) -if ( WITH_APPSTREAM ) +option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) +if(WITH_APPSTREAM) find_package(AppStreamQt) set_package_properties( - AppStreamQt PROPERTIES + AppStreamQt + PROPERTIES DESCRIPTION "Support for AppStream (cache) data" URL "https://github.com/ximion/appstream" PURPOSE "AppStream provides package data" TYPE OPTIONAL ) - if ( AppStreamQt_FOUND ) - add_definitions( -DHAVE_APPSTREAM ) - list( APPEND _extra_libraries AppStreamQt ) - list( APPEND _extra_src ${_packagechooser}/ItemAppStream.cpp ) + if(AppStreamQt_FOUND) + add_definitions(-DHAVE_APPSTREAM) + list(APPEND _extra_libraries AppStreamQt) + list(APPEND _extra_src ${_packagechooser}/ItemAppStream.cpp) endif() endif() -calamares_add_plugin( packagechooserq +calamares_add_plugin(packagechooserq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/packages/tests/CMakeTests.txt b/src/modules/packages/tests/CMakeTests.txt index 4f7d6185f..a131735ce 100644 --- a/src/modules/packages/tests/CMakeTests.txt +++ b/src/modules/packages/tests/CMakeTests.txt @@ -14,29 +14,33 @@ add_test( ) add_test( NAME configure-packages-${_pm}-ops-1 - COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-1.yaml 4 1 1 + COMMAND + env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-1.yaml + 4 1 1 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) add_test( NAME configure-packages-${_pm}-ops-2 - COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-2.yaml 3 0 0 + COMMAND + env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-2.yaml + 3 0 0 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE ) - set( _module packages ) - set( _schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/${_module}.schema.yaml" ) +if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE) + set(_module packages) + set(_schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/${_module}.schema.yaml") message(STATUS "Schema ${_schema_file}") - foreach( _cf pm-pacman-1.yaml pm-pacman-2.yaml ) - set( _conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/tests/${_cf}" ) - if ( EXISTS "${_schema_file}" AND EXISTS "${_conf_file}" ) + foreach(_cf pm-pacman-1.yaml pm-pacman-2.yaml) + set(_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/tests/${_cf}") + if(EXISTS "${_schema_file}" AND EXISTS "${_conf_file}") add_test( NAME validate-packages-${_cf} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + COMMAND + ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" ) else() message(FATAL_ERROR "Missing ${_conf_file}") endif() endforeach() endif() - diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index 96378d98d..8f3dfca09 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -11,41 +11,41 @@ # it will error out at runtime unless you **also** switch **off** # DEBUG_PARTITION_LAME, at which point you are welcome to shoot # yourself in the foot. -option( DEBUG_PARTITION_UNSAFE "Allow unsafe partitioning choices." OFF ) -option( DEBUG_PARTITION_LAME "Unsafe partitioning will error out on exec." ON ) +option(DEBUG_PARTITION_UNSAFE "Allow unsafe partitioning choices." OFF) +option(DEBUG_PARTITION_LAME "Unsafe partitioning will error out on exec." ON) # This is very chatty, useful mostly if you don't know what KPMCore offers. -option( DEBUG_FILESYSTEMS "Log all available Filesystems from KPMCore." OFF ) +option(DEBUG_FILESYSTEMS "Log all available Filesystems from KPMCore." OFF) -include_directories( ${CMAKE_SOURCE_DIR} ) # For 3rdparty +include_directories(${CMAKE_SOURCE_DIR}) # For 3rdparty -set( _partition_defs ) -if( DEBUG_PARTITION_UNSAFE ) - if( DEBUG_PARTITION_LAME ) - list( APPEND _partition_defs DEBUG_PARTITION_LAME ) +set(_partition_defs) +if(DEBUG_PARTITION_UNSAFE) + if(DEBUG_PARTITION_LAME) + list(APPEND _partition_defs DEBUG_PARTITION_LAME) endif() - list( APPEND _partition_defs DEBUG_PARTITION_UNSAFE ) + list(APPEND _partition_defs DEBUG_PARTITION_UNSAFE) endif() -if ( DEBUG_FILESYSTEMS ) - list( APPEND _partition_defs DEBUG_FILESYSTEMS ) +if(DEBUG_FILESYSTEMS) + list(APPEND _partition_defs DEBUG_FILESYSTEMS) endif() find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) -include( KPMcoreHelper ) +include(KPMcoreHelper) -find_package( KF5Config CONFIG ) -find_package( KF5I18n CONFIG ) -find_package( KF5WidgetsAddons CONFIG ) +find_package(KF5Config CONFIG) +find_package(KF5I18n CONFIG) +find_package(KF5WidgetsAddons CONFIG) -if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND ) - list( APPEND _partition_defs ${KPMcore_API_DEFINITIONS} ) - include_directories( ${KPMCORE_INCLUDE_DIR} ) - include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +if(KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND) + list(APPEND _partition_defs ${KPMcore_API_DEFINITIONS}) + include_directories(${KPMCORE_INCLUDE_DIR}) + include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) - add_subdirectory( tests ) + add_subdirectory(tests) - calamares_add_plugin( partition + calamares_add_plugin(partition TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -113,10 +113,9 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND SHARED_LIB ) else() - if ( NOT KPMcore_FOUND ) + if(NOT KPMcore_FOUND) calamares_skip_module( "partition (missing suitable KPMcore)" ) else() calamares_skip_module( "partition (missing dependencies for KPMcore)" ) endif() endif() - diff --git a/src/modules/partition/tests/CMakeLists.txt b/src/modules/partition/tests/CMakeLists.txt index da017d96f..26a1d83f9 100644 --- a/src/modules/partition/tests/CMakeLists.txt +++ b/src/modules/partition/tests/CMakeLists.txt @@ -3,9 +3,9 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 COMPONENTS Gui REQUIRED ) +find_package(Qt5 COMPONENTS Gui REQUIRED) -set( PartitionModule_SOURCE_DIR .. ) +set(PartitionModule_SOURCE_DIR ..) include_directories( ${Qt5Gui_INCLUDE_DIRS} @@ -25,22 +25,17 @@ calamares_add_test( ${PartitionModule_SOURCE_DIR}/jobs/DeletePartitionJob.cpp ${PartitionModule_SOURCE_DIR}/jobs/PartitionJob.cpp ${PartitionModule_SOURCE_DIR}/jobs/ResizePartitionJob.cpp - LIBRARIES - kpmcore + LIBRARIES kpmcore DEFINITIONS ${_partition_defs} ) calamares_add_test( partitionclearmountsjobtest - SOURCES - ${PartitionModule_SOURCE_DIR}/jobs/ClearMountsJob.cpp - ClearMountsJobTests.cpp - LIBRARIES - kpmcore + SOURCES ${PartitionModule_SOURCE_DIR}/jobs/ClearMountsJob.cpp ClearMountsJobTests.cpp + LIBRARIES kpmcore DEFINITIONS ${_partition_defs} ) - calamares_add_test( partitioncreatelayoutstest SOURCES @@ -50,26 +45,19 @@ calamares_add_test( ${PartitionModule_SOURCE_DIR}/core/PartitionLayout.cpp ${PartitionModule_SOURCE_DIR}/core/PartUtils.cpp ${PartitionModule_SOURCE_DIR}/core/DeviceModel.cpp - LIBRARIES - kpmcore - Calamares::calamaresui + LIBRARIES kpmcore Calamares::calamaresui DEFINITIONS ${_partition_defs} ) calamares_add_test( partitionautomounttest - SOURCES - ${PartitionModule_SOURCE_DIR}/jobs/AutoMountManagementJob.cpp - AutoMountTests.cpp + SOURCES ${PartitionModule_SOURCE_DIR}/jobs/AutoMountManagementJob.cpp AutoMountTests.cpp DEFINITIONS ${_partition_defs} ) calamares_add_test( partitiondevicestest - SOURCES - DevicesTests.cpp - ${PartitionModule_SOURCE_DIR}/core/DeviceList.cpp - LIBRARIES - kpmcore + SOURCES DevicesTests.cpp ${PartitionModule_SOURCE_DIR}/core/DeviceList.cpp + LIBRARIES kpmcore DEFINITIONS ${_partition_defs} ) diff --git a/src/modules/plasmalnf/CMakeLists.txt b/src/modules/plasmalnf/CMakeLists.txt index 8ae205aed..9e87b5fec 100644 --- a/src/modules/plasmalnf/CMakeLists.txt +++ b/src/modules/plasmalnf/CMakeLists.txt @@ -7,28 +7,19 @@ find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) # Requires a sufficiently recent Plasma framework, but also # needs a runtime support component (which we don't test for). -set( lnf_ver 5.41 ) +set(lnf_ver 5.41) -find_package( KF5Config ${lnf_ver} ) -set_package_properties( - KF5Config PROPERTIES - PURPOSE "For finding default Plasma Look-and-Feel" -) +find_package(KF5Config ${lnf_ver}) +set_package_properties(KF5Config PROPERTIES PURPOSE "For finding default Plasma Look-and-Feel") -find_package( KF5Plasma ${lnf_ver} ) -set_package_properties( - KF5Plasma PROPERTIES - PURPOSE "For Plasma Look-and-Feel selection" -) +find_package(KF5Plasma ${lnf_ver}) +set_package_properties(KF5Plasma PROPERTIES PURPOSE "For Plasma Look-and-Feel selection") -find_package( KF5Package ${lnf_ver} ) -set_package_properties( - KF5Package PROPERTIES - PURPOSE "For Plasma Look-and-Feel selection" -) +find_package(KF5Package ${lnf_ver}) +set_package_properties(KF5Package PROPERTIES PURPOSE "For Plasma Look-and-Feel selection") -if ( KF5Plasma_FOUND AND KF5Package_FOUND ) - calamares_add_plugin( plasmalnf +if(KF5Plasma_FOUND AND KF5Package_FOUND) + calamares_add_plugin(plasmalnf TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO COMPILE_DEFINITIONS @@ -48,7 +39,7 @@ if ( KF5Plasma_FOUND AND KF5Package_FOUND ) KF5::Plasma SHARED_LIB ) - if ( KF5Config_FOUND ) + if(KF5Config_FOUND) target_compile_definitions(calamares_viewmodule_plasmalnf PRIVATE WITH_KCONFIG) endif() else() diff --git a/src/modules/preservefiles/CMakeLists.txt b/src/modules/preservefiles/CMakeLists.txt index 5df637321..b11b1310c 100644 --- a/src/modules/preservefiles/CMakeLists.txt +++ b/src/modules/preservefiles/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( preservefiles +calamares_add_plugin(preservefiles TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -14,9 +14,4 @@ calamares_add_plugin( preservefiles EMERGENCY ) -calamares_add_test( - preservefilestest - SOURCES - Item.cpp - Tests.cpp -) +calamares_add_test(preservefilestest SOURCES Item.cpp Tests.cpp) diff --git a/src/modules/removeuser/CMakeLists.txt b/src/modules/removeuser/CMakeLists.txt index 7663b3472..eaaf20157 100644 --- a/src/modules/removeuser/CMakeLists.txt +++ b/src/modules/removeuser/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( removeuser +calamares_add_plugin(removeuser TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/shellprocess/CMakeLists.txt b/src/modules/shellprocess/CMakeLists.txt index ac6630c6d..8ac444fb6 100644 --- a/src/modules/shellprocess/CMakeLists.txt +++ b/src/modules/shellprocess/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( shellprocess +calamares_add_plugin(shellprocess TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -11,10 +11,4 @@ calamares_add_plugin( shellprocess SHARED_LIB ) -calamares_add_test( - shellprocesstest - SOURCES - Tests.cpp - LIBRARIES - yamlcpp::yamlcpp -) +calamares_add_test(shellprocesstest SOURCES Tests.cpp LIBRARIES yamlcpp::yamlcpp) diff --git a/src/modules/summary/CMakeLists.txt b/src/modules/summary/CMakeLists.txt index e3c1a381c..16f98ebb4 100644 --- a/src/modules/summary/CMakeLists.txt +++ b/src/modules/summary/CMakeLists.txt @@ -3,8 +3,8 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) -calamares_add_plugin( summary +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) +calamares_add_plugin(summary TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/summaryq/CMakeLists.txt b/src/modules/summaryq/CMakeLists.txt index 8aac1bc2f..071c344ef 100644 --- a/src/modules/summaryq/CMakeLists.txt +++ b/src/modules/summaryq/CMakeLists.txt @@ -3,15 +3,15 @@ # SPDX-FileCopyrightText: 2021 Anke Boersma # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "summaryq (QML is not supported in this build)" ) return() endif() -set( _summary ${CMAKE_CURRENT_SOURCE_DIR}/../summary ) -include_directories( ${_summary} ) +set(_summary ${CMAKE_CURRENT_SOURCE_DIR}/../summary) +include_directories(${_summary}) -calamares_add_plugin( summaryq +calamares_add_plugin(summaryq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/umount/CMakeLists.txt b/src/modules/umount/CMakeLists.txt index d72847007..09e6a085d 100644 --- a/src/modules/umount/CMakeLists.txt +++ b/src/modules/umount/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2021 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( umount +calamares_add_plugin(umount TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -12,8 +12,4 @@ calamares_add_plugin( umount EMERGENCY ) -calamares_add_test( - umounttest - SOURCES - Tests.cpp -) +calamares_add_test(umounttest SOURCES Tests.cpp) diff --git a/src/modules/users/CMakeLists.txt b/src/modules/users/CMakeLists.txt index 8203ecf08..1ee9832c4 100644 --- a/src/modules/users/CMakeLists.txt +++ b/src/modules/users/CMakeLists.txt @@ -3,39 +3,33 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network ) -find_package( Crypt REQUIRED ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network) +find_package(Crypt REQUIRED) # Add optional libraries here -set( USER_EXTRA_LIB ) +set(USER_EXTRA_LIB) -find_package( LibPWQuality ) -set_package_properties( - LibPWQuality PROPERTIES - PURPOSE "Extra checks of password quality" -) +find_package(LibPWQuality) +set_package_properties(LibPWQuality PROPERTIES PURPOSE "Extra checks of password quality") -if( LibPWQuality_FOUND ) - list( APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES} ) - include_directories( ${LibPWQuality_INCLUDE_DIRS} ) - add_definitions( -DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY ) +if(LibPWQuality_FOUND) + list(APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES}) + include_directories(${LibPWQuality_INCLUDE_DIRS}) + add_definitions(-DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY) endif() -find_package( ICU COMPONENTS uc i18n ) -set_package_properties( - ICU PROPERTIES - PURPOSE "Transliteration support for full name to username conversion" -) +find_package(ICU COMPONENTS uc i18n) +set_package_properties(ICU PROPERTIES PURPOSE "Transliteration support for full name to username conversion") -if( ICU_FOUND ) - list( APPEND USER_EXTRA_LIB ICU::uc ICU::i18n ) - include_directories( ${ICU_INCLUDE_DIRS} ) - add_definitions( -DHAVE_ICU ) +if(ICU_FOUND) + list(APPEND USER_EXTRA_LIB ICU::uc ICU::i18n) + include_directories(${ICU_INCLUDE_DIRS}) + add_definitions(-DHAVE_ICU) endif() -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -set( _users_src +set(_users_src # Jobs CreateUserJob.cpp MiscJobs.cpp @@ -59,7 +53,7 @@ calamares_add_library( ${CRYPT_LIBRARIES} ) -calamares_add_plugin( users +calamares_add_plugin(users TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -76,42 +70,33 @@ calamares_add_plugin( users SHARED_LIB ) -calamares_add_test( - userspasswordtest - SOURCES - TestPasswordJob.cpp - SetPasswordJob.cpp - LIBRARIES - ${CRYPT_LIBRARIES} -) +calamares_add_test(userspasswordtest SOURCES TestPasswordJob.cpp SetPasswordJob.cpp LIBRARIES ${CRYPT_LIBRARIES}) calamares_add_test( usersgroupstest SOURCES TestGroupInformation.cpp - ${_users_src} # Build again with test-visibility + ${_users_src} # Build again with test-visibility LIBRARIES - Qt5::DBus # HostName job can use DBus to systemd - ${CRYPT_LIBRARIES} # SetPassword job uses crypt() + Qt5::DBus # HostName job can use DBus to systemd + ${CRYPT_LIBRARIES} # SetPassword job uses crypt() ${USER_EXTRA_LIB} ) calamares_add_test( usershostnametest - SOURCES - TestSetHostNameJob.cpp - SetHostNameJob.cpp + SOURCES TestSetHostNameJob.cpp SetHostNameJob.cpp LIBRARIES - Qt5::DBus # HostName job can use DBus to systemd + Qt5::DBus # HostName job can use DBus to systemd ) calamares_add_test( userstest SOURCES Tests.cpp - ${_users_src} # Build again with test-visibility + ${_users_src} # Build again with test-visibility LIBRARIES - Qt5::DBus # HostName job can use DBus to systemd - ${CRYPT_LIBRARIES} # SetPassword job uses crypt() + Qt5::DBus # HostName job can use DBus to systemd + ${CRYPT_LIBRARIES} # SetPassword job uses crypt() ${USER_EXTRA_LIB} ) diff --git a/src/modules/usersq/CMakeLists.txt b/src/modules/usersq/CMakeLists.txt index 8465b0246..33133f439 100644 --- a/src/modules/usersq/CMakeLists.txt +++ b/src/modules/usersq/CMakeLists.txt @@ -3,45 +3,39 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "usersq (QML is not supported in this build)" ) return() endif() -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network ) -find_package( Crypt REQUIRED ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network) +find_package(Crypt REQUIRED) # Add optional libraries here -set( USER_EXTRA_LIB ) +set(USER_EXTRA_LIB) -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../users ) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../users) -find_package( LibPWQuality ) -set_package_properties( - LibPWQuality PROPERTIES - PURPOSE "Extra checks of password quality" -) +find_package(LibPWQuality) +set_package_properties(LibPWQuality PROPERTIES PURPOSE "Extra checks of password quality") -if( LibPWQuality_FOUND ) - list( APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES} ) - include_directories( ${LibPWQuality_INCLUDE_DIRS} ) - add_definitions( -DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY ) +if(LibPWQuality_FOUND) + list(APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES}) + include_directories(${LibPWQuality_INCLUDE_DIRS}) + add_definitions(-DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY) endif() #needed for ${_users}/Config.cpp -find_package( ICU COMPONENTS uc i18n ) -set_package_properties( - ICU PROPERTIES - PURPOSE "Transliteration support for full name to username conversion" -) +find_package(ICU COMPONENTS uc i18n) +set_package_properties(ICU PROPERTIES PURPOSE "Transliteration support for full name to username conversion") -if( ICU_FOUND ) - list( APPEND USER_EXTRA_LIB ICU::uc ICU::i18n ) - include_directories( ${ICU_INCLUDE_DIRS} ) - add_definitions( -DHAVE_ICU ) +if(ICU_FOUND) + list(APPEND USER_EXTRA_LIB ICU::uc ICU::i18n) + include_directories(${ICU_INCLUDE_DIRS}) + add_definitions(-DHAVE_ICU) endif() -calamares_add_plugin( usersq +calamares_add_plugin(usersq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/webview/CMakeLists.txt b/src/modules/webview/CMakeLists.txt index 54e1d18b0..b8ef5d7d4 100644 --- a/src/modules/webview/CMakeLists.txt +++ b/src/modules/webview/CMakeLists.txt @@ -3,52 +3,41 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -set( CALA_WEBVIEW_LINK_LIBRARIES "" ) +set(CALA_WEBVIEW_LINK_LIBRARIES "") -option( WEBVIEW_FORCE_WEBKIT "Always build webview with WebKit instead of WebEngine regardless of Qt version." OFF) +option(WEBVIEW_FORCE_WEBKIT "Always build webview with WebKit instead of WebEngine regardless of Qt version." OFF) -set( _reason "" ) +set(_reason "") -message( STATUS "Found Qt version ${Qt5Core_VERSION}") -if ( Qt5Core_VERSION VERSION_LESS 5.6 OR WEBVIEW_FORCE_WEBKIT ) - message( STATUS " .. using webkit") - find_package( Qt5 ${QT_VERSION} CONFIG COMPONENTS WebKit WebKitWidgets ) +message(STATUS "Found Qt version ${Qt5Core_VERSION}") +if(Qt5Core_VERSION VERSION_LESS 5.6 OR WEBVIEW_FORCE_WEBKIT) + message(STATUS " .. using webkit") + find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS WebKit WebKitWidgets) - if ( Qt5WebKit_FOUND AND Qt5WebKitWidgets_FOUND ) - list( APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES - ${QT_QTWEBKIT_INCLUDE_DIR} - ) - list( APPEND CALA_WEBVIEW_LINK_LIBRARIES - Qt5::WebKit - Qt5::WebKitWidgets - ) - set( WEBVIEW_WITH_WEBKIT 1 ) + if(Qt5WebKit_FOUND AND Qt5WebKitWidgets_FOUND) + list(APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES ${QT_QTWEBKIT_INCLUDE_DIR}) + list(APPEND CALA_WEBVIEW_LINK_LIBRARIES Qt5::WebKit Qt5::WebKitWidgets) + set(WEBVIEW_WITH_WEBKIT 1) else() - set( _reason "No suitable WebKit" ) + set(_reason "No suitable WebKit") endif() else() - message( STATUS " .. using webengine") - find_package( Qt5 ${QT_VERSION} CONFIG COMPONENTS WebEngine WebEngineWidgets ) + message(STATUS " .. using webengine") + find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS WebEngine WebEngineWidgets) - if ( Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND ) - list( APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES - ${QT_QTWEBENGINE_INCLUDE_DIR} - ) - list( APPEND CALA_WEBVIEW_LINK_LIBRARIES - Qt5::WebEngine - Qt5::WebEngineWidgets - ) - set( WEBVIEW_WITH_WEBENGINE 1 ) + if(Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND) + list(APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES ${QT_QTWEBENGINE_INCLUDE_DIR}) + list(APPEND CALA_WEBVIEW_LINK_LIBRARIES Qt5::WebEngine Qt5::WebEngineWidgets) + set(WEBVIEW_WITH_WEBENGINE 1) else() - set( _reason "No suitable WebEngine" ) + set(_reason "No suitable WebEngine") endif() endif() -if ( NOT _reason ) - configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/WebViewConfig.h.in - ${CMAKE_CURRENT_BINARY_DIR}/WebViewConfig.h ) +if(NOT _reason) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/WebViewConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/WebViewConfig.h) - calamares_add_plugin( webview + calamares_add_plugin(webview TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index 01a89703a..c8fb13590 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -3,19 +3,19 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) -find_package( LIBPARTED ) -if ( LIBPARTED_FOUND ) - set( PARTMAN_SRC checker/partman_devices.c ) - set( PARTMAN_LIB ${LIBPARTED_LIBRARY} ) +find_package(LIBPARTED) +if(LIBPARTED_FOUND) + set(PARTMAN_SRC checker/partman_devices.c) + set(PARTMAN_LIB ${LIBPARTED_LIBRARY}) else() - set( PARTMAN_SRC ) - set( PARTMAN_LIB ) - add_definitions( -DWITHOUT_LIBPARTED ) + set(PARTMAN_SRC) + set(PARTMAN_LIB) + add_definitions(-DWITHOUT_LIBPARTED) endif() -calamares_add_plugin( welcome +calamares_add_plugin(welcome TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -41,15 +41,6 @@ calamares_add_plugin( welcome calamares_add_test( welcometest - SOURCES - checker/GeneralRequirements.cpp - ${PARTMAN_SRC} - Config.cpp - Tests.cpp - LIBRARIES - ${PARTMAN_LIB} - Qt5::DBus - Qt5::Network - Qt5::Widgets - Calamares::calamaresui + SOURCES checker/GeneralRequirements.cpp ${PARTMAN_SRC} Config.cpp Tests.cpp + LIBRARIES ${PARTMAN_LIB} Qt5::DBus Qt5::Network Qt5::Widgets Calamares::calamaresui ) diff --git a/src/modules/welcomeq/CMakeLists.txt b/src/modules/welcomeq/CMakeLists.txt index b6f950dad..7afdf638c 100644 --- a/src/modules/welcomeq/CMakeLists.txt +++ b/src/modules/welcomeq/CMakeLists.txt @@ -7,34 +7,31 @@ # This is a re-write of the welcome module using QML view steps # instead of widgets. -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "welcomeq (QML is not supported in this build)" ) return() endif() -set( _welcome ${CMAKE_CURRENT_SOURCE_DIR}/../welcome ) +set(_welcome ${CMAKE_CURRENT_SOURCE_DIR}/../welcome) -include_directories( ${_welcome} ) +include_directories(${_welcome}) # DUPLICATED WITH WELCOME MODULE -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) -find_package( LIBPARTED ) -if ( LIBPARTED_FOUND ) - set( PARTMAN_SRC ${_welcome}/checker/partman_devices.c ) - set( CHECKER_LINK_LIBRARIES ${LIBPARTED_LIBRARY} ) +find_package(LIBPARTED) +if(LIBPARTED_FOUND) + set(PARTMAN_SRC ${_welcome}/checker/partman_devices.c) + set(CHECKER_LINK_LIBRARIES ${LIBPARTED_LIBRARY}) else() - set( PARTMAN_SRC ) - set( CHECKER_LINK_LIBRARIES ) - add_definitions( -DWITHOUT_LIBPARTED ) + set(PARTMAN_SRC) + set(CHECKER_LINK_LIBRARIES) + add_definitions(-DWITHOUT_LIBPARTED) endif() -set( CHECKER_SOURCES - ${_welcome}/checker/GeneralRequirements.cpp - ${PARTMAN_SRC} -) +set(CHECKER_SOURCES ${_welcome}/checker/GeneralRequirements.cpp ${PARTMAN_SRC}) -calamares_add_plugin( welcomeq +calamares_add_plugin(welcomeq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/zfs/CMakeLists.txt b/src/modules/zfs/CMakeLists.txt index 2feb911d0..07764a360 100644 --- a/src/modules/zfs/CMakeLists.txt +++ b/src/modules/zfs/CMakeLists.txt @@ -3,11 +3,10 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( zfs +calamares_add_plugin(zfs TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES ZfsJob.cpp SHARED_LIB ) - diff --git a/src/qml/calamares/CMakeLists.txt b/src/qml/calamares/CMakeLists.txt index d74e79ea0..07e376bfa 100644 --- a/src/qml/calamares/CMakeLists.txt +++ b/src/qml/calamares/CMakeLists.txt @@ -12,29 +12,31 @@ # Iterate over all the subdirectories which have a qmldir file, copy them over to the build dir, # and install them into share/calamares/qml/calamares -file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" ) -foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) - if( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}" - AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir" ) - - set( QML_DIR share/calamares/qml ) - set( QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY} ) +file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*") +foreach(SUBDIRECTORY ${SUBDIRECTORIES}) + if( + IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}" + AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir" + ) + set(QML_DIR share/calamares/qml) + set(QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY}) # We glob all the files inside the subdirectory, and we make sure they are # synced with the bindir structure and installed. - file( GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*" ) - foreach( QML_MODULE_FILE ${QML_MODULE_FILES} ) - if( NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE} ) - configure_file( ${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY ) + file(GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*") + foreach(QML_MODULE_FILE ${QML_MODULE_FILES}) + if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE}) + configure_file(${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE} - DESTINATION ${QML_MODULE_DESTINATION} ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE} + DESTINATION ${QML_MODULE_DESTINATION} + ) endif() endforeach() - message( "-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}" ) - + message("-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}") endif() endforeach() -message( "" ) +message("")