diff --git a/.prev_qt_cmdline.cmake b/.prev_qt_cmdline.cmake new file mode 100644 index 0000000000..f8e40b38ad --- /dev/null +++ b/.prev_qt_cmdline.cmake @@ -0,0 +1,127 @@ +qt_commandline_subconfig(src/corelib) +qt_commandline_subconfig(src/network) +qt_commandline_subconfig(src/gui) +qt_commandline_subconfig(src/sql) +qt_commandline_subconfig(src/xml) +qt_commandline_subconfig(src/widgets) +qt_commandline_subconfig(src/printsupport) +qt_commandline_subconfig(src/plugins/sqldrivers) +qt_commandline_subconfig(src/testlib) +qt_commandline_custom(qmakeArgs) +qt_commandline_option(prefix TYPE string) +qt_commandline_option(hostprefix TYPE optionalString) +qt_commandline_option(extprefix TYPE string) +qt_commandline_option(archdatadir TYPE string) +qt_commandline_option(bindir TYPE string) +qt_commandline_option(datadir TYPE string) +qt_commandline_option(docdir TYPE string) +qt_commandline_option(examplesdir TYPE string) +qt_commandline_option(external-hostbindir TYPE string) +qt_commandline_option(headerdir TYPE string) +qt_commandline_option(hostbindir TYPE string) +qt_commandline_option(hostdatadir TYPE string) +qt_commandline_option(hostlibdir TYPE string) +qt_commandline_option(libdir TYPE string) +qt_commandline_option(libexecdir TYPE string) +qt_commandline_option(plugindir TYPE string) +qt_commandline_option(qmldir TYPE string) +qt_commandline_option(settingsdir TYPE string NAME sysconfdir) +qt_commandline_option(sysconfdir TYPE string) +qt_commandline_option(testsdir TYPE string) +qt_commandline_option(translationdir TYPE string) +qt_commandline_option(android-arch TYPE string) +qt_commandline_option(android-abis TYPE string) +qt_commandline_option(android-ndk TYPE string) +qt_commandline_option(android-ndk-host TYPE string) +qt_commandline_option(android-ndk-platform TYPE string) +qt_commandline_option(android-sdk TYPE string) +qt_commandline_option(android-style-assets TYPE boolean) +qt_commandline_option(appstore-compliant TYPE boolean) +qt_commandline_option(avx TYPE boolean) +qt_commandline_option(avx2 TYPE boolean) +qt_commandline_option(avx512 TYPE boolean NAME avx512f) +qt_commandline_option(c++std TYPE cxxstd) +qt_commandline_option(ccache TYPE boolean NAME ccache) +qt_commandline_option(commercial TYPE void) +qt_commandline_option(compile-examples TYPE boolean NAME compile_examples) +qt_commandline_option(confirm-license TYPE void) +qt_commandline_option(coverage TYPE coverage) +qt_commandline_option(dbus TYPE optionalString VALUES no yes linked runtime) +qt_commandline_option(dbus-linked TYPE void NAME dbus VALUE linked) +qt_commandline_option(dbus-runtime TYPE void NAME dbus VALUE runtime) +qt_commandline_option(debug TYPE void) +qt_commandline_option(debug-and-release TYPE boolean NAME debug_and_release) +qt_commandline_option(developer-build TYPE void) +qt_commandline_option(device TYPE string) +qt_commandline_option(device-option TYPE addString) +qt_commandline_option(f16c TYPE boolean) +qt_commandline_option(force-asserts TYPE boolean NAME force_asserts) +qt_commandline_option(force-debug-info TYPE boolean NAME force_debug_info) +qt_commandline_option(force-pkg-config TYPE void NAME pkg-config) +qt_commandline_option(framework TYPE boolean) +qt_commandline_option(gc-binaries TYPE boolean NAME gc_binaries) +qt_commandline_option(gdb-index TYPE boolean NAME enable_gdb_index) +qt_commandline_option(gcc-sysroot TYPE boolean) +qt_commandline_option(gcov TYPE boolean) +qt_commandline_option(gnumake TYPE boolean NAME GNUmake) +qt_commandline_option(gui TYPE boolean) +qt_commandline_option(headersclean TYPE boolean) +qt_commandline_option(incredibuild-xge TYPE boolean NAME incredibuild_xge) +qt_commandline_option(libudev TYPE boolean) +qt_commandline_option(linker TYPE optionalString VALUES bfd gold lld) +qt_commandline_option(ltcg TYPE boolean) +qt_commandline_option(make TYPE addString VALUES examples libs tests tools) +qt_commandline_option(make-tool TYPE string) +qt_commandline_option(mips_dsp TYPE boolean) +qt_commandline_option(mips_dspr2 TYPE boolean) +qt_commandline_option(mp TYPE boolean NAME msvc_mp) +qt_commandline_option(nomake TYPE addString VALUES examples tests tools) +qt_commandline_option(opensource TYPE void NAME commercial VALUE no) +qt_commandline_option(optimize-debug TYPE boolean NAME optimize_debug) +qt_commandline_option(optimize-size TYPE boolean NAME optimize_size) +qt_commandline_option(optimized-qmake TYPE boolean NAME release_tools) +qt_commandline_option(optimized-tools TYPE boolean NAME release_tools) +qt_commandline_option(pch TYPE boolean NAME precompile_header) +qt_commandline_option(pkg-config TYPE boolean) +qt_commandline_option(platform TYPE string) +qt_commandline_option(plugin-manifests TYPE boolean) +qt_commandline_option(profile TYPE boolean) +qt_commandline_option(qreal TYPE string) +qt_commandline_option(qtlibinfix TYPE string NAME qt_libinfix) +qt_commandline_option(qtnamespace TYPE string NAME qt_namespace) +qt_commandline_option(reduce-exports TYPE boolean NAME reduce_exports) +qt_commandline_option(reduce-relocations TYPE boolean NAME reduce_relocations) +qt_commandline_option(release TYPE enum NAME debug MAPPING yes no no yes) +qt_commandline_option(rpath TYPE boolean) +qt_commandline_option(sanitize TYPE sanitize) +qt_commandline_option(sdk TYPE string) +qt_commandline_option(separate-debug-info TYPE boolean NAME separate_debug_info) +qt_commandline_option(shared TYPE boolean) +qt_commandline_option(silent TYPE void) +qt_commandline_option(qdbus TYPE boolean NAME dbus) +qt_commandline_option(sse2 TYPE boolean) +qt_commandline_option(sse3 TYPE boolean) +qt_commandline_option(sse4.1 TYPE boolean NAME sse4_1) +qt_commandline_option(sse4.2 TYPE boolean NAME sse4_2) +qt_commandline_option(ssse3 TYPE boolean) +qt_commandline_option(static TYPE enum NAME shared MAPPING yes no no yes) +qt_commandline_option(static-runtime TYPE boolean NAME static_runtime) +qt_commandline_option(strip TYPE boolean) +qt_commandline_option(syncqt TYPE boolean) +qt_commandline_option(sysroot TYPE string) +qt_commandline_option(testcocoon TYPE boolean) +qt_commandline_option(use-gold-linker TYPE boolean NAME use_gold_linker_alias) +qt_commandline_option(warnings-are-errors TYPE boolean NAME warnings_are_errors) +qt_commandline_option(Werror TYPE boolean NAME warnings_are_errors) +qt_commandline_option(widgets TYPE boolean) +qt_commandline_option(xplatform TYPE string) +qt_commandline_option(zlib TYPE enum NAME system-zlib MAPPING system yes qt no) +qt_commandline_option(zstd TYPE boolean) +qt_commandline_prefix(D defines) +qt_commandline_prefix(F fpaths) +qt_commandline_prefix(I includes) +qt_commandline_prefix(L lpaths) +qt_commandline_prefix(R rpaths) +qt_commandline_prefix(W wflags) +qt_commandline_assignment(DBUS_HOST_PATH host_dbus.prefix) +qt_commandline_assignment(DBUS_PATH dbus.prefix) diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 55c4fbfe05..ed6e9800ea 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -5,35 +5,33 @@ # OPTFILE: A text file containing the options that were passed to configure # with one option per line. +include(${CMAKE_CURRENT_LIST_DIR}/QtFeatureCommon.cmake) + cmake_policy(SET CMP0007 NEW) +cmake_policy(SET CMP0057 NEW) set(cmake_args "") macro(push) list(APPEND cmake_args ${ARGN}) endmacro() -macro(calculate_state) - set(state ON) - if(CMAKE_MATCH_1 MATCHES "no-?") - set(state OFF) - endif() -endmacro() - macro(pop_path_argument) list(POP_FRONT configure_args path) string(REGEX REPLACE "^\"(.*)\"$" "\\1" path "${path}") file(TO_CMAKE_PATH "${path}" path) endmacro() -get_filename_component(source_dir ".." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") +get_filename_component(qtbase_source_dir ".." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") +set(configure_filename "configure.cmake") +set(commandline_filename "qt_cmdline.cmake") +set(source_dir "${qtbase_source_dir}") file(STRINGS "${OPTFILE}" configure_args) list(FILTER configure_args EXCLUDE REGEX "^[ \t]*$") list(TRANSFORM configure_args STRIP) unset(generator) set(auto_detect_generator TRUE) -unset(build_configs) unset(device_options) -unset(extra_rpaths) +set_property(GLOBAL PROPERTY UNHANDLED_ARGS "") while(configure_args) list(POP_FRONT configure_args arg) if(arg STREQUAL "-cmake") @@ -44,51 +42,13 @@ while(configure_args) set(auto_detect_generator FALSE) elseif(arg STREQUAL "-top-level") get_filename_component(source_dir "../.." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + file(GLOB commandline_files "${source_dir}/*/${commandline_filename}") + if(EXISTS "${source_dir}/${commandline_filename}") + list(PREPEND commandline_files "${source_dir}/${commandline_filename}") + endif() elseif(arg STREQUAL "-skip") list(POP_FRONT configure_args qtrepo) push("-DBUILD_${qtrepo}=OFF") - elseif(arg STREQUAL "-opensource") - # to be done - elseif(arg STREQUAL "-commercial") - # to be done - elseif(arg STREQUAL "-confirm-license") - # to be done - elseif(arg MATCHES "^-(no)?make") - calculate_state() - list(POP_FRONT configure_args component) - if(component STREQUAL "tests") - push(-DBUILD_TESTING=${state}) - elseif(component STREQUAL "examples") - push(-DBUILD_EXAMPLES=${state}) - else() - string(TOUPPER "${component}" uc_component) - push(-DQT_NO_MAKE_${uc_component}=${state}) - endif() - elseif(arg MATCHES "^-(no-)?feature") - calculate_state() - list(POP_FRONT configure_args feature) - push("-DFEATURE_${feature}=${state}") - elseif(arg MATCHES "^-(no-)?pch") - calculate_state() - push("-DBUILD_WITH_PCH=${state}") - elseif(arg MATCHES "^-system-(.*)") - list(POP_FRONT configure_args lib) - push("-DFEATURE_system_${lib}=ON") - elseif(arg MATCHES "^-qt-(.*)") - list(POP_FRONT configure_args lib) - push("-DFEATURE_system_${lib}=OFF") - elseif(arg MATCHES "^-sanitize=(.*)") - push("-DECM_ENABLE_SANITIZERS=${CMAKE_MATCH_1}") - elseif(arg STREQUAL "-ccache") - push(-DQT_USE_CCACHE=ON) - elseif(arg STREQUAL "-developer-build") - push(-DFEATURE_developer_build=ON) - elseif(arg STREQUAL "-prefix") - pop_path_argument() - push("-DCMAKE_INSTALL_PREFIX=${path}") - elseif(arg STREQUAL "-extprefix") - pop_path_argument() - push("-DCMAKE_STAGING_PREFIX=${path}") elseif(arg STREQUAL "-hostprefix") message(FATAL_ERROR "${arg} is not supported in the CMake build.") elseif(arg STREQUAL "-external-hostbindir") @@ -100,58 +60,522 @@ while(configure_args) push("-DQT_HOST_PATH=${path}") elseif(arg MATCHES "^-host.*dir") message(FATAL_ERROR "${arg} is not supported anymore.") - elseif(arg MATCHES - "^-(bin|lib|archdata|libexec|qml|data|doc|translation|sysconf|examples|tests)dir$") - string(TOUPPER "${CMAKE_MATCH_1}" type) - list(POP_FRONT configure_args dir) - push("-DINSTALL_${type}DIR=${dir}") - elseif(arg STREQUAL "-plugindir") - list(POP_FRONT configure_args dir) - push("-DINSTALL_PLUGINSDIR=${dir}") - elseif(arg STREQUAL "-release") - set(build_configs "Release") - elseif(arg STREQUAL "-debug") - set(build_configs "Debug") - elseif(arg STREQUAL "-debug-and-release") - set(build_configs Debug Release) - elseif(arg STREQUAL "-force-debug-info") - set(force_debug_info ON) - elseif(arg STREQUAL "-shared") - push("-DBUILD_SHARED_LIBS=ON") - elseif(arg STREQUAL "-static") - push("-DBUILD_SHARED_LIBS=OFF") - elseif(arg MATCHES "^-(no-)?framework") - calculate_state() - push("-DFEATURE_framework=${state}") - elseif(arg MATCHES "^-x?platform$") - list(POP_FRONT configure_args mkspec) - push("-DQT_QMAKE_TARGET_MKSPEC=${mkspec}") - elseif(arg STREQUAL "-device") - list(POP_FRONT configure_args mkspec) - push("-DQT_QMAKE_TARGET_MKSPEC=devices/${mkspec}") - elseif(arg STREQUAL "-device-option") - list(POP_FRONT configure_args opt) - list(APPEND device_options "${opt}") - elseif(arg STREQUAL "-qtnamespace") - list(POP_FRONT configure_args namespace) - push("-DQT_NAMESPACE=${namespace}") - elseif(arg STREQUAL "-c++std") - list(POP_FRONT configure_args edition) - string(REGEX REPLACE "^c\\+\\+" "" edition "${edition}") - push("-DCMAKE_CXX_STANDARD=${edition}") - elseif(arg STREQUAL "-rpath") - pop_path_argument() - list(APPEND extra_rpaths "${path}") elseif(arg STREQUAL "--") # Everything after this argument will be passed to CMake verbatim. push(${configure_args}) break() else() - message(FATAL_ERROR "Unknown configure argument: ${arg}") + set_property(GLOBAL APPEND PROPERTY UNHANDLED_ARGS "${arg}") endif() endwhile() -if(force_debug_info) +if(NOT commandline_files) + set(commandline_files "${qtbase_source_dir}/${commandline_filename}") +endif() + + +#################################################################################################### +# Define functions/macros that are called in configure.cmake files +# +# Every function that's called in a configure.cmake file must be defined here. +# Most are empty stubs. +#################################################################################################### + +set_property(GLOBAL PROPERTY COMMANDLINE_KNOWN_FEATURES "") + +function(qt_feature feature) + set_property(GLOBAL APPEND PROPERTY COMMANDLINE_KNOWN_FEATURES "${feature}") +endfunction() + +macro(defstub name) + function(${name}) + endfunction() +endmacro() + +defstub(qt_add_qmake_lib_dependency) +defstub(qt_config_compile_test) +defstub(qt_config_compile_test_machine_tuple) +defstub(qt_config_compile_test_x86simd) +defstub(qt_configure_add_report_entry) +defstub(qt_configure_add_summary_build_mode) +defstub(qt_configure_add_summary_build_parts) +defstub(qt_configure_add_summary_build_type_and_config) +defstub(qt_configure_add_summary_entry) +defstub(qt_configure_add_summary_section) +defstub(qt_configure_end_summary_section) +defstub(qt_extra_definition) +defstub(qt_feature_config) +defstub(qt_feature_definition) +defstub(qt_find_package) +defstub(set_package_properties) + + +#################################################################################################### +# Define functions/macros that are called in qt_cmdline.cmake files +#################################################################################################### + +unset(commandline_custom_handlers) +set(commandline_nr_of_prefixes 0) +set(commandline_nr_of_assignments 0) + +macro(qt_commandline_subconfig subconfig) + list(APPEND commandline_subconfigs "${subconfig}") +endmacro() + +macro(qt_commandline_custom handler) + list(APPEND commandline_custom_handlers ${handler}) +endmacro() + +function(qt_commandline_option name) + set(options) + set(oneValueArgs TYPE NAME VALUE) + set(multiValueArgs VALUES MAPPING) + cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set(commandline_option_${name} "${arg_TYPE}" PARENT_SCOPE) + if(NOT "${arg_NAME}" STREQUAL "") + set(commandline_option_${name}_variable "${arg_NAME}" PARENT_SCOPE) + endif() + if(NOT "${arg_VALUE}" STREQUAL "") + set(commandline_option_${name}_value "${arg_VALUE}" PARENT_SCOPE) + endif() + if(arg_VALUES) + set(commandline_option_${name}_values ${arg_VALUES} PARENT_SCOPE) + elseif(arg_MAPPING) + set(commandline_option_${name}_mapping ${arg_MAPPING} PARENT_SCOPE) + endif() +endfunction() + +function(qt_commandline_prefix arg var) + set(idx ${commandline_nr_of_prefixes}) + set(commandline_prefix_${idx} "${arg}" "${var}" PARENT_SCOPE) + math(EXPR n "${commandline_nr_of_prefixes} + 1") + set(commandline_nr_of_prefixes ${n} PARENT_SCOPE) +endfunction() + +function(qt_commandline_assignment var internal_var) + set(idx ${commandline_nr_of_assignments}) + set(commandline_assignment_${idx} "${var}" "${internal_var}" PARENT_SCOPE) + math(EXPR n "${commandline_nr_of_assignments} + 1") + set(commandline_nr_of_assignments ${n} PARENT_SCOPE) +endfunction() + + +#################################################################################################### +# Load qt_cmdline.cmake files +#################################################################################################### + +while(commandline_files) + list(POP_FRONT commandline_files commandline_file) + get_filename_component(commandline_file_directory "${commandline_file}" DIRECTORY) + set(configure_file "${commandline_file_directory}/${configure_filename}") + unset(commandline_subconfigs) + include(${configure_file}) + include(${commandline_file}) + + if(commandline_subconfigs) + list(TRANSFORM commandline_subconfigs PREPEND "${commandline_file_directory}/") + list(TRANSFORM commandline_subconfigs APPEND "/${commandline_filename}") + list(PREPEND commandline_files "${commandline_subconfigs}") + endif() +endwhile() + +get_property(commandline_known_features GLOBAL PROPERTY COMMANDLINE_KNOWN_FEATURES) + +#################################################################################################### +# Process the data from the qt_cmdline.cmake files +#################################################################################################### + +function(qtConfAddNote msg) + message(WARNING "${msg}") +endfunction() + +function(qtConfAddError msg) + message(FATAL_ERROR "${msg}") +endfunction() + +set_property(GLOBAL PROPERTY CONFIG_INPUTS "") + +function(qtConfCommandlineSetInput name val) + if(NOT "${commandline_option_${name}_variable}" STREQUAL "") + set(name "${commandline_option_${name}_variable}") + endif() + if(NOT "${INPUT_${name}}" STREQUAL "") + set(oldval "${INPUT_${name}}") + if("${oldval}" STREQUAL "${val}") + qtConfAddNote("Option '${name}' with value '${val}' was specified twice") + else() + qtConfAddNote("Overriding option '${name}' with '${val}' (was: '${oldval}')") + endif() + endif() + + set_property(GLOBAL PROPERTY INPUT_${name} "${val}") + set_property(GLOBAL APPEND PROPERTY CONFIG_INPUTS ${name}) +endfunction() + +function(qtConfValidateValue opt val out_var) + set(${out_var} TRUE PARENT_SCOPE) + + set(valid_values ${commandline_option_${arg}_values}) + list(LENGTH valid_values n) + if(n EQUAL 0) + return() + endif() + + foreach(v ${valid_values}) + if(val STREQUAL v) + return() + endif() + endforeach() + + set(${out_var} FALSE PARENT_SCOPE) + qtConfAddError("Invalid value '${val}' supplied to command line option '${opt}'.") +endfunction() + +function(qt_commandline_mapped_enum_value opt key out_var) + unset(result) + set(mapping ${commandline_option_${opt}_mapping}) + while(mapping) + list(POP_FRONT mapping mapping_key) + list(POP_FRONT mapping mapping_value) + if(mapping_key STREQUAL key) + set(result "${mapping_value}") + break() + endif() + endwhile() + set(${out_var} "${result}" PARENT_SCOPE) +endfunction() + +function(qtConfHasNextCommandlineArg out_var) + get_property(args GLOBAL PROPERTY UNHANDLED_ARGS) + list(LENGTH args n) + if(n GREATER 0) + set(result TRUE) + else() + set(result FALSE) + endif() + set(${out_var} ${result} PARENT_SCOPE) +endfunction() + +function(qtConfPeekNextCommandlineArg out_var) + get_property(args GLOBAL PROPERTY UNHANDLED_ARGS) + list(GET args 0 result) + set(${out_var} ${result} PARENT_SCOPE) +endfunction() + +function(qtConfGetNextCommandlineArg out_var) + get_property(args GLOBAL PROPERTY UNHANDLED_ARGS) + list(POP_FRONT args result) + set_property(GLOBAL PROPERTY UNHANDLED_ARGS ${args}) + set(${out_var} ${result} PARENT_SCOPE) +endfunction() + +function(qt_commandline_boolean arg val nextok) + if("${val}" STREQUAL "") + set(val "yes") + endif() + if(NOT val STREQUAL "yes" AND NOT val STREQUAL "no") + message(FATAL_ERROR "Invalid value '${val}' given for boolean command line option '${arg}'.") + endif() + qtConfCommandlineSetInput("${arg}" "${val}") +endfunction() + +function(qt_commandline_string arg val nextok) + if(nextok) + qtConfGetNextCommandlineArg(val) + if("${val}" MATCHES "^-") + qtConfAddError("No value supplied to command line options '${opt}'.") + endif() + endif() + qtConfValidateValue("${opt}" "${val}" success) + if(success) + qtConfCommandlineSetInput("${opt}" "${val}") + endif() +endfunction() + +function(qt_commandline_optionalString arg val nextok) + if("${val}" STREQUAL "") + if(nextok) + qtConfPeekNextCommandlineArg(val) + endif() + if(val MATCHES "^-.*|[A-Z0-9_+]=.*" OR val STREQUAL "") + set(val "yes") + else() + qtConfGetNextCommandlineArg(val) + endif() + endif() + qtConfValidateValue("${arg}" "${val}" success) + if(success) + qtConfCommandlineSetInput("${arg}" "${val}") + endif() +endfunction() + +function(qt_commandline_addString arg val nextok) + if("${val}" STREQUAL "" AND nextok) + qtConfGetNextCommandlineArg(val) + endif() + if(val MATCHES "^-.*" OR val STREQUAL "") + qtConfAddError("No value supplied to command line option '${arg}'.") + endif() + qtConfValidateValue("${arg}" "${val}" success) + if(success) + if(DEFINED command_line_option_${arg}_variable) + set(opt ${command_line_option_${arg}_variable) + endif() + set_property(GLOBAL APPEND PROPERTY "INPUT_${arg}" "${val}") + set_property(GLOBAL APPEND PROPERTY CONFIG_INPUTS ${arg}) + endif() +endfunction() + +function(qt_commandline_enum arg val nextok) + if("${val}" STREQUAL "") + set(val "yes") + endif() + unset(mapped) + if(DEFINED "commandline_option_${arg}_mapping") + qt_commandline_mapped_enum_value("${arg}" "${val}" mapped) + elseif(DEFINED "commandline_option_${arg}_values") + if(val IN_LIST commandline_option_${arg}_values) + set(mapped ${val}) + endif() + endif() + if("${mapped}" STREQUAL "") + qtConfAddError("Invalid value '${val}' supplied to command line option '${arg}'.") + endif() + qtConfCommandlineSetInput("${arg}" "${mapped}") +endfunction() + +function(qt_commandline_void arg val nextok) + if(NOT "${val}" STREQUAL "") + qtConfAddError("Command line option '${arg}' expects no argument ('${val}' given).") + endif() + if(DEFINED commandline_option_${arg}_value) + set(val ${commandline_option_${arg}_value}) + endif() + if("${val}" STREQUAL "") + set(val yes) + endif() + qtConfCommandlineSetInput("${arg}" "${val}") +endfunction() + +function(qt_call_function func) + set(call_code "${func}(") + math(EXPR n "${ARGC} - 1") + foreach(i RANGE 1 ${n}) + string(APPEND call_code "\"${ARGV${i}}\" ") + endforeach() + string(APPEND call_code ")") + if(${CMAKE_VERSION} VERSION_LESS "3.18.0") + set(incfile qt_tmp_func_call.cmake) + file(WRITE "${incfile}" "${call_code}") + include(${incfile}) + file(REMOVE "${incfile}") + else() + cmake_language(EVAL CODE "${call_code}") + endif() +endfunction() + +while(1) + qtConfHasNextCommandlineArg(has_next) + if(NOT has_next) + break() + endif() + qtConfGetNextCommandlineArg(arg) + + set(handled FALSE) + foreach(func ${commandline_custom_handlers}) + qt_call_function("qt_commandline_${func}" handled "${arg}") + if(handled) + break() + endif() + endforeach() + if(handled) + continue() + endif() + + if(arg MATCHES "^([A-Z0-9_]+)=(.*)") + set(lhs "${CMAKE_MATCH_1}") + set(rhs "${CMAKE_MATCH_2}") + math(EXPR n "${commandline_nr_of_assignments} - 1") + foreach(i RANGE ${n}) + list(GET commandline_assignment_${i} 0 var) + list(GET commandline_assignment_${i} 1 internal_var) + if(lhs STREQUAL var) + set(handled TRUE) + qtConfCommandlineSetInput("${internal_var}" "${rhs}") + break() + endif() + endforeach() + if(NOT handled) + message(FATAL_ERROR "Assigning unknown variable '${lhs}' on command line.") + endif() + endif() + if(handled) + continue() + endif() + + # parse out opt and val + set(nextok FALSE) + if(arg MATCHES "^--?enable-(.*)") + set(opt "${CMAKE_MATCH_1}") + set(val "yes") + elseif(arg MATCHES "^--?(disable|no)-(.*)") + set(opt "${CMAKE_MATCH_2}") + set(val "no") + elseif(arg MATCHES "^--([^=]+)=(.*)") + set(opt "${CMAKE_MATCH_1}") + set(val "${CMAKE_MATCH_2}") + elseif(arg MATCHES "^--(.*)") + set(opt "${CMAKE_MATCH_1}") + unset(val) + elseif(arg MATCHES "^-(.*)") + set(nextok TRUE) + set(opt "${CMAKE_MATCH_1}") + unset(val) + if(NOT DEFINED commandline_option_${opt} AND opt MATCHES "(qt|system)-(.*)") + set(opt "${CMAKE_MATCH_2}") + set(val "${CMAKE_MATCH_1}") + message("opt: ${opt} val: ${val}") + endif() + else() + qtConfAddError("Invalid command line parameter '${arg}'.") + endif() + + set(type ${commandline_option_${opt}}) + if("${type}" STREQUAL "") + # No match in the regular options, try matching the prefixes + math(EXPR n "${commandline_nr_of_prefixes} - 1") + foreach(i RANGE ${n}) + list(GET commandline_prefix_${i} 0 pfx) + if(arg MATCHES "^-${pfx}(.*)") + list(GET commandline_prefix_${i} 1 opt) + set(val "${CMAKE_MATCH_1}") + set(type addString) + break() + endif() + endforeach() + endif() + + # Handle builtin [-no]-feature-xxx + if("${type}" STREQUAL "" AND opt MATCHES "^feature-(.*)") + set(opt "${CMAKE_MATCH_1}") + if(NOT opt IN_LIST commandline_known_features) + qtConfAddError("Enabling/Disabling unknown feature '${opt}'.") + endif() + set(type boolean) + endif() + + if("${type}" STREQUAL "") + qtConfAddError("Unknown command line option '${arg}'.") + endif() + + if(NOT COMMAND "qt_commandline_${type}") + qtConfAddError("Unknown type '${type}' for command line option '${opt}'.") + endif() + qt_call_function("qt_commandline_${type}" "${opt}" "${val}" "${nextok}") +endwhile() + +#################################################################################################### +# Translate some of the INPUT_xxx values to CMake arguments +#################################################################################################### + +# Turn the global properties into proper variables +get_property(config_inputs GLOBAL PROPERTY CONFIG_INPUTS) +list(REMOVE_DUPLICATES config_inputs) +foreach(var ${config_inputs}) + get_property(INPUT_${var} GLOBAL PROPERTY INPUT_${var}) +endforeach() + +macro(drop_input name) + list(REMOVE_ITEM config_inputs ${name}) +endmacro() + +macro(translate_boolean_input name cmake_var) + if("${INPUT_${name}}" STREQUAL "yes") + push("-D${cmake_var}=ON") + drop_input(${name}) + elseif("${INPUT_${name}}" STREQUAL "no") + push("-D${cmake_var}=OFF") + drop_input(${name}) + endif() +endmacro() + +macro(translate_string_input name cmake_var) + if(DEFINED INPUT_${name}) + push("-D${cmake_var}=${INPUT_${name}}") + drop_input(${name}) + endif() +endmacro() + +macro(translate_path_input name cmake_var) + if(DEFINED INPUT_${name}) + set(path "${INPUT_${name}}") + string(REGEX REPLACE "^\"(.*)\"$" "\\1" path "${path}") + file(TO_CMAKE_PATH "${path}" path) + push("-D${cmake_var}=${path}") + drop_input(${name}) + endif() +endmacro() + +foreach(feature ${commandline_known_features}) + qt_feature_normalize_name("${feature}" cmake_feature) + translate_boolean_input(${feature} FEATURE_${cmake_feature}) +endforeach() + +translate_boolean_input(precompile_header BUILD_WITH_PCH) +translate_boolean_input(ccache QT_USE_CCACHE) +translate_boolean_input(shared BUILD_SHARED_LIBS) +translate_string_input(qt_namespace QT_NAMESPACE) +translate_path_input(prefix CMAKE_INSTALL_PREFIX) +translate_path_input(extprefix CMAKE_STAGING_PREFIX) +foreach(kind bin lib archdata libexec qml data doc translation sysconf examples tests) + string(TOUPPER ${kind} uc_kind) + translate_path_input(${kind}dir INSTALL_${uc_kind}DIR) +endforeach() +translate_path_input(headerdir INSTALL_INCLUDEDIR) +translate_path_input(plugindir INSTALL_PLUGINSDIR) + +if(NOT "${INPUT_device}" STREQUAL "") + push("-DQT_QMAKE_TARGET_MKSPEC=devices/${INPUT_device}") + drop_input(device) +endif() +translate_string_input(platform QT_QMAKE_TARGET_MKSPEC) +translate_string_input(xplatform QT_QMAKE_TARGET_MKSPEC) + +drop_input(make) +drop_input(nomake) +set(build_parts libs tests examples tools ${INPUT_make}) +list(REMOVE_DUPLICATES build_parts) +foreach(part ${INPUT_nomake}) + list(REMOVE_ITEM build_parts ${part}) +endforeach() +if("tests" IN_LIST build_parts) + push("-DBUILD_TESTING=ON") +else() + push("-DBUILD_TESTING=OFF") +endif() +if("examples" IN_LIST build_parts) + push("-DBUILD_EXAMPLES=ON") +else() + push("-DBUILD_EXAMPLES=OFF") +endif() +if(NOT "tools" IN_LIST build_parts) + qtConfAddWarning("'-nomake tools' is not implemented yet.") +endif() + +drop_input(debug) +drop_input(release) +drop_input(debug_and_release) +drop_input(force_debug_info) +unset(build_configs) +if(INPUT_debug) + set(build_configs Debug) +elseif("${INPUT_debug}" STREQUAL "no") + set(build_configs Release) +elseif(INPUT_debug_and_release) + set(build_configs Debug Release) +endif() +if(INPUT_force_debug_info) list(TRANSFORM build_configs REPLACE "^Release$" "RelWithDebInfo") endif() @@ -166,18 +590,24 @@ elseif(nr_of_build_configs GREATER 1) list(APPEND cmake_args "-DCMAKE_CONFIGURATION_TYPES=${escaped_build_configs}") endif() -if(device_options) +drop_input(device-option) +if(INPUT_device-option) unset(escaped_device_options) - list(JOIN device_options "\\;" escaped_device_options) + list(JOIN INPUT_device-option "\\;" escaped_device_options) list(APPEND cmake_args "-DQT_QMAKE_DEVICE_OPTIONS=${escaped_device_options}") endif() -if(extra_rpaths) +drop_input(rpaths) +if(INPUT_rpaths) unset(escaped_paths) - list(JOIN extra_rpaths "\\;" escaped_paths) + list(JOIN INPUT_rpaths "\\;" escaped_paths) list(APPEND cmake_args "-DQT_EXTRA_RPATHS=${escaped_paths}") endif() +foreach(input ${config_inputs}) + push("-DINPUT_${input}=${INPUT_${input}}") +endforeach() + if(NOT generator AND auto_detect_generator) find_program(ninja ninja) if(ninja) diff --git a/qt_cmdline.cmake b/qt_cmdline.cmake new file mode 100644 index 0000000000..57f63bded7 --- /dev/null +++ b/qt_cmdline.cmake @@ -0,0 +1,192 @@ +qt_commandline_subconfig(src/corelib) +qt_commandline_subconfig(src/network) +qt_commandline_subconfig(src/gui) +qt_commandline_subconfig(src/sql) +qt_commandline_subconfig(src/xml) +qt_commandline_subconfig(src/widgets) +qt_commandline_subconfig(src/printsupport) +qt_commandline_subconfig(src/plugins/sqldrivers) +qt_commandline_subconfig(src/testlib) +qt_commandline_custom(qmakeArgs) +qt_commandline_option(prefix TYPE string) +qt_commandline_option(hostprefix TYPE optionalString) +qt_commandline_option(extprefix TYPE string) +qt_commandline_option(archdatadir TYPE string) +qt_commandline_option(bindir TYPE string) +qt_commandline_option(datadir TYPE string) +qt_commandline_option(docdir TYPE string) +qt_commandline_option(examplesdir TYPE string) +qt_commandline_option(external-hostbindir TYPE string) +qt_commandline_option(headerdir TYPE string) +qt_commandline_option(hostbindir TYPE string) +qt_commandline_option(hostdatadir TYPE string) +qt_commandline_option(hostlibdir TYPE string) +qt_commandline_option(libdir TYPE string) +qt_commandline_option(libexecdir TYPE string) +qt_commandline_option(plugindir TYPE string) +qt_commandline_option(qmldir TYPE string) +qt_commandline_option(settingsdir TYPE string NAME sysconfdir) +qt_commandline_option(sysconfdir TYPE string) +qt_commandline_option(testsdir TYPE string) +qt_commandline_option(translationdir TYPE string) +qt_commandline_option(android-arch TYPE string) +qt_commandline_option(android-abis TYPE string) +qt_commandline_option(android-ndk TYPE string) +qt_commandline_option(android-ndk-host TYPE string) +qt_commandline_option(android-ndk-platform TYPE string) +qt_commandline_option(android-sdk TYPE string) +qt_commandline_option(android-style-assets TYPE boolean) +qt_commandline_option(appstore-compliant TYPE boolean) +qt_commandline_option(avx TYPE boolean) +qt_commandline_option(avx2 TYPE boolean) +qt_commandline_option(avx512 TYPE boolean NAME avx512f) +qt_commandline_option(c++std TYPE cxxstd) +qt_commandline_option(ccache TYPE boolean NAME ccache) +qt_commandline_option(commercial TYPE void) +qt_commandline_option(compile-examples TYPE boolean NAME compile_examples) +qt_commandline_option(confirm-license TYPE void) +qt_commandline_option(coverage TYPE coverage) +qt_commandline_option(dbus TYPE optionalString VALUES no yes linked runtime) +qt_commandline_option(dbus-linked TYPE void NAME dbus VALUE linked) +qt_commandline_option(dbus-runtime TYPE void NAME dbus VALUE runtime) +qt_commandline_option(debug TYPE void) +qt_commandline_option(debug-and-release TYPE boolean NAME debug_and_release) +qt_commandline_option(developer-build TYPE void) +qt_commandline_option(device TYPE string) +qt_commandline_option(device-option TYPE addString) +qt_commandline_option(f16c TYPE boolean) +qt_commandline_option(force-asserts TYPE boolean NAME force_asserts) +qt_commandline_option(force-debug-info TYPE boolean NAME force_debug_info) +qt_commandline_option(force-pkg-config TYPE void NAME pkg-config) +qt_commandline_option(framework TYPE boolean) +qt_commandline_option(gc-binaries TYPE boolean NAME gc_binaries) +qt_commandline_option(gdb-index TYPE boolean NAME enable_gdb_index) +qt_commandline_option(gcc-sysroot TYPE boolean) +qt_commandline_option(gcov TYPE boolean) +qt_commandline_option(gnumake TYPE boolean NAME GNUmake) +qt_commandline_option(gui TYPE boolean) +qt_commandline_option(headersclean TYPE boolean) +qt_commandline_option(incredibuild-xge TYPE boolean NAME incredibuild_xge) +qt_commandline_option(libudev TYPE boolean) +qt_commandline_option(linker TYPE optionalString VALUES bfd gold lld) +qt_commandline_option(ltcg TYPE boolean) +qt_commandline_option(make TYPE addString VALUES examples libs tests tools) +qt_commandline_option(make-tool TYPE string) +qt_commandline_option(mips_dsp TYPE boolean) +qt_commandline_option(mips_dspr2 TYPE boolean) +qt_commandline_option(mp TYPE boolean NAME msvc_mp) +qt_commandline_option(nomake TYPE addString VALUES examples tests tools) +qt_commandline_option(opensource TYPE void NAME commercial VALUE no) +qt_commandline_option(optimize-debug TYPE boolean NAME optimize_debug) +qt_commandline_option(optimize-size TYPE boolean NAME optimize_size) +qt_commandline_option(optimized-qmake TYPE boolean NAME release_tools) +qt_commandline_option(optimized-tools TYPE boolean NAME release_tools) +qt_commandline_option(pch TYPE boolean NAME precompile_header) +qt_commandline_option(pkg-config TYPE boolean) +qt_commandline_option(platform TYPE string) +qt_commandline_option(plugin-manifests TYPE boolean) +qt_commandline_option(profile TYPE boolean) +qt_commandline_option(qreal TYPE string) +qt_commandline_option(qtlibinfix TYPE string NAME qt_libinfix) +qt_commandline_option(qtnamespace TYPE string NAME qt_namespace) +qt_commandline_option(reduce-exports TYPE boolean NAME reduce_exports) +qt_commandline_option(reduce-relocations TYPE boolean NAME reduce_relocations) +qt_commandline_option(release TYPE enum NAME debug MAPPING yes no no yes) +qt_commandline_option(rpath TYPE boolean) +qt_commandline_option(sanitize TYPE sanitize) +qt_commandline_option(sdk TYPE string) +qt_commandline_option(separate-debug-info TYPE boolean NAME separate_debug_info) +qt_commandline_option(shared TYPE boolean) +qt_commandline_option(silent TYPE void) +qt_commandline_option(qdbus TYPE boolean NAME dbus) +qt_commandline_option(sse2 TYPE boolean) +qt_commandline_option(sse3 TYPE boolean) +qt_commandline_option(sse4.1 TYPE boolean NAME sse4_1) +qt_commandline_option(sse4.2 TYPE boolean NAME sse4_2) +qt_commandline_option(ssse3 TYPE boolean) +qt_commandline_option(static TYPE enum NAME shared MAPPING yes no no yes) +qt_commandline_option(static-runtime TYPE boolean NAME static_runtime) +qt_commandline_option(strip TYPE boolean) +qt_commandline_option(syncqt TYPE boolean) +qt_commandline_option(sysroot TYPE string) +qt_commandline_option(testcocoon TYPE boolean) +qt_commandline_option(use-gold-linker TYPE boolean NAME use_gold_linker_alias) +qt_commandline_option(warnings-are-errors TYPE boolean NAME warnings_are_errors) +qt_commandline_option(Werror TYPE boolean NAME warnings_are_errors) +qt_commandline_option(widgets TYPE boolean) +qt_commandline_option(xplatform TYPE string) +qt_commandline_option(zlib TYPE enum NAME system-zlib MAPPING system yes qt no) +qt_commandline_option(zstd TYPE boolean) +qt_commandline_prefix(D defines) +qt_commandline_prefix(F fpaths) +qt_commandline_prefix(I includes) +qt_commandline_prefix(L lpaths) +qt_commandline_prefix(R rpaths) +qt_commandline_prefix(W wflags) +qt_commandline_assignment(DBUS_HOST_PATH host_dbus.prefix) +qt_commandline_assignment(DBUS_PATH dbus.prefix) + +# special case begin +function(qt_commandline_qmakeArgs out_var arg) + if(arg MATCHES "^QMAKE_[A-Z0-9_]+ *[-+]?=.*") + message(FATAL_ERROR + "${arg} is not a valid configure argument. " + "Assignments to QMake variables are not supported. " + "Consider passing the equivalent CMake argument via " + "'configure ... -- -DCMAKE_VARIABLE=VALUE'") + endif() + set(${out_var} FALSE PARENT_SCOPE) +endfunction() + +function(qt_commandline_cxxstd arg val nextok) + if("${val}" STREQUAL "") + qtConfGetNextCommandlineArg(val) + endif() + if("${val}" STREQUAL "" OR val MATCHES "^-.*") + qtConfAddError("Missing argument to command line parameter '${arg}'.") + return() + endif() + if(val MATCHES "(c\\+\\+)?11") + qtConfCommandlineSetInput(c++14 no) + qtConfCommandlineSetInput(c++1z no) + qtConfCommandlineSetInput(c++2a no) + elseif(val MATCHES "(c\\+\\+)?(14|1y)") + qtConfCommandlineSetInput(c++14 yes) + qtConfCommandlineSetInput(c++1z no) + qtConfCommandlineSetInput(c++2a no) + elseif(val MATCHES "(c\\+\\+)?(17|1z)") + qtConfCommandlineSetInput(c++14 yes) + qtConfCommandlineSetInput(c++1z yes) + qtConfCommandlineSetInput(c++2a no) + elseif(val MATCHES "(c\\+\\+)?2a") + qtConfCommandlineSetInput(c++14 yes) + qtConfCommandlineSetInput(c++1z yes) + qtConfCommandlineSetInput(c++2a yes) + else() + qtConfAddError("Invalid argument '${val}' to command line parameter '${arg}'") + endif() +endfunction() + +function(qt_commandline_sanitize arg val nextok) + if("${val}" STREQUAL "") + qtConfGetNextCommandlineArg(val) + endif() + if("${val}" STREQUAL "" OR val MATCHES "^-.*") + qtConfAddError("Missing argument to command line parameter '${arg}'.") + return() + endif() + if(val STREQUAL "address") + qtConfCommandlineSetInput(sanitize_address yes) + elseif(val STREQUAL "thread") + qtConfCommandlineSetInput(sanitize_thread yes) + elseif(val STREQUAL "memory") + qtConfCommandlineSetInput(sanitize_memory yes) + elseif(val STREQUAL "fuzzer-no-link") + qtConfCommandlineSetInput(sanitize_fuzzer_no_link yes) + elseif(val STREQUAL "undefined") + qtConfCommandlineSetInput(sanitize_undefined yes) + else() + qtConfAddError("Invalid argument '${val}' to command line parameter '${arg}'") + endif() +endfunction() +# special case end diff --git a/src/corelib/qt_cmdline.cmake b/src/corelib/qt_cmdline.cmake new file mode 100644 index 0000000000..b38039f61f --- /dev/null +++ b/src/corelib/qt_cmdline.cmake @@ -0,0 +1,14 @@ +qt_commandline_option(doubleconversion TYPE enum VALUES no qt system) +qt_commandline_option(eventfd TYPE boolean) +qt_commandline_option(glib TYPE boolean) +qt_commandline_option(icu TYPE boolean) +qt_commandline_option(inotify TYPE boolean) +qt_commandline_option(journald TYPE boolean) +qt_commandline_option(libb2 TYPE enum VALUES no qt system) +qt_commandline_option(mimetype-database TYPE boolean) +qt_commandline_option(pcre TYPE enum VALUES no qt system) +qt_commandline_option(posix-ipc TYPE boolean NAME ipc_posix) +qt_commandline_option(pps TYPE boolean NAME qqnx_pps) +qt_commandline_option(slog2 TYPE boolean) +qt_commandline_option(syslog TYPE boolean) +qt_commandline_option(trace TYPE optionalString VALUES etw lttng no yes) diff --git a/src/gui/qt_cmdline.cmake b/src/gui/qt_cmdline.cmake new file mode 100644 index 0000000000..cf8561eef8 --- /dev/null +++ b/src/gui/qt_cmdline.cmake @@ -0,0 +1,36 @@ +qt_commandline_option(accessibility TYPE boolean) +qt_commandline_option(direct2d TYPE boolean) +qt_commandline_option(directfb TYPE boolean) +qt_commandline_option(directwrite TYPE boolean) +qt_commandline_option(egl TYPE boolean) +qt_commandline_option(eglfs TYPE boolean) +qt_commandline_option(evdev TYPE boolean) +qt_commandline_option(fontconfig TYPE boolean) +qt_commandline_option(freetype TYPE enum VALUES no qt system) +qt_commandline_option(gbm TYPE boolean) +qt_commandline_option(gif TYPE boolean) +qt_commandline_option(harfbuzz TYPE enum VALUES no qt system) +qt_commandline_option(ico TYPE boolean) +qt_commandline_option(imf TYPE boolean NAME qqnx_imf) +qt_commandline_option(kms TYPE boolean) +qt_commandline_option(lgmon TYPE boolean) +qt_commandline_option(libinput TYPE boolean) +qt_commandline_option(libjpeg TYPE enum VALUES no qt system) +qt_commandline_option(libmd4c TYPE enum VALUES no qt system) +qt_commandline_option(libpng TYPE enum VALUES no qt system) +qt_commandline_option(linuxfb TYPE boolean) +qt_commandline_option(mtdev TYPE boolean) +qt_commandline_option(opengl TYPE optionalString VALUES no yes desktop es2 dynamic) +qt_commandline_option(opengl-es-2 TYPE void NAME opengl VALUE es2) +qt_commandline_option(opengles3 TYPE boolean) +qt_commandline_option(openvg TYPE boolean) +qt_commandline_option(qpa TYPE string NAME qpa_default_platform) +qt_commandline_option(qpa-platform-guard TYPE boolean) +qt_commandline_option(sm TYPE boolean NAME sessionmanager) +qt_commandline_option(tslib TYPE boolean) +qt_commandline_option(vulkan TYPE boolean) +qt_commandline_option(xcb TYPE boolean) +qt_commandline_option(bundled-xcb-xinput TYPE boolean) +qt_commandline_option(xcb-native-painting TYPE boolean) +qt_commandline_option(xcb-xlib TYPE boolean) +qt_commandline_option(xkbcommon TYPE boolean) diff --git a/src/network/qt_cmdline.cmake b/src/network/qt_cmdline.cmake new file mode 100644 index 0000000000..0a24507788 --- /dev/null +++ b/src/network/qt_cmdline.cmake @@ -0,0 +1,12 @@ +qt_commandline_option(libproxy TYPE boolean) +qt_commandline_option(openssl TYPE optionalString VALUES no yes linked runtime) +qt_commandline_option(openssl-linked TYPE void NAME openssl VALUE linked) +qt_commandline_option(openssl-runtime TYPE void NAME openssl VALUE runtime) +qt_commandline_option(dtls TYPE boolean) +qt_commandline_option(ocsp TYPE boolean) +qt_commandline_option(sctp TYPE boolean) +qt_commandline_option(securetransport TYPE boolean) +qt_commandline_option(schannel TYPE boolean) +qt_commandline_option(ssl TYPE boolean) +qt_commandline_option(system-proxies TYPE boolean) +qt_commandline_assignment(OPENSSL_PATH openssl.prefix) diff --git a/src/plugins/sqldrivers/qt_cmdline.cmake b/src/plugins/sqldrivers/qt_cmdline.cmake new file mode 100644 index 0000000000..91b6f9f767 --- /dev/null +++ b/src/plugins/sqldrivers/qt_cmdline.cmake @@ -0,0 +1,18 @@ +qt_commandline_option(mysql_config TYPE string) +qt_commandline_option(psql_config TYPE string) +qt_commandline_option(sqlite TYPE enum NAME system-sqlite MAPPING qt no system yes) +qt_commandline_option(sql-db2 TYPE boolean) +qt_commandline_option(sql-ibase TYPE boolean) +qt_commandline_option(sql-mysql TYPE boolean) +qt_commandline_option(sql-oci TYPE boolean) +qt_commandline_option(sql-odbc TYPE boolean) +qt_commandline_option(sql-psql TYPE boolean) +qt_commandline_option(sql-sqlite TYPE boolean) +qt_commandline_option(plugin-sql-db2 TYPE void NAME sql-db2) +qt_commandline_option(plugin-sql-ibase TYPE void NAME sql-ibase) +qt_commandline_option(plugin-sql-mysql TYPE void NAME sql-mysql) +qt_commandline_option(plugin-sql-oci TYPE void NAME sql-oci) +qt_commandline_option(plugin-sql-odbc TYPE void NAME sql-odbc) +qt_commandline_option(plugin-sql-psql TYPE void NAME sql-psql) +qt_commandline_option(plugin-sql-sqlite TYPE void NAME sql-sqlite) +qt_commandline_assignment(MYSQL_PATH mysql.prefix) diff --git a/src/printsupport/qt_cmdline.cmake b/src/printsupport/qt_cmdline.cmake new file mode 100644 index 0000000000..dfbe5febe4 --- /dev/null +++ b/src/printsupport/qt_cmdline.cmake @@ -0,0 +1 @@ +qt_commandline_option(cups TYPE boolean) diff --git a/src/sql/qt_cmdline.cmake b/src/sql/qt_cmdline.cmake new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/testlib/qt_cmdline.cmake b/src/testlib/qt_cmdline.cmake new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/widgets/qt_cmdline.cmake b/src/widgets/qt_cmdline.cmake new file mode 100644 index 0000000000..4cfcbc90a4 --- /dev/null +++ b/src/widgets/qt_cmdline.cmake @@ -0,0 +1,6 @@ +qt_commandline_option(gtk TYPE boolean NAME gtk3) +qt_commandline_option(style-windows TYPE boolean) +qt_commandline_option(style-windowsvista TYPE boolean) +qt_commandline_option(style-fusion TYPE boolean) +qt_commandline_option(style-mac TYPE boolean) +qt_commandline_option(style-android TYPE boolean) diff --git a/src/xml/qt_cmdline.cmake b/src/xml/qt_cmdline.cmake new file mode 100644 index 0000000000..e69de29bb2 diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index d164f270f5..b3b0a9bc01 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -1284,6 +1284,64 @@ def processReportHelper(ctx, entries, cm_fh): else: print(f" XXXX UNHANDLED REPORT TYPE {entry}.") +def parseCommandLineCustomHandler(ctx, data, cm_fh): + cm_fh.write(f"qt_commandline_custom({data})\n") + +def parseCommandLineOptions(ctx, data, cm_fh): + for key in data: + args = [key] + option = data[key] + if isinstance(option, str): + args += ["TYPE", option] + else: + if "type" in option: + args += ["TYPE", option["type"]] + if "name" in option: + args += ["NAME", option["name"]] + if "value" in option: + args += ["VALUE", option["value"]] + if "values" in option: + values = option["values"] + if isinstance(values, list): + args += ["VALUES", ' '.join(option["values"])] + else: + args += ["MAPPING"] + for lhs in values: + args += [lhs, values[lhs]] + + cm_fh.write(f"qt_commandline_option({' '.join(args)})\n") + +def parseCommandLinePrefixes(ctx, data, cm_fh): + for key in data: + cm_fh.write(f"qt_commandline_prefix({key} {data[key]})\n") + +def parseCommandLineAssignments(ctx, data, cm_fh): + for key in data: + cm_fh.write(f"qt_commandline_assignment({key} {data[key]})\n") + +def processCommandLine(ctx, data, cm_fh): + print(" commandline:") + + if "subconfigs" in data: + for subconf in data["subconfigs"]: + cm_fh.write(f"qt_commandline_subconfig({subconf})\n") + + if "commandline" not in data: + return + + commandLine = data["commandline"] + if "custom" in commandLine: + print(" custom:") + parseCommandLineCustomHandler(ctx, commandLine["custom"], cm_fh) + if "options" in commandLine: + print(" options:") + parseCommandLineOptions(ctx, commandLine["options"], cm_fh) + if "prefix" in commandLine: + print(" prefix:") + parseCommandLinePrefixes(ctx, commandLine["prefix"], cm_fh) + if "assignments" in commandLine: + print(" assignments:") + parseCommandLineAssignments(ctx, commandLine["assignments"], cm_fh) def processInputs(ctx, data, cm_fh): print(" inputs:") @@ -1377,6 +1435,9 @@ def processJson(path, ctx, data): ctx = processFiles(ctx, data) + with special_cased_file(path, "qt_cmdline.cmake") as cm_fh: + processCommandLine(ctx, data, cm_fh) + with special_cased_file(path, "configure.cmake") as cm_fh: cm_fh.write("\n\n#### Inputs\n\n")