Skip to content

Commit

Permalink
Use C++17 for qmake and force the build of everything with C++17
Browse files Browse the repository at this point in the history
We will want to use C++17 code in our headers soon.
(including the one in the bootstrap libraries)

This patch is quick and dirty, I guess it will be cleaner once we move to cmake

Updated QMAKE_MACOSX_DEPLOYMENT_TARGET because 10.13 runtime does
not support C++17 stdlib features

Change-Id: I75ac171436945dddd1bb953a9c8d323ac20da7ac
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
  • Loading branch information
ogoffart authored and laknoll committed Feb 8, 2020
1 parent 3568ad5 commit 4933a5f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,14 @@ fi
echo "########################################################################" > "$mkfile"
echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
echo "########################################################################" >> "$mkfile"
EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX11) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)"
EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX1Z) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)"
EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)"

[ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM=
setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM"
setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM"
setBootstrapVariable QMAKE_CXXFLAGS
setBootstrapVariable QMAKE_CXXFLAGS_CXX11
setBootstrapVariable QMAKE_CXXFLAGS_CXX1Z
setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS
setBootstrapVariable QMAKE_LFLAGS
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/common/icc-base-unix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ QMAKE_CXXFLAGS_SPLIT_SECTIONS = $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
QMAKE_CXXFLAGS_CXX11 = -std=c++11
QMAKE_CXXFLAGS_CXX14 = -std=c++1y
QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
QMAKE_CXXFLAGS_CXX1Z = -std=c++17
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/common/macx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
QMAKE_PLATFORM += macos osx macx
QMAKE_MAC_SDK = macosx

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
QMAKE_APPLE_DEVICE_ARCHS = x86_64

# Should be 10.15, but as long as the CI builds with
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/common/qcc-base-qnx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QMAKE_RPATHLINKDIR_POST += $${QNX_DIR}/$${QNX_CPUDIR}/lib $${QNX_DIR}/$${QNX_CPU

QMAKE_CXXFLAGS_CXX11 =
QMAKE_CXXFLAGS_CXX14 =
QMAKE_CXXFLAGS_CXX1Z =
QMAKE_CXXFLAGS_CXX1Z = -Wc,-std=gnu++1z

QMAKE_CXXFLAGS_GNUCXX11 = -Wc,-std=gnu++11
QMAKE_CXXFLAGS_GNUCXX14 = -Wc,-std=gnu++1y
Expand Down
16 changes: 7 additions & 9 deletions mkspecs/features/default_post.prf
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,20 @@ breakpad {
c++17: CONFIG += c++1z
c++latest: CONFIG *= c++2a c++1z c++14 c++11

!c++11:!c++14:!c++1z:!c++2a {
# Qt requires C++11 since 5.7, check if we need to force a compiler option
!c++1z:!c++2a {
# Qt requires C++17
QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "")
!greaterThan(QT_COMPILER_STDCXX_no_L, 199711): CONFIG += c++11
!greaterThan(QT_COMPILER_STDCXX_no_L, 201402): CONFIG += c++1z
}
c++11|c++14|c++1z|c++2a {
c++1z|c++2a {
# Disable special compiler flags for host builds
!host_build|!cross_compile {
c++2a: cxxstd = CXX2A
else: c++1z: cxxstd = CXX1Z
else: c++14: cxxstd = CXX14
else: cxxstd = CXX11
else: cxxstd = CXX1Z
} else {
# Fall back to c++11, because since 5.7 c++11 is required everywhere,
# Fall back to c++17, because C++17 is required everywhere,
# including host builds
cxxstd = CXX11
cxxstd = CXX1Z
}

# Check if we should disable compiler extensions or not
Expand Down
2 changes: 1 addition & 1 deletion qmake/Makefile.win32
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CFLAGS_PCH = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch
PCH_OBJECT = qmake_pch.obj

CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \
-W2 -nologo -O2 \
-W2 -nologo -O2 -std:c++17 -Zc:__cplusplus \
$(CFLAGS_EXTRA) \
-I$(QMKSRC) -I$(QMKSRC)\library -I$(QMKSRC)\generators -I$(QMKSRC)\generators\unix -I$(QMKSRC)\generators\win32 -I$(QMKSRC)\generators\mac \
-I$(SOURCE_PATH)/src/3rdparty/tinycbor/src \
Expand Down

0 comments on commit 4933a5f

Please sign in to comment.