diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-28 16:19:42 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-03 14:41:28 +0000 |
commit | e88864578a881c0a14ef2dc958ee52e2aa036134 (patch) | |
tree | 0ee2ade2756542a07de5068de4ebe345979fa0cf | |
parent | 46effc7319582fb10c5d3fc4737f6e1b2f9c3e8b (diff) |
Generate the c++xx standard features instead of skipping them
The features are reused in qtdeclarative (and maybe somewhere else
too), so they should be present. We can still map the conditions
to proper CMake compile feature tests.
Change-Id: I4d307d29d4d293cc23ab005b195ea346087c7162
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | configure.cmake | 39 | ||||
-rwxr-xr-x | util/cmake/configurejson2cmake.py | 6 | ||||
-rw-r--r-- | util/cmake/helper.py | 5 |
3 files changed, 42 insertions, 8 deletions
diff --git a/configure.cmake b/configure.cmake index 957d7fb13b..330c5347c5 100644 --- a/configure.cmake +++ b/configure.cmake @@ -15,6 +15,27 @@ qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev) #### Tests +# c++2a +qt_config_compile_test(cxx2a + LABEL "C++2a support" +"#if __cplusplus > 201703L +// Compiler claims to support experimental C++2a, trust it +#else +# error __cplusplus must be > 201703L (the value for C++17) +#endif + + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + /* BEGIN TEST: */ + + /* END TEST: */ + return 0; +} +"# FIXME: qmake: CONFIG += c++11 c++14 c++1z c++2a +) + # precompile_header qt_config_compile_test(precompile_header LABEL "precompiled header support" @@ -245,9 +266,25 @@ qt_feature("framework" PUBLIC qt_feature_definition("framework" "QT_MAC_FRAMEWORK_BUILD") qt_feature("largefile" LABEL "Large file support" - CONDITION NOT ANDROID AND NOT INTEGRITY AND NOT WINRT + CONDITION NOT ANDROID AND NOT INTEGRITY AND NOT WINRT AND NOT rtems ) qt_feature_definition("largefile" "QT_LARGEFILE_SUPPORT" VALUE "64") +qt_feature("cxx11" PUBLIC + LABEL "C++11" +) +qt_feature("cxx14" PUBLIC + LABEL "C++14" + CONDITION QT_FEATURE_cxx11 AND $<COMPILE_FEATURES:cxx_std_14> +) +qt_feature("cxx1z" PUBLIC + LABEL "C++17" + CONDITION QT_FEATURE_cxx14 AND $<COMPILE_FEATURES:cxx_std_17> +) +qt_feature("cxx2a" PUBLIC + LABEL "C++2a" + AUTODETECT OFF + CONDITION QT_FEATURE_cxx1z AND TEST_cxx2a +) qt_feature("reduce_exports" PRIVATE LABEL "Reduce amount of exported symbols" CONDITION NOT WIN32 AND CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index 148109e2a4..890d4dfc5f 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -615,13 +615,7 @@ def parseFeature(ctx, feature, data, cm_fh): 'alloc_malloc_h': None, 'alloc_stdlib_h': None, 'build_all': None, - 'c++11': None, # C and C++ versions 'c11': None, - 'c++14': None, - 'c++1y': None, - 'c++1z': None, - # FIXME: used in qtdeclarative, drop when we require C++14 - 'cxx14_make_unique': None, 'c89': None, 'c99': None, 'ccache': None, diff --git a/util/cmake/helper.py b/util/cmake/helper.py index bb2b239aa0..8f24a49d6b 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -302,7 +302,10 @@ def find_library_info_for_target(targetName: str) -> typing.Optional[LibraryMapp def featureName(input: str) -> str: - return re.sub(r'[^a-zA-Z0-9_]', '_', input) + replacement_char = '_' + if input.startswith('c++'): + replacement_char = 'x' + return re.sub(r'[^a-zA-Z0-9_]', replacement_char, input) def map_qt_library(lib: str) -> str: |