From 39fc377bf105ba09e2a8f9acae467dc789b96525 Mon Sep 17 00:00:00 2001 From: Eric Lemanissier Date: Fri, 25 Nov 2016 15:07:48 +0100 Subject: [PATCH] MinGW: reuse gcc-base.conf and g++-base.conf it allows using optimize_full, ltcg and sanitizers Change-Id: I3ccf8257145c7d8800c2ebe98c5ac5adcec0dc9d Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira Reviewed-by: Friedemann Kleint --- mkspecs/common/gcc-base-mac.conf | 2 ++ mkspecs/common/gcc-base-unix.conf | 2 ++ mkspecs/common/gcc-base.conf | 6 ++--- mkspecs/features/link_ltcg.prf | 3 ++- mkspecs/win32-g++/qmake.conf | 45 ++++--------------------------- 5 files changed, 14 insertions(+), 44 deletions(-) diff --git a/mkspecs/common/gcc-base-mac.conf b/mkspecs/common/gcc-base-mac.conf index 34211b764d..6008952537 100644 --- a/mkspecs/common/gcc-base-mac.conf +++ b/mkspecs/common/gcc-base-mac.conf @@ -8,6 +8,8 @@ # you can use the manual test in tests/manual/mkspecs. # +QMAKE_CFLAGS_PIC = -fPIC + include(gcc-base.conf) QMAKE_COMPILER_DEFINES += __APPLE__ __GNUC__=4 __APPLE_CC__ diff --git a/mkspecs/common/gcc-base-unix.conf b/mkspecs/common/gcc-base-unix.conf index 0178bda75a..2d63877dc9 100644 --- a/mkspecs/common/gcc-base-unix.conf +++ b/mkspecs/common/gcc-base-unix.conf @@ -8,6 +8,8 @@ # you can use the manual test in tests/manual/mkspecs. # +QMAKE_CFLAGS_PIC = -fPIC + include(gcc-base.conf) QMAKE_LFLAGS_SHLIB += -shared diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf index 6e043f558f..6bb1e3fbe0 100644 --- a/mkspecs/common/gcc-base.conf +++ b/mkspecs/common/gcc-base.conf @@ -41,9 +41,9 @@ QMAKE_CFLAGS_WARN_OFF += -w QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -g QMAKE_CFLAGS_DEBUG += -g -QMAKE_CFLAGS_SHLIB += -fPIC -QMAKE_CFLAGS_STATIC_LIB += -fPIC -QMAKE_CFLAGS_APP += -fPIC +QMAKE_CFLAGS_SHLIB += $$QMAKE_CFLAGS_PIC +QMAKE_CFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_PIC +QMAKE_CFLAGS_APP += $$QMAKE_CFLAGS_PIC QMAKE_CFLAGS_ISYSTEM = -isystem QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden diff --git a/mkspecs/features/link_ltcg.prf b/mkspecs/features/link_ltcg.prf index 734743ca13..03d0e813b6 100644 --- a/mkspecs/features/link_ltcg.prf +++ b/mkspecs/features/link_ltcg.prf @@ -1,5 +1,6 @@ gcc { - !clang:!intel_icc:greaterThan(QMAKE_HOST.cpu_count, 1) { + # on Windows, MinGW's support for -flto=N is broken + !clang:!intel_icc:!equals(QMAKE_HOST.os, Windows):greaterThan(QMAKE_HOST.cpu_count, 1) { # Override LTO number of jobs QMAKE_LFLAGS_LTCG ~= s/^-flto$/-flto=$$QMAKE_HOST.cpu_count/ } diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index bb172f46a6..d6b08f5323 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -8,6 +8,7 @@ # load(device_config) +include(../common/g++-base.conf) MAKEFILE_GENERATOR = MINGW QMAKE_PLATFORM = win32 mingw @@ -18,52 +19,21 @@ QMAKE_COMPILER_DEFINES += __GNUC__ WIN32 QMAKE_EXT_OBJ = .o QMAKE_EXT_RES = _res.o -QMAKE_COMPILER = gcc QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = bison -y QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -pipe -fno-keep-inline-dllexport -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -Wextra -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -O2 -g -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections -QMAKE_CFLAGS_SSE2 = -msse2 -mstackrealign -QMAKE_CFLAGS_SSE3 = -msse3 -QMAKE_CFLAGS_SSSE3 = -mssse3 -QMAKE_CFLAGS_SSE4_1 = -msse4.1 -QMAKE_CFLAGS_SSE4_2 = -msse4.2 -QMAKE_CFLAGS_AVX = -mavx -QMAKE_CFLAGS_AVX2 = -mavx2 -QMAKE_CFLAGS_NEON = -mfpu=neon +QMAKE_CFLAGS += -fno-keep-inline-dllexport +QMAKE_CFLAGS_WARN_ON += -Wextra +QMAKE_CFLAGS_SSE2 += -mstackrealign QMAKE_CXX = $${CROSS_COMPILE}g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD QMAKE_CXXFLAGS_RTTI_ON = -frtti QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads -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_GNUCXX11 = -std=gnu++11 -QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y -QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z -QMAKE_CXXFLAGS_SPLIT_SECTIONS = $$QMAKE_CFLAGS_SPLIT_SECTIONS QMAKE_INCDIR = @@ -74,17 +44,11 @@ QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< QMAKE_LINK = $${CROSS_COMPILE}g++ QMAKE_LINK_C = $${CROSS_COMPILE}gcc -QMAKE_LFLAGS = QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -QMAKE_LFLAGS_EXCEPTIONS_OFF = QMAKE_LFLAGS_RELEASE = -Wl,-s -QMAKE_LFLAGS_DEBUG = QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows QMAKE_LFLAGS_DLL = -shared -QMAKE_LFLAGS_CXX11 = -QMAKE_LFLAGS_CXX14 = -QMAKE_LFLAGS_CXX1Z = QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections QMAKE_LINK_OBJECT_MAX = 10 QMAKE_LINK_OBJECT_SCRIPT = object_script @@ -114,5 +78,6 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P include(../common/windows-gles.conf) +include(../common/gcc-base.conf) load(qt_config)