From 5f729da74a5c12a8d33389dcc874c8277044abe0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 18 Aug 2020 10:59:03 +0200 Subject: [PATCH] CMake: Implement configure -qreal The configure argument -qreal maps to the CMake argument -DQT_COORD_TYPE=. Fixes: QTBUG-83325 Change-Id: I94970f31ccfb241b1dd4f1d9b6cef25d6684dc05 Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 4 ++++ cmake/QtPriHelpers.cmake | 2 +- cmake/QtProcessConfigureArgs.cmake | 1 + cmake/configure-cmake-mapping.md | 2 +- configure.cmake | 6 ++++++ util/cmake/configurejson2cmake.py | 15 +++++++++++++++ 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index d85acbd1c9..32277a13cc 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -142,6 +142,10 @@ else() set(QT_STAGING_PREFIX "${CMAKE_INSTALL_PREFIX}") endif() +if(PROJECT_NAME STREQUAL "QtBase") + set(QT_COORD_TYPE double CACHE STRING "Type of qreal") +endif() + function(qt_internal_set_up_global_paths) # Compute the values of QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR, QT_CONFIG_INSTALL_DIR # taking into account whether the current build is a prefix build or a non-prefix build, diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake index 1e3b12e661..f1723cd495 100644 --- a/cmake/QtPriHelpers.cmake +++ b/cmake/QtPriHelpers.cmake @@ -652,7 +652,7 @@ CONFIG += ${private_config_joined} string(APPEND content "PKG_CONFIG_EXECUTABLE = ${PKG_CONFIG_EXECUTABLE}\n") endif() - # TODO: Write QT_COORD_TYPE once we support setting it. + string(APPEND content "QT_COORD_TYPE = ${QT_COORD_TYPE}\n") qt_get_build_parts(build_parts) string(REPLACE ";" " " build_parts "${build_parts}") diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index de35b2f5df..743e8e3eb7 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -534,6 +534,7 @@ 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_string_input(qreal QT_COORD_TYPE) 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) diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md index 874b85e2e3..e0edfe98e7 100644 --- a/cmake/configure-cmake-mapping.md +++ b/cmake/configure-cmake-mapping.md @@ -56,7 +56,7 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349. | -c++std c++2a | -DFEATURE_cxx2a=ON | | | -sse2/sse3/-ssse3/-sse4.1 | | | | -mips_dsp/-mips_dspr2 | | | -| -qreal | | | +| -qreal | -DQT_COORD_TYPE= | | | -R | -DQT_EXTRA_RPATHS=path1;path2 | | | -rpath | negative CMAKE_SKIP_BUILD_RPATH | | | | negative CMAKE_SKIP_INSTALL_RPATH | | diff --git a/configure.cmake b/configure.cmake index 23915c6eec..f56047b14c 100644 --- a/configure.cmake +++ b/configure.cmake @@ -797,6 +797,12 @@ qt_feature("dbus-linked" PRIVATE ENABLE INPUT_dbus STREQUAL 'linked' DISABLE INPUT_dbus STREQUAL 'runtime' ) +qt_feature("qreal" + LABEL "Type for qreal" + CONDITION DEFINED QT_COORD_TYPE AND NOT QT_COORD_TYPE STREQUAL "double" +) +qt_feature_definition("qreal" "QT_COORD_TYPE" VALUE "${QT_COORD_TYPE}") +qt_feature_definition("qreal" "QT_COORD_TYPE_STRING" VALUE "\"${QT_COORD_TYPE}\"") qt_feature("gui" PRIVATE LABEL "Qt Gui" ) diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index b3b0a9bc01..5e7036e614 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -886,6 +886,21 @@ def get_feature_mapping(): "profile": None, "qmakeargs": None, "qpa_default_platform": None, # Not a bool! + "qreal" : { + "condition": "DEFINED QT_COORD_TYPE AND NOT QT_COORD_TYPE STREQUAL \"double\"", + "output": [ + { + "type": "define", + "name": "QT_COORD_TYPE", + "value": "${QT_COORD_TYPE}", + }, + { + "type": "define", + "name": "QT_COORD_TYPE_STRING", + "value": "\\\"${QT_COORD_TYPE}\\\"", + }, + ], + }, "release": None, "release_tools": None, "rpath": {