Skip to content

Commit

Permalink
CMake: Implement configure -qreal <type>
Browse files Browse the repository at this point in the history
The configure argument -qreal <type> maps to the CMake argument
-DQT_COORD_TYPE=<type>.

Fixes: QTBUG-83325
Change-Id: I94970f31ccfb241b1dd4f1d9b6cef25d6684dc05
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
jobor committed Aug 19, 2020
1 parent 3911be6 commit 5f729da
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cmake/QtBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion cmake/QtPriHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
1 change: 1 addition & 0 deletions cmake/QtProcessConfigureArgs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/configure-cmake-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <type> | | |
| -qreal <type> | -DQT_COORD_TYPE=<type> | |
| -R <string> | -DQT_EXTRA_RPATHS=path1;path2 | |
| -rpath | negative CMAKE_SKIP_BUILD_RPATH | |
| | negative CMAKE_SKIP_INSTALL_RPATH | |
Expand Down
6 changes: 6 additions & 0 deletions configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
15 changes: 15 additions & 0 deletions util/cmake/configurejson2cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 5f729da

Please sign in to comment.