CMake: Generate qdevice.pri when cross-building
This adds the CMake equivalent to the classical -device-option key=value configure argument: -DQT_QMAKE_DEVICE_OPTIONS=key1=value1[;keyN=valueN] The keys and values get dumped verbatim into qdevice.pri. This patch also ports the machineTuple configure test. Its result is written into qdevice.pri as value for the GCC_MACHINE_DUMP variable. Change-Id: I29f2323fd87639fafaed99ec7446c7ee75504705 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
8df4caf554
commit
943340222e
@ -293,6 +293,7 @@ qt_feature_module_end(GlobalConfig OUT_VAR_PREFIX "__GlobalConfig_")
|
||||
|
||||
qt_generate_global_config_pri_file()
|
||||
qt_generate_global_module_pri_file()
|
||||
qt_generate_global_device_pri_file()
|
||||
qt_generate_qmake_wrapper_for_target()
|
||||
|
||||
add_library(Qt::GlobalConfig ALIAS GlobalConfig)
|
||||
|
@ -1244,6 +1244,28 @@ QT_PATCH_VERSION = ${PROJECT_VERSION_PATCH}
|
||||
qt_install(FILES "${qconfig_pri_target_path}" DESTINATION ${INSTALL_MKSPECSDIR})
|
||||
endfunction()
|
||||
|
||||
# Creates mkspecs/qdevice.pri which contains target device information for cross-builds.
|
||||
# The content of QT_QMAKE_DEVICE_OPTIONS is written verbatim into qdevice.pri.
|
||||
function(qt_generate_global_device_pri_file)
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
return()
|
||||
endif()
|
||||
|
||||
qt_path_join(qdevice_pri_target_path ${PROJECT_BINARY_DIR} ${INSTALL_MKSPECSDIR} "qdevice.pri")
|
||||
|
||||
set(content "")
|
||||
foreach(opt ${QT_QMAKE_DEVICE_OPTIONS})
|
||||
string(APPEND content "${opt}\n")
|
||||
endforeach()
|
||||
|
||||
if(TEST_machine_tuple)
|
||||
string(APPEND content "GCC_MACHINE_DUMP = ${TEST_machine_tuple}\n")
|
||||
endif()
|
||||
|
||||
file(GENERATE OUTPUT "${qdevice_pri_target_path}" CONTENT "${content}")
|
||||
qt_install(FILES "${qdevice_pri_target_path}" DESTINATION ${INSTALL_MKSPECSDIR})
|
||||
endfunction()
|
||||
|
||||
function(qt_get_build_parts out_var)
|
||||
set(parts "libs")
|
||||
|
||||
|
@ -858,6 +858,25 @@ function(qt_config_compile_test_x86simd extension label)
|
||||
set(TEST_subarch_${extension} "${TEST_X86SIMD_${extension}}" CACHE INTERNAL "${label}")
|
||||
endfunction()
|
||||
|
||||
function(qt_config_compile_test_machine_tuple label)
|
||||
if(DEFINED TEST_MACHINE_TUPLE OR NOT (GCC OR CLANG))
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Performing Test ${label}")
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -dumpmachine
|
||||
OUTPUT_VARIABLE output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE exit_code)
|
||||
if(exit_code EQUAL 0)
|
||||
set(status_label "Success")
|
||||
else()
|
||||
set(status_label "Failed")
|
||||
endif()
|
||||
message(STATUS "Performing Test ${label} - ${status_label}")
|
||||
set(TEST_machine_tuple "${output}" CACHE INTERNAL "${label}")
|
||||
endfunction()
|
||||
|
||||
function(qt_make_features_available target)
|
||||
if(NOT "${target}" MATCHES "^${QT_CMAKE_EXPORT_NAMESPACE}::[a-zA-Z0-9_-]*$")
|
||||
message(FATAL_ERROR "${target} does not match ${QT_CMAKE_EXPORT_NAMESPACE}::[a-zA-Z0-9_-]*. INVALID NAME.")
|
||||
|
@ -14,6 +14,9 @@ qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev MODULE_NAME global Q
|
||||
|
||||
#### Tests
|
||||
|
||||
# machineTuple
|
||||
qt_config_compile_test_machine_tuple("machine tuple")
|
||||
|
||||
# cxx14
|
||||
qt_config_compile_test(cxx14
|
||||
LABEL "C++14 support"
|
||||
|
@ -819,6 +819,15 @@ def parseTest(ctx, test, data, cm_fh):
|
||||
cm_fh.write(f'qt_config_compile_test_x86simd({test} "{label}")\n')
|
||||
cm_fh.write("\n")
|
||||
|
||||
elif data["type"] == "machineTuple":
|
||||
knownTests.add(test)
|
||||
|
||||
label = data["label"]
|
||||
|
||||
cm_fh.write(f"# {test}\n")
|
||||
cm_fh.write(f'qt_config_compile_test_machine_tuple("{label}")\n')
|
||||
cm_fh.write("\n")
|
||||
|
||||
# "features": {
|
||||
# "android-style-assets": {
|
||||
# "label": "Android Style Assets",
|
||||
|
Loading…
Reference in New Issue
Block a user