CMake: Make it possible to build tools when cross-compiling
This patch allows tools to be built for the target platform when the QT_BUILD_TOOLS_WHEN_CROSSCOMPILING parameter is set at configuration time. To avoid naming conflicts, the target tools are suffixed with "_native". The qt_get_tool_target_name() function can be used to get the tool name for both scenarios (cross and non-cross compilation). Extend pro2cmake to refer to the right target name for tools. The relevant write_XXX functions have a new target_ref parameter that will be "${target_name}" for tools and literally the target name for everything else. Fixes: QTBUG-81901 Change-Id: If4efbc1fae07a4a3a044dd09c9c06be6d517825e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
47c6466d0a
commit
5a779a4ad3
@ -1088,7 +1088,7 @@ function(qt_get_build_parts out_var)
|
|||||||
list(APPEND parts "tests")
|
list(APPEND parts "tests")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
if(NOT CMAKE_CROSSCOMPILING OR QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
list(APPEND parts "tools")
|
list(APPEND parts "tools")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -2860,10 +2860,13 @@ QMAKE_PRL_LIBS_FOR_CMAKE = ${prl_libs}
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(qt_export_tools module_name)
|
function(qt_export_tools module_name)
|
||||||
# If no tools were defined belonging to this module, don't create a config and targets file.
|
# Bail out when cross-compiling, unless QT_BUILD_TOOLS_WHEN_CROSSCOMPILING is on.
|
||||||
# Guards against the case when doing a cross-build.
|
if(CMAKE_CROSSCOMPILING AND NOT QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT "${module_name}" IN_LIST QT_KNOWN_MODULES_WITH_TOOLS OR CMAKE_CROSSCOMPILING)
|
# If no tools were defined belonging to this module, don't create a config and targets file.
|
||||||
|
if(NOT "${module_name}" IN_LIST QT_KNOWN_MODULES_WITH_TOOLS)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -2892,6 +2895,9 @@ function(qt_export_tools module_name)
|
|||||||
list(APPEND package_deps "${extra_packages}")
|
list(APPEND package_deps "${extra_packages}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
string(REGEX REPLACE "_native$" "" tool_name ${tool_name})
|
||||||
|
endif()
|
||||||
set(extra_cmake_statements "${extra_cmake_statements}
|
set(extra_cmake_statements "${extra_cmake_statements}
|
||||||
if (NOT QT_NO_CREATE_TARGETS)
|
if (NOT QT_NO_CREATE_TARGETS)
|
||||||
get_property(is_global TARGET ${INSTALL_CMAKE_NAMESPACE}::${tool_name} PROPERTY IMPORTED_GLOBAL)
|
get_property(is_global TARGET ${INSTALL_CMAKE_NAMESPACE}::${tool_name} PROPERTY IMPORTED_GLOBAL)
|
||||||
@ -3832,10 +3838,10 @@ endfunction()
|
|||||||
|
|
||||||
# Sets QT_WILL_BUILD_TOOLS if tools will be built.
|
# Sets QT_WILL_BUILD_TOOLS if tools will be built.
|
||||||
function(qt_check_if_tools_will_be_built)
|
function(qt_check_if_tools_will_be_built)
|
||||||
if(NOT CMAKE_CROSSCOMPILING AND NOT QT_FORCE_FIND_TOOLS)
|
if(QT_FORCE_FIND_TOOLS OR (CMAKE_CROSSCOMPILING AND NOT QT_BUILD_TOOLS_WHEN_CROSSCOMPILING))
|
||||||
set(will_build_tools TRUE)
|
|
||||||
else()
|
|
||||||
set(will_build_tools FALSE)
|
set(will_build_tools FALSE)
|
||||||
|
else()
|
||||||
|
set(will_build_tools TRUE)
|
||||||
endif()
|
endif()
|
||||||
set(QT_WILL_BUILD_TOOLS ${will_build_tools} CACHE INTERNAL "Are tools going to be built" FORCE)
|
set(QT_WILL_BUILD_TOOLS ${will_build_tools} CACHE INTERNAL "Are tools going to be built" FORCE)
|
||||||
endfunction()
|
endfunction()
|
||||||
@ -4114,10 +4120,40 @@ function(qt_get_main_cmake_configuration out_var)
|
|||||||
set("${out_var}" "${config}" PARENT_SCOPE)
|
set("${out_var}" "${config}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Returns the target name for the tool with the given name.
|
||||||
|
#
|
||||||
|
# In most cases, the target name is the same as the tool name.
|
||||||
|
# If the user specifies to build tools when cross-compiling, then the
|
||||||
|
# suffix "_native" is appended.
|
||||||
|
function(qt_get_tool_target_name out_var name)
|
||||||
|
if (CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
set(${out_var} ${name}_native PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${out_var} ${name} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Returns the tool name for a given tool target.
|
||||||
|
# This is the inverse of qt_get_tool_target_name.
|
||||||
|
function(qt_tool_target_to_name out_var target)
|
||||||
|
set(name ${target})
|
||||||
|
if (CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
string(REGEX REPLACE "_native$" "" name ${target})
|
||||||
|
endif()
|
||||||
|
set(${out_var} ${name} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# This function is used to define a "Qt tool", such as moc, uic or rcc.
|
# This function is used to define a "Qt tool", such as moc, uic or rcc.
|
||||||
# The BOOTSTRAP option allows building it as standalone program, otherwise
|
# The BOOTSTRAP option allows building it as standalone program, otherwise
|
||||||
# it will be linked against QtCore.
|
# it will be linked against QtCore.
|
||||||
function(qt_add_tool name)
|
#
|
||||||
|
# We must pass this function a target name obtained from
|
||||||
|
# qt_get_tool_target_name like this:
|
||||||
|
# qt_get_tool_target_name(target_name my_tool)
|
||||||
|
# qt_add_tool(${target_name})
|
||||||
|
#
|
||||||
|
function(qt_add_tool target_name)
|
||||||
|
qt_tool_target_to_name(name ${target_name})
|
||||||
qt_parse_all_arguments(arg "qt_add_tool" "BOOTSTRAP;NO_QT;NO_INSTALL"
|
qt_parse_all_arguments(arg "qt_add_tool" "BOOTSTRAP;NO_QT;NO_INSTALL"
|
||||||
"TOOLS_TARGET;${__default_target_info_args}"
|
"TOOLS_TARGET;${__default_target_info_args}"
|
||||||
"${__default_private_args}" ${ARGN})
|
"${__default_private_args}" ${ARGN})
|
||||||
@ -4130,14 +4166,24 @@ function(qt_add_tool name)
|
|||||||
" (QT_WILL_BUILD_TOOLS is ${QT_WILL_BUILD_TOOLS}).")
|
" (QT_WILL_BUILD_TOOLS is ${QT_WILL_BUILD_TOOLS}).")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING AND (name STREQUAL target_name))
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"qt_add_tool must be passed a target obtained from qt_get_tool_target_name.")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(full_name "${QT_CMAKE_EXPORT_NAMESPACE}::${name}")
|
set(full_name "${QT_CMAKE_EXPORT_NAMESPACE}::${name}")
|
||||||
|
set(imported_tool_target_found FALSE)
|
||||||
if(TARGET ${full_name})
|
if(TARGET ${full_name})
|
||||||
get_property(path TARGET ${full_name} PROPERTY LOCATION)
|
get_property(path TARGET ${full_name} PROPERTY LOCATION)
|
||||||
message(STATUS "Tool '${full_name}' was found at ${path}.")
|
message(STATUS "Tool '${full_name}' was found at ${path}.")
|
||||||
return()
|
set(imported_tool_target_found TRUE)
|
||||||
|
if(CMAKE_CROSSCOMPILING AND NOT QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(arg_TOOLS_TARGET AND NOT QT_WILL_BUILD_TOOLS)
|
if(arg_TOOLS_TARGET AND (NOT QT_WILL_BUILD_TOOLS OR QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
AND NOT imported_tool_target_found)
|
||||||
set(tools_package_name "Qt6${arg_TOOLS_TARGET}Tools")
|
set(tools_package_name "Qt6${arg_TOOLS_TARGET}Tools")
|
||||||
message(STATUS "Searching for tool '${full_name}' in package ${tools_package_name}.")
|
message(STATUS "Searching for tool '${full_name}' in package ${tools_package_name}.")
|
||||||
|
|
||||||
@ -4173,7 +4219,9 @@ function(qt_add_tool name)
|
|||||||
qt_internal_append_known_modules_with_tools("${arg_TOOLS_TARGET}")
|
qt_internal_append_known_modules_with_tools("${arg_TOOLS_TARGET}")
|
||||||
get_property(path TARGET ${full_name} PROPERTY LOCATION)
|
get_property(path TARGET ${full_name} PROPERTY LOCATION)
|
||||||
message(STATUS "${full_name} was found at ${path} using package ${tools_package_name}.")
|
message(STATUS "${full_name} was found at ${path} using package ${tools_package_name}.")
|
||||||
return()
|
if (NOT QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -4182,7 +4230,11 @@ function(qt_add_tool name)
|
|||||||
"${tools_package_name} package. "
|
"${tools_package_name} package. "
|
||||||
"Package found: ${${tools_package_name}_FOUND}")
|
"Package found: ${${tools_package_name}_FOUND}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Tool '${full_name}' will be built from source.")
|
if(QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
message(STATUS "Tool '${target_name}' will be cross-built from source.")
|
||||||
|
else()
|
||||||
|
message(STATUS "Tool '${full_name}' will be built from source.")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(disable_autogen_tools "${arg_DISABLE_AUTOGEN_TOOLS}")
|
set(disable_autogen_tools "${arg_DISABLE_AUTOGEN_TOOLS}")
|
||||||
@ -4211,7 +4263,7 @@ function(qt_add_tool name)
|
|||||||
set(no_qt NO_QT)
|
set(no_qt NO_QT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt_add_executable("${name}" OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
|
qt_add_executable("${target_name}" OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
|
||||||
${bootstrap}
|
${bootstrap}
|
||||||
${no_qt}
|
${no_qt}
|
||||||
NO_INSTALL
|
NO_INSTALL
|
||||||
@ -4231,12 +4283,19 @@ function(qt_add_tool name)
|
|||||||
TARGET_COMPANY "${arg_TARGET_COMPANY}"
|
TARGET_COMPANY "${arg_TARGET_COMPANY}"
|
||||||
TARGET_COPYRIGHT "${arg_TARGET_COPYRIGHT}"
|
TARGET_COPYRIGHT "${arg_TARGET_COPYRIGHT}"
|
||||||
)
|
)
|
||||||
qt_internal_add_target_aliases("${name}")
|
qt_internal_add_target_aliases("${target_name}")
|
||||||
|
|
||||||
|
if (NOT target_name STREQUAL name)
|
||||||
|
set_target_properties(${target_name} PROPERTIES
|
||||||
|
OUTPUT_NAME ${name}
|
||||||
|
EXPORT_NAME ${name}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# If building with a multi-config configuration, the main configuration tool will be placed in
|
# If building with a multi-config configuration, the main configuration tool will be placed in
|
||||||
# ./bin, while the rest will be in <CONFIG> specific subdirectories.
|
# ./bin, while the rest will be in <CONFIG> specific subdirectories.
|
||||||
qt_get_tool_cmake_configuration(tool_cmake_configuration)
|
qt_get_tool_cmake_configuration(tool_cmake_configuration)
|
||||||
set_target_properties("${name}" PROPERTIES
|
set_target_properties("${target_name}" PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY_${tool_cmake_configuration} "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
|
RUNTIME_OUTPUT_DIRECTORY_${tool_cmake_configuration} "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -4245,7 +4304,7 @@ function(qt_add_tool name)
|
|||||||
qt_internal_append_known_modules_with_tools("${arg_TOOLS_TARGET}")
|
qt_internal_append_known_modules_with_tools("${arg_TOOLS_TARGET}")
|
||||||
|
|
||||||
# Also append the tool to the module list.
|
# Also append the tool to the module list.
|
||||||
qt_internal_append_known_module_tool("${arg_TOOLS_TARGET}" "${name}")
|
qt_internal_append_known_module_tool("${arg_TOOLS_TARGET}" "${target_name}")
|
||||||
|
|
||||||
qt_get_cmake_configurations(cmake_configs)
|
qt_get_cmake_configurations(cmake_configs)
|
||||||
|
|
||||||
@ -4257,19 +4316,19 @@ function(qt_add_tool name)
|
|||||||
OUT_VAR install_targets_default_args
|
OUT_VAR install_targets_default_args
|
||||||
CMAKE_CONFIG "${cmake_config}"
|
CMAKE_CONFIG "${cmake_config}"
|
||||||
ALL_CMAKE_CONFIGS "${cmake_configs}")
|
ALL_CMAKE_CONFIGS "${cmake_configs}")
|
||||||
qt_install(TARGETS "${name}"
|
qt_install(TARGETS "${target_name}"
|
||||||
${install_initial_call_args}
|
${install_initial_call_args}
|
||||||
CONFIGURATIONS ${cmake_config}
|
CONFIGURATIONS ${cmake_config}
|
||||||
${install_targets_default_args})
|
${install_targets_default_args})
|
||||||
unset(install_initial_call_args)
|
unset(install_initial_call_args)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
qt_apply_rpaths(TARGET "${name}" INSTALL_PATH "${INSTALL_BINDIR}" RELATIVE_RPATH)
|
qt_apply_rpaths(TARGET "${target_name}" INSTALL_PATH "${INSTALL_BINDIR}" RELATIVE_RPATH)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(QT_FEATURE_separate_debug_info AND (UNIX OR MINGW))
|
if(QT_FEATURE_separate_debug_info AND (UNIX OR MINGW))
|
||||||
qt_enable_separate_debug_info(${name} ${INSTALL_BINDIR})
|
qt_enable_separate_debug_info(${target_name} ${INSTALL_BINDIR})
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -28,9 +28,17 @@ set(_tool_deps "@main_module_tool_deps@")
|
|||||||
|
|
||||||
# The tools do not provide linkage targets but executables, where a mismatch
|
# The tools do not provide linkage targets but executables, where a mismatch
|
||||||
# between 32-bit target and 64-bit host does not matter.
|
# between 32-bit target and 64-bit host does not matter.
|
||||||
set(BACKUP_CMAKE_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
|
set(BACKUP_@target@_CMAKE_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
|
||||||
set(CMAKE_SIZEOF_VOID_P "")
|
set(CMAKE_SIZEOF_VOID_P "")
|
||||||
|
|
||||||
|
if(QT_HOST_PATH)
|
||||||
|
# Make sure that the tools find the host tools first
|
||||||
|
set(BACKUP_@target@_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
|
||||||
|
set(BACKUP_@target@_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
|
||||||
|
list(PREPEND CMAKE_PREFIX_PATH "${QT_HOST_PATH}")
|
||||||
|
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(_target_dep ${_tool_deps})
|
foreach(_target_dep ${_tool_deps})
|
||||||
list(GET _target_dep 0 pkg)
|
list(GET _target_dep 0 pkg)
|
||||||
list(GET _target_dep 1 version)
|
list(GET _target_dep 1 version)
|
||||||
@ -39,11 +47,19 @@ foreach(_target_dep ${_tool_deps})
|
|||||||
|
|
||||||
if (NOT ${pkg}_FOUND)
|
if (NOT ${pkg}_FOUND)
|
||||||
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
|
||||||
set(CMAKE_SIZEOF_VOID_P "${BACKUP_CMAKE_SIZEOF_VOID_P}")
|
set(CMAKE_SIZEOF_VOID_P "${BACKUP_@target@_CMAKE_SIZEOF_VOID_P}")
|
||||||
|
if(QT_HOST_PATH)
|
||||||
|
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
|
||||||
|
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
|
||||||
|
endif()
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
set(CMAKE_SIZEOF_VOID_P "${BACKUP_CMAKE_SIZEOF_VOID_P}")
|
if(QT_HOST_PATH)
|
||||||
|
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
|
||||||
|
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
|
||||||
|
endif()
|
||||||
|
set(CMAKE_SIZEOF_VOID_P "${BACKUP_@target@_CMAKE_SIZEOF_VOID_P}")
|
||||||
|
|
||||||
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
|
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
|
||||||
set(_target_deps "@target_deps@")
|
set(_target_deps "@target_deps@")
|
||||||
|
@ -406,6 +406,11 @@ endif()\n")
|
|||||||
"set(BUILD_WITH_PCH \"${BUILD_WITH_PCH}\" CACHE STRING \"\")\n")
|
"set(BUILD_WITH_PCH \"${BUILD_WITH_PCH}\" CACHE STRING \"\")\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
|
||||||
|
"set(QT_BUILD_TOOLS_WHEN_CROSSCOMPILING \"TRUE\" CACHE BOOL \"\" FORCE)\n")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Rpath related things that need to be re-used when building other repos.
|
# Rpath related things that need to be re-used when building other repos.
|
||||||
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
|
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
|
||||||
"set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_RPATH}\" CACHE STRING \"\")\n")
|
"set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_RPATH}\" CACHE STRING \"\")\n")
|
||||||
|
@ -125,8 +125,13 @@ option(QT_NO_MAKE_TESTS "Should tests be built as part of the default 'all' targ
|
|||||||
# When cross-building, we don't build tools by default. Sometimes this also covers Qt apps as well.
|
# When cross-building, we don't build tools by default. Sometimes this also covers Qt apps as well.
|
||||||
# Like in qttools/assistant/assistant.pro, load(qt_app), which is guarded by a qtNomakeTools() call.
|
# Like in qttools/assistant/assistant.pro, load(qt_app), which is guarded by a qtNomakeTools() call.
|
||||||
|
|
||||||
|
set(qt_no_make_tools_default OFF)
|
||||||
|
if(CMAKE_CROSSCOMPILING AND NOT QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
|
||||||
|
set(qt_no_make_tools_default ON)
|
||||||
|
endif()
|
||||||
option(QT_NO_MAKE_TOOLS "Should tools be built as part of the default 'all' target."
|
option(QT_NO_MAKE_TOOLS "Should tools be built as part of the default 'all' target."
|
||||||
"${CMAKE_CROSSCOMPILING}")
|
"${qt_no_make_tools_default}")
|
||||||
|
unset(qt_no_make_tools_default)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qmake Tool:
|
## qmake Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qmake
|
qt_get_tool_target_name(target_name qmake)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
SOURCES
|
SOURCES
|
||||||
../src/3rdparty/pcre2/src/config.h
|
../src/3rdparty/pcre2/src/config.h
|
||||||
../src/3rdparty/pcre2/src/pcre2.h
|
../src/3rdparty/pcre2/src/pcre2.h
|
||||||
@ -169,7 +170,7 @@ qt_add_tool(qmake
|
|||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION WIN32
|
qt_extend_target(${target_name} CONDITION WIN32
|
||||||
SOURCES
|
SOURCES
|
||||||
../src/corelib/global/qoperatingsystemversion_win.cpp
|
../src/corelib/global/qoperatingsystemversion_win.cpp
|
||||||
../src/corelib/io/qfilesystemengine_win.cpp
|
../src/corelib/io/qfilesystemengine_win.cpp
|
||||||
@ -193,7 +194,7 @@ qt_extend_target(qmake CONDITION WIN32
|
|||||||
ole32
|
ole32
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION UNIX
|
qt_extend_target(${target_name} CONDITION UNIX
|
||||||
SOURCES
|
SOURCES
|
||||||
../src/corelib/io/qfilesystemengine_unix.cpp
|
../src/corelib/io/qfilesystemengine_unix.cpp
|
||||||
../src/corelib/io/qfilesystemiterator_unix.cpp
|
../src/corelib/io/qfilesystemiterator_unix.cpp
|
||||||
@ -202,7 +203,7 @@ qt_extend_target(qmake CONDITION UNIX
|
|||||||
../src/corelib/text/qlocale_unix.cpp
|
../src/corelib/text/qlocale_unix.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION MACOS
|
qt_extend_target(${target_name} CONDITION MACOS
|
||||||
SOURCES
|
SOURCES
|
||||||
qcore_foundation.mm
|
qcore_foundation.mm
|
||||||
qcore_mac.mm
|
qcore_mac.mm
|
||||||
@ -216,13 +217,16 @@ qt_extend_target(qmake CONDITION MACOS
|
|||||||
-fconstant-cfstrings
|
-fconstant-cfstrings
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION MINGW AND WIN32
|
qt_extend_target(${target_name} CONDITION MINGW AND WIN32
|
||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
uuid
|
uuid
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION CLANG AND WIN32
|
qt_extend_target(${target_name} CONDITION CLANG AND WIN32
|
||||||
COMPILE_OPTIONS
|
COMPILE_OPTIONS
|
||||||
-Wno-microsoft-enum-value
|
-Wno-microsoft-enum-value
|
||||||
-fms-compatibility-version=19.00.23506
|
-fms-compatibility-version=19.00.23506
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#### Keys ignored in scope 10:.:../src/3rdparty/pcre2:../src/3rdparty/pcre2/pcre2.pri:QT_FEATURE_intelcet:
|
||||||
|
# QMAKE_CFLAGS = "$$QMAKE_CFLAGS_SHSTK"
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qmake Tool:
|
## qmake Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qmake
|
qt_get_tool_target_name(target_name qmake)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
NO_QT # special case
|
NO_QT # special case
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
# GUI # special case: remove this
|
# GUI # special case: remove this
|
||||||
@ -187,7 +188,7 @@ qt_add_tool(qmake
|
|||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION WIN32
|
qt_extend_target(${target_name} CONDITION WIN32
|
||||||
SOURCES
|
SOURCES
|
||||||
../src/corelib/global/qoperatingsystemversion_win.cpp
|
../src/corelib/global/qoperatingsystemversion_win.cpp
|
||||||
../src/corelib/io/qfilesystemengine_win.cpp
|
../src/corelib/io/qfilesystemengine_win.cpp
|
||||||
@ -211,7 +212,7 @@ qt_extend_target(qmake CONDITION WIN32
|
|||||||
ole32
|
ole32
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION UNIX
|
qt_extend_target(${target_name} CONDITION UNIX
|
||||||
SOURCES
|
SOURCES
|
||||||
../src/corelib/io/qfilesystemengine_unix.cpp
|
../src/corelib/io/qfilesystemengine_unix.cpp
|
||||||
../src/corelib/io/qfilesystemiterator_unix.cpp
|
../src/corelib/io/qfilesystemiterator_unix.cpp
|
||||||
@ -220,7 +221,7 @@ qt_extend_target(qmake CONDITION UNIX
|
|||||||
../src/corelib/text/qlocale_unix.cpp
|
../src/corelib/text/qlocale_unix.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION MACOS
|
qt_extend_target(${target_name} CONDITION MACOS
|
||||||
SOURCES
|
SOURCES
|
||||||
../src/corelib/kernel/qcore_foundation.mm # special case
|
../src/corelib/kernel/qcore_foundation.mm # special case
|
||||||
../src/corelib/kernel/qcore_mac.mm # special case
|
../src/corelib/kernel/qcore_mac.mm # special case
|
||||||
@ -251,26 +252,25 @@ extend_target(qmake CONDITION WIN32
|
|||||||
ole32 advapi32 kernel32 netapi32
|
ole32 advapi32 kernel32 netapi32
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION MINGW AND WIN32
|
qt_extend_target(${target_name} CONDITION MINGW AND WIN32
|
||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
uuid
|
uuid
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qmake CONDITION CLANG AND WIN32
|
qt_extend_target(${target_name} CONDITION CLANG AND WIN32
|
||||||
COMPILE_OPTIONS
|
COMPILE_OPTIONS
|
||||||
"-fms-compatibility-version=19.00.23506"
|
"-fms-compatibility-version=19.00.23506"
|
||||||
"-Wno-microsoft-enum-value"
|
"-Wno-microsoft-enum-value"
|
||||||
)
|
)
|
||||||
|
|
||||||
# special case:
|
# special case:
|
||||||
set_target_properties(qmake PROPERTIES
|
set_target_properties(${target_name} PROPERTIES
|
||||||
AUTOMOC OFF
|
AUTOMOC OFF
|
||||||
AUTORCC OFF
|
AUTORCC OFF
|
||||||
AUTOUIC OFF
|
AUTOUIC OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_internal_add_link_flags_gc_sections(qmake PRIVATE) # special case
|
qt_internal_add_link_flags_gc_sections(${target_name} PRIVATE) # special case
|
||||||
|
|
||||||
qt_enable_msvc_cplusplus_define(qmake PUBLIC) # special case
|
|
||||||
qt_skip_warnings_are_errors(qmake) # special case
|
|
||||||
|
|
||||||
|
qt_enable_msvc_cplusplus_define(${target_name} PUBLIC) # special case
|
||||||
|
qt_skip_warnings_are_errors(${target_name}) # special case
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
## moc Tool:
|
## moc Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(cmake_automoc_parser
|
qt_get_tool_target_name(target_name cmake_automoc_parser)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
BOOTSTRAP
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## moc Tool:
|
## moc Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(moc
|
qt_get_tool_target_name(target_name moc)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
BOOTSTRAP
|
||||||
TARGET_DESCRIPTION "Qt Meta Object Compiler"
|
TARGET_DESCRIPTION "Qt Meta Object Compiler"
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## moc Tool:
|
## moc Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(moc
|
qt_get_tool_target_name(target_name moc)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
BOOTSTRAP
|
||||||
TARGET_DESCRIPTION "Qt Meta Object Compiler"
|
TARGET_DESCRIPTION "Qt Meta Object Compiler"
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qdbuscpp2xml Tool:
|
## qdbuscpp2xml Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qdbuscpp2xml
|
qt_get_tool_target_name(target_name qdbuscpp2xml)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt D-Bus C++ to XML Compiler"
|
TARGET_DESCRIPTION "Qt D-Bus C++ to XML Compiler"
|
||||||
SOURCES
|
SOURCES
|
||||||
../moc/cbordevice.h
|
../moc/cbordevice.h
|
||||||
@ -35,12 +36,12 @@ qt_add_tool(qdbuscpp2xml
|
|||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_extend_target(qdbuscpp2xml CONDITION force_bootstrap
|
qt_extend_target(${target_name} CONDITION force_bootstrap
|
||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
bootstrap_dbusPrivate
|
bootstrap_dbusPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qdbuscpp2xml CONDITION NOT force_bootstrap
|
qt_extend_target(${target_name} CONDITION NOT force_bootstrap
|
||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
Qt::DBusPrivate
|
Qt::DBusPrivate
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qdbuscpp2xml Tool:
|
## qdbuscpp2xml Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qdbuscpp2xml
|
qt_get_tool_target_name(target_name qdbuscpp2xml)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt D-Bus C++ to XML Compiler"
|
TARGET_DESCRIPTION "Qt D-Bus C++ to XML Compiler"
|
||||||
TOOLS_TARGET DBus # special case
|
TOOLS_TARGET DBus # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
@ -46,4 +47,3 @@ qt_add_tool(qdbuscpp2xml
|
|||||||
# extend_target(qdbuscpp2xml CONDITION force_bootstrap [...])
|
# extend_target(qdbuscpp2xml CONDITION force_bootstrap [...])
|
||||||
# extend_target(qdbuscpp2xml CONDITION NOT force_bootstrap [...])
|
# extend_target(qdbuscpp2xml CONDITION NOT force_bootstrap [...])
|
||||||
# special case end
|
# special case end
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qdbusxml2cpp Tool:
|
## qdbusxml2cpp Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qdbusxml2cpp
|
qt_get_tool_target_name(target_name qdbusxml2cpp)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt D-Bus XML to C++ Compiler"
|
TARGET_DESCRIPTION "Qt D-Bus XML to C++ Compiler"
|
||||||
SOURCES
|
SOURCES
|
||||||
qdbusxml2cpp.cpp
|
qdbusxml2cpp.cpp
|
||||||
@ -22,12 +23,12 @@ qt_add_tool(qdbusxml2cpp
|
|||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_extend_target(qdbusxml2cpp CONDITION NOT force_bootstrap
|
qt_extend_target(${target_name} CONDITION NOT force_bootstrap
|
||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
Qt::DBusPrivate
|
Qt::DBusPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(qdbusxml2cpp CONDITION force_bootstrap
|
qt_extend_target(${target_name} CONDITION force_bootstrap
|
||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
bootstrap_dbusPrivate
|
bootstrap_dbusPrivate
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qdbusxml2cpp Tool:
|
## qdbusxml2cpp Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qdbusxml2cpp
|
qt_get_tool_target_name(target_name qdbusxml2cpp)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt D-Bus XML to C++ Compiler"
|
TARGET_DESCRIPTION "Qt D-Bus XML to C++ Compiler"
|
||||||
TOOLS_TARGET DBus # special case
|
TOOLS_TARGET DBus # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qlalr Tool:
|
## qlalr Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qlalr
|
qt_get_tool_target_name(target_name qlalr)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt Look Ahead LR Parser Generator"
|
TARGET_DESCRIPTION "Qt Look Ahead LR Parser Generator"
|
||||||
SOURCES
|
SOURCES
|
||||||
compress.cpp compress.h
|
compress.cpp compress.h
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qlalr Tool:
|
## qlalr Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qlalr
|
qt_get_tool_target_name(target_name qlalr)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt Look Ahead LR Parser Generator"
|
TARGET_DESCRIPTION "Qt Look Ahead LR Parser Generator"
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qvkgen Tool:
|
## qvkgen Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qvkgen
|
qt_get_tool_target_name(target_name qvkgen)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt Vulkan Header Generator"
|
TARGET_DESCRIPTION "Qt Vulkan Header Generator"
|
||||||
SOURCES
|
SOURCES
|
||||||
qvkgen.cpp
|
qvkgen.cpp
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## qvkgen Tool:
|
## qvkgen Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(qvkgen
|
qt_get_tool_target_name(target_name qvkgen)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt Vulkan Header Generator"
|
TARGET_DESCRIPTION "Qt Vulkan Header Generator"
|
||||||
TOOLS_TARGET Gui # special case
|
TOOLS_TARGET Gui # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## rcc Tool:
|
## rcc Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(rcc
|
qt_get_tool_target_name(target_name rcc)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
BOOTSTRAP
|
||||||
TARGET_DESCRIPTION "Qt Resource Compiler"
|
TARGET_DESCRIPTION "Qt Resource Compiler"
|
||||||
SOURCES
|
SOURCES
|
||||||
@ -25,14 +26,14 @@ qt_add_tool(rcc
|
|||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_extend_target(rcc CONDITION QT_FEATURE_zstd AND NOT CMAKE_CROSSCOMPILING
|
qt_extend_target(${target_name} CONDITION QT_FEATURE_zstd AND NOT CMAKE_CROSSCOMPILING
|
||||||
DEFINES
|
DEFINES
|
||||||
QT_FEATURE_zstd=1
|
QT_FEATURE_zstd=1
|
||||||
LIBRARIES
|
LIBRARIES
|
||||||
ZSTD::ZSTD
|
ZSTD::ZSTD
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(rcc CONDITION CMAKE_CROSSCOMPILING OR NOT QT_FEATURE_zstd
|
qt_extend_target(${target_name} CONDITION CMAKE_CROSSCOMPILING OR NOT QT_FEATURE_zstd
|
||||||
DEFINES
|
DEFINES
|
||||||
QT_FEATURE_zstd=-1
|
QT_FEATURE_zstd=-1
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## rcc Tool:
|
## rcc Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(rcc
|
qt_get_tool_target_name(target_name rcc)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
BOOTSTRAP
|
||||||
TARGET_DESCRIPTION "Qt Resource Compiler"
|
TARGET_DESCRIPTION "Qt Resource Compiler"
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
@ -26,14 +27,14 @@ qt_add_tool(rcc
|
|||||||
## Scopes:
|
## Scopes:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_extend_target(rcc CONDITION QT_FEATURE_zstd AND NOT CMAKE_CROSSCOMPILING
|
qt_extend_target(${target_name} CONDITION QT_FEATURE_zstd AND NOT CMAKE_CROSSCOMPILING
|
||||||
DEFINES
|
DEFINES
|
||||||
QT_FEATURE_zstd=1
|
QT_FEATURE_zstd=1
|
||||||
LIBRARIES
|
LIBRARIES
|
||||||
ZSTD::ZSTD
|
ZSTD::ZSTD
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_extend_target(rcc CONDITION CMAKE_CROSSCOMPILING OR NOT QT_FEATURE_zstd
|
qt_extend_target(${target_name} CONDITION CMAKE_CROSSCOMPILING OR NOT QT_FEATURE_zstd
|
||||||
DEFINES
|
DEFINES
|
||||||
QT_FEATURE_zstd=-1
|
QT_FEATURE_zstd=-1
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## tracegen Tool:
|
## tracegen Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(tracegen
|
qt_get_tool_target_name(target_name tracegen)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
BOOTSTRAP
|
||||||
SOURCES
|
SOURCES
|
||||||
etw.cpp etw.h
|
etw.cpp etw.h
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## tracegen Tool:
|
## tracegen Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(tracegen
|
qt_get_tool_target_name(target_name tracegen)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
BOOTSTRAP
|
BOOTSTRAP
|
||||||
TOOLS_TARGET Core # special case
|
TOOLS_TARGET Core # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## uic Tool:
|
## uic Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(uic
|
qt_get_tool_target_name(target_name uic)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt User Interface Compiler"
|
TARGET_DESCRIPTION "Qt User Interface Compiler"
|
||||||
SOURCES
|
SOURCES
|
||||||
cpp/cppwritedeclaration.cpp cpp/cppwritedeclaration.h
|
cpp/cppwritedeclaration.cpp cpp/cppwritedeclaration.h
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
## uic Tool:
|
## uic Tool:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
qt_add_tool(uic
|
qt_get_tool_target_name(target_name uic)
|
||||||
|
qt_add_tool(${target_name}
|
||||||
TARGET_DESCRIPTION "Qt User Interface Compiler"
|
TARGET_DESCRIPTION "Qt User Interface Compiler"
|
||||||
TOOLS_TARGET Widgets # special case
|
TOOLS_TARGET Widgets # special case
|
||||||
SOURCES
|
SOURCES
|
||||||
|
@ -2307,7 +2307,10 @@ def expand_resource_glob(cm_fh: IO[str], expression: str) -> str:
|
|||||||
return expanded_var
|
return expanded_var
|
||||||
|
|
||||||
|
|
||||||
def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0, is_example=False):
|
def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0, is_example=False,
|
||||||
|
target_ref: str = None):
|
||||||
|
if target_ref is None:
|
||||||
|
target_ref = target
|
||||||
# vpath = scope.expand('VPATH')
|
# vpath = scope.expand('VPATH')
|
||||||
|
|
||||||
# Handle QRC files by turning them into qt_add_resource:
|
# Handle QRC files by turning them into qt_add_resource:
|
||||||
@ -2325,7 +2328,7 @@ def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0,
|
|||||||
cm_fh.write(f"#### Ignored generated resource: {r}")
|
cm_fh.write(f"#### Ignored generated resource: {r}")
|
||||||
continue
|
continue
|
||||||
qrc_output += process_qrc_file(
|
qrc_output += process_qrc_file(
|
||||||
target,
|
target_ref,
|
||||||
scope,
|
scope,
|
||||||
r,
|
r,
|
||||||
scope.basedir,
|
scope.basedir,
|
||||||
@ -2357,7 +2360,7 @@ def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0,
|
|||||||
immediate_lang = None
|
immediate_lang = None
|
||||||
immediate_name = f"qmake_{r}"
|
immediate_name = f"qmake_{r}"
|
||||||
qrc_output += write_add_qt_resource_call(
|
qrc_output += write_add_qt_resource_call(
|
||||||
target=target,
|
target=target_ref,
|
||||||
scope=scope,
|
scope=scope,
|
||||||
resource_name=immediate_name,
|
resource_name=immediate_name,
|
||||||
prefix=immediate_prefix,
|
prefix=immediate_prefix,
|
||||||
@ -2395,7 +2398,7 @@ def write_resources(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0,
|
|||||||
files = {f: "" for f in standalone_files}
|
files = {f: "" for f in standalone_files}
|
||||||
skip_qtquick_compiler = False
|
skip_qtquick_compiler = False
|
||||||
qrc_output += write_add_qt_resource_call(
|
qrc_output += write_add_qt_resource_call(
|
||||||
target=target,
|
target=target_ref,
|
||||||
scope=scope,
|
scope=scope,
|
||||||
resource_name=name,
|
resource_name=name,
|
||||||
prefix=prefix,
|
prefix=prefix,
|
||||||
@ -2483,7 +2486,9 @@ def expand_project_requirements(scope: Scope, skip_message: bool = False) -> str
|
|||||||
return requirements
|
return requirements
|
||||||
|
|
||||||
|
|
||||||
def write_extend_target(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0):
|
def write_extend_target(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0, target_ref: str = None):
|
||||||
|
if target_ref is None:
|
||||||
|
target_ref = target
|
||||||
ind = spaces(indent)
|
ind = spaces(indent)
|
||||||
extend_qt_io_string = io.StringIO()
|
extend_qt_io_string = io.StringIO()
|
||||||
write_sources_section(extend_qt_io_string, scope)
|
write_sources_section(extend_qt_io_string, scope)
|
||||||
@ -2495,7 +2500,7 @@ def write_extend_target(cm_fh: IO[str], target: str, scope: Scope, indent: int =
|
|||||||
|
|
||||||
cmake_api_call = get_cmake_api_call("qt_extend_target")
|
cmake_api_call = get_cmake_api_call("qt_extend_target")
|
||||||
extend_scope = (
|
extend_scope = (
|
||||||
f"\n{ind}{cmake_api_call}({target} CONDITION"
|
f"\n{ind}{cmake_api_call}({target_ref} CONDITION"
|
||||||
f" {condition}\n"
|
f" {condition}\n"
|
||||||
f"{extend_qt_string}{ind})\n"
|
f"{extend_qt_string}{ind})\n"
|
||||||
)
|
)
|
||||||
@ -2506,7 +2511,7 @@ def write_extend_target(cm_fh: IO[str], target: str, scope: Scope, indent: int =
|
|||||||
cm_fh.write(extend_scope)
|
cm_fh.write(extend_scope)
|
||||||
|
|
||||||
io_string = io.StringIO()
|
io_string = io.StringIO()
|
||||||
write_resources(io_string, target, scope, indent + 1)
|
write_resources(io_string, target, scope, indent + 1, target_ref=target_ref)
|
||||||
resource_string = io_string.getvalue()
|
resource_string = io_string.getvalue()
|
||||||
if len(resource_string) != 0:
|
if len(resource_string) != 0:
|
||||||
resource_string = resource_string.strip("\n").rstrip(f"\n{spaces(indent + 1)}")
|
resource_string = resource_string.strip("\n").rstrip(f"\n{spaces(indent + 1)}")
|
||||||
@ -2892,6 +2897,12 @@ def write_main_part(
|
|||||||
cm_fh.write(f'{spaces(indent)}list(APPEND test_data "{data}")\n')
|
cm_fh.write(f'{spaces(indent)}list(APPEND test_data "{data}")\n')
|
||||||
cm_fh.write("\n")
|
cm_fh.write("\n")
|
||||||
|
|
||||||
|
target_ref = name
|
||||||
|
if typename == "Tool":
|
||||||
|
target_ref = "${target_name}"
|
||||||
|
comment_line = "#" * 69
|
||||||
|
cm_fh.write(f"{spaces(indent)}qt_get_tool_target_name(target_name {name})\n")
|
||||||
|
|
||||||
# Check for DESTDIR override
|
# Check for DESTDIR override
|
||||||
destdir = scope.get_string("DESTDIR")
|
destdir = scope.get_string("DESTDIR")
|
||||||
if destdir:
|
if destdir:
|
||||||
@ -2904,7 +2915,7 @@ def write_main_part(
|
|||||||
destdir = replace_path_constants(destdir, scope)
|
destdir = replace_path_constants(destdir, scope)
|
||||||
extra_lines.append(f'OUTPUT_DIRECTORY "{destdir}"')
|
extra_lines.append(f'OUTPUT_DIRECTORY "{destdir}"')
|
||||||
|
|
||||||
cm_fh.write(f"{spaces(indent)}{cmake_function}({name}\n")
|
cm_fh.write(f"{spaces(indent)}{cmake_function}({target_ref}\n")
|
||||||
for extra_line in extra_lines:
|
for extra_line in extra_lines:
|
||||||
cm_fh.write(f"{spaces(indent)} {extra_line}\n")
|
cm_fh.write(f"{spaces(indent)} {extra_line}\n")
|
||||||
|
|
||||||
@ -2915,7 +2926,7 @@ def write_main_part(
|
|||||||
# Footer:
|
# Footer:
|
||||||
cm_fh.write(f"{spaces(indent)})\n")
|
cm_fh.write(f"{spaces(indent)})\n")
|
||||||
|
|
||||||
write_resources(cm_fh, name, scope, indent)
|
write_resources(cm_fh, name, scope, indent, target_ref=target_ref)
|
||||||
|
|
||||||
write_statecharts(cm_fh, name, scope, indent)
|
write_statecharts(cm_fh, name, scope, indent)
|
||||||
|
|
||||||
@ -2951,7 +2962,7 @@ def write_main_part(
|
|||||||
c.reset_visited_keys()
|
c.reset_visited_keys()
|
||||||
write_android_part(cm_fh, name, c, indent=indent)
|
write_android_part(cm_fh, name, c, indent=indent)
|
||||||
write_wayland_part(cm_fh, name, c, indent=indent)
|
write_wayland_part(cm_fh, name, c, indent=indent)
|
||||||
write_extend_target(cm_fh, name, c, indent=indent)
|
write_extend_target(cm_fh, name, c, target_ref=target_ref, indent=indent)
|
||||||
write_simd_part(cm_fh, name, c, indent=indent)
|
write_simd_part(cm_fh, name, c, indent=indent)
|
||||||
|
|
||||||
ignored_keys_report = write_ignored_keys(c, spaces(indent))
|
ignored_keys_report = write_ignored_keys(c, spaces(indent))
|
||||||
@ -3154,7 +3165,7 @@ def write_tool(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> str:
|
|||||||
extra_keys=["CONFIG"],
|
extra_keys=["CONFIG"],
|
||||||
)
|
)
|
||||||
|
|
||||||
return tool_name
|
return tool_name, "${target_name}"
|
||||||
|
|
||||||
|
|
||||||
def write_test(cm_fh: IO[str], scope: Scope, gui: bool = False, *, indent: int = 0) -> str:
|
def write_test(cm_fh: IO[str], scope: Scope, gui: bool = False, *, indent: int = 0) -> str:
|
||||||
@ -3770,6 +3781,7 @@ def handle_app_or_lib(
|
|||||||
is_plugin = "plugin" in config
|
is_plugin = "plugin" in config
|
||||||
is_qt_plugin = any("qt_plugin" == s for s in scope.get("_LOADED")) or is_qml_plugin
|
is_qt_plugin = any("qt_plugin" == s for s in scope.get("_LOADED")) or is_qml_plugin
|
||||||
target = ""
|
target = ""
|
||||||
|
target_ref = None
|
||||||
gui = all(val not in config for val in ["console", "cmdline", "-app_bundle"]) and all(
|
gui = all(val not in config for val in ["console", "cmdline", "-app_bundle"]) and all(
|
||||||
val not in scope.expand("QT") for val in ["testlib", "testlib-private"]
|
val not in scope.expand("QT") for val in ["testlib", "testlib-private"]
|
||||||
)
|
)
|
||||||
@ -3792,7 +3804,7 @@ def handle_app_or_lib(
|
|||||||
target = write_module(cm_fh, scope, indent=indent)
|
target = write_module(cm_fh, scope, indent=indent)
|
||||||
elif "qt_tool" in scope.get("_LOADED"):
|
elif "qt_tool" in scope.get("_LOADED"):
|
||||||
assert not is_example
|
assert not is_example
|
||||||
target = write_tool(cm_fh, scope, indent=indent)
|
target, target_ref = write_tool(cm_fh, scope, indent=indent)
|
||||||
else:
|
else:
|
||||||
if "testcase" in config or "testlib" in config or "qmltestcase" in config:
|
if "testcase" in config or "testlib" in config or "qmltestcase" in config:
|
||||||
assert not is_example
|
assert not is_example
|
||||||
@ -3800,6 +3812,9 @@ def handle_app_or_lib(
|
|||||||
else:
|
else:
|
||||||
target = write_binary(cm_fh, scope, gui, indent=indent)
|
target = write_binary(cm_fh, scope, gui, indent=indent)
|
||||||
|
|
||||||
|
if target_ref is None:
|
||||||
|
target_ref = target
|
||||||
|
|
||||||
# ind = spaces(indent)
|
# ind = spaces(indent)
|
||||||
cmake_api_call = get_cmake_api_call("qt_add_docs")
|
cmake_api_call = get_cmake_api_call("qt_add_docs")
|
||||||
write_source_file_list(
|
write_source_file_list(
|
||||||
@ -3808,14 +3823,14 @@ def handle_app_or_lib(
|
|||||||
"",
|
"",
|
||||||
["QMAKE_DOCS"],
|
["QMAKE_DOCS"],
|
||||||
indent,
|
indent,
|
||||||
header=f"{cmake_api_call}({target}\n",
|
header=f"{cmake_api_call}({target_ref}\n",
|
||||||
footer=")\n",
|
footer=")\n",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Generate qmltypes instruction for anything that may have CONFIG += qmltypes
|
# Generate qmltypes instruction for anything that may have CONFIG += qmltypes
|
||||||
# that is not a qml plugin
|
# that is not a qml plugin
|
||||||
if "qmltypes" in scope.get("CONFIG") and "qml_plugin" not in scope.get("_LOADED"):
|
if "qmltypes" in scope.get("CONFIG") and "qml_plugin" not in scope.get("_LOADED"):
|
||||||
cm_fh.write(f"\n{spaces(indent)}set_target_properties({target} PROPERTIES\n")
|
cm_fh.write(f"\n{spaces(indent)}set_target_properties({target_ref} PROPERTIES\n")
|
||||||
|
|
||||||
install_dir = scope.expandString("QMLTYPES_INSTALL_DIR")
|
install_dir = scope.expandString("QMLTYPES_INSTALL_DIR")
|
||||||
if install_dir:
|
if install_dir:
|
||||||
@ -3842,7 +3857,7 @@ def handle_app_or_lib(
|
|||||||
cm_fh.write(f'{spaces(indent+1)}QT_QML_MODULE_INSTALL_DIR "{install_dir}"\n')
|
cm_fh.write(f'{spaces(indent+1)}QT_QML_MODULE_INSTALL_DIR "{install_dir}"\n')
|
||||||
|
|
||||||
cm_fh.write(f"{spaces(indent)})\n\n")
|
cm_fh.write(f"{spaces(indent)})\n\n")
|
||||||
cm_fh.write(f"qt6_qml_type_registration({target})\n")
|
cm_fh.write(f"qt6_qml_type_registration({target_ref})\n")
|
||||||
|
|
||||||
|
|
||||||
def handle_top_level_repo_project(scope: Scope, cm_fh: IO[str]):
|
def handle_top_level_repo_project(scope: Scope, cm_fh: IO[str]):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user