2020-08-26 00:24:52 +02:00
|
|
|
# === This file is part of Calamares - <https://github.com/calamares> ===
|
|
|
|
#
|
|
|
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
#
|
|
|
|
|
2017-12-24 22:08:48 +01:00
|
|
|
# The variable SKIP_MODULES can be set to skip particular modules;
|
|
|
|
# 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 "" )
|
|
|
|
|
2019-05-07 13:47:24 +02:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}/src/libcalamares
|
|
|
|
${CMAKE_BINARY_DIR}/src/libcalamares
|
|
|
|
${CMAKE_SOURCE_DIR}/src/libcalamaresui
|
|
|
|
)
|
|
|
|
|
2015-08-03 17:59:07 +02:00
|
|
|
string( REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}" )
|
2018-01-24 10:29:06 +01:00
|
|
|
|
|
|
|
file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" )
|
|
|
|
list( SORT SUBDIRECTORIES )
|
|
|
|
|
2018-06-26 11:33:01 +02:00
|
|
|
set( _use_categories "" )
|
|
|
|
set( _found_categories "" )
|
2018-06-26 11:18:10 +02:00
|
|
|
|
2014-07-14 16:26:10 +02:00
|
|
|
foreach( SUBDIRECTORY ${SUBDIRECTORIES} )
|
2015-08-03 17:59:07 +02:00
|
|
|
list( FIND SKIP_LIST ${SUBDIRECTORY} DO_SKIP )
|
|
|
|
|
2018-06-26 11:18:10 +02:00
|
|
|
set( _skip_reason "user request" )
|
2018-06-26 11:33:01 +02:00
|
|
|
# Handle the USE_<foo> variables by looking for subdirectories
|
|
|
|
# with a <foo>-<implementation> kind of name.
|
2018-06-26 11:18:10 +02:00
|
|
|
if( SUBDIRECTORY MATCHES "^[a-zA-Z0-9_]+-" )
|
|
|
|
string( REGEX REPLACE "^[^-]+-" "" _implementation ${SUBDIRECTORY} )
|
|
|
|
string( REGEX REPLACE "-.*" "" _category ${SUBDIRECTORY} )
|
|
|
|
if( USE_${_category} )
|
2018-06-26 11:33:01 +02:00
|
|
|
list( APPEND _use_categories ${_category} )
|
|
|
|
if( "${_implementation}" STREQUAL "${USE_${_category}}" )
|
|
|
|
list( APPEND _found_categories ${_category} )
|
|
|
|
else()
|
2018-06-26 11:18:10 +02:00
|
|
|
list( APPEND SKIP_LIST ${SUBDIRECTORY} )
|
|
|
|
set( _skip_reason "USE_${_category}=${USE_${_category}}" )
|
|
|
|
set( DO_SKIP 1 )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-08-03 17:59:07 +02:00
|
|
|
if( NOT DO_SKIP EQUAL -1 )
|
|
|
|
message( "${ColorReset}-- Skipping module ${BoldRed}${SUBDIRECTORY}${ColorReset}." )
|
|
|
|
message( "" )
|
2018-06-26 11:18:10 +02:00
|
|
|
list( APPEND LIST_SKIPPED_MODULES "${SUBDIRECTORY} (${_skip_reason})" )
|
2015-08-03 17:59:07 +02:00
|
|
|
elseif( ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}" ) AND
|
|
|
|
( DO_SKIP EQUAL -1 ) )
|
2017-12-24 22:08:48 +01:00
|
|
|
set( SKIPPED_MODULES )
|
2014-07-14 16:26:10 +02:00
|
|
|
calamares_add_module_subdirectory( ${SUBDIRECTORY} )
|
2017-12-24 22:08:48 +01:00
|
|
|
if ( SKIPPED_MODULES )
|
|
|
|
list( APPEND LIST_SKIPPED_MODULES "${SKIPPED_MODULES}" )
|
|
|
|
endif()
|
2014-06-11 13:37:10 +02:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2017-08-09 20:33:32 +02:00
|
|
|
|
2018-01-10 15:20:49 +01:00
|
|
|
# This is *also* done in top-level, so list is displayed
|
|
|
|
# both before and after the feature summary.
|
|
|
|
calamares_explain_skipped_modules( ${LIST_SKIPPED_MODULES} )
|
2017-12-24 22:08:48 +01:00
|
|
|
|
2018-06-26 11:33:01 +02:00
|
|
|
foreach( _category ${_use_categories} )
|
|
|
|
list( FIND _found_categories ${_category} _found )
|
2020-06-22 13:39:36 +02:00
|
|
|
if ( ${USE_${_category}} STREQUAL "none" )
|
|
|
|
set( _found 0 )
|
|
|
|
endif()
|
2018-06-26 11:33:01 +02:00
|
|
|
if ( _found EQUAL -1 )
|
|
|
|
message( FATAL_ERROR "USE_${_category} is set to ${USE_${_category}} and no module matches." )
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2017-08-09 20:33:32 +02:00
|
|
|
include( CalamaresAddTranslations )
|
|
|
|
add_calamares_python_translations( ${CALAMARES_TRANSLATION_LANGUAGES} )
|
2020-06-16 14:38:13 +02:00
|
|
|
|
|
|
|
# TODO:3.3: Use FindPython3
|
2020-06-16 17:36:59 +02:00
|
|
|
if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE )
|
2020-06-16 14:38:13 +02:00
|
|
|
# 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" )
|
|
|
|
set( _conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf" )
|
|
|
|
if ( EXISTS "${_schema_file}" AND EXISTS "${_conf_file}" )
|
|
|
|
add_test(
|
|
|
|
NAME validate-${SUBDIRECTORY}
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|