From 2988c44f7675ba3c4a4b28690db467ba0e40469d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 29 Jun 2012 11:22:27 +0200 Subject: [PATCH] Don't lower the code generation level options for the compiler If the default settings already include the necessary flags, do not override the compiler flags, possibly lowering support. This allows the user to specify a higher setting for a Qt build, such as what MeeGo did (it enabled SSSE3 support in all builds). Additionally, this prevents us from passing -msse2 or -arch:SSE2 options to x86-64 builds, as SSE2 is a mandatory part of that architecture. This silences a warning from MSVC that the option is unknown in 64-bit builds. Change-Id: I6e2969b672bcac87168c245b8be3309e8cc49224 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/gui/gui.pro | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 277000aac1..3512e7bc79 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -39,7 +39,7 @@ win32:!contains(QT_CONFIG, directwrite) { *-g++*|linux-icc*|*-clang*|*-qcc* { sse2 { sse2_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - sse2_compiler.commands += $$QMAKE_CFLAGS_SSE2 + !contains(QT_CPU_FEATURES, sse2):sse2_compiler.commands += $$QMAKE_CFLAGS_SSE2 sse2_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} sse2_compiler.dependency_type = TYPE_C sse2_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} @@ -51,7 +51,7 @@ win32:!contains(QT_CONFIG, directwrite) { } ssse3 { ssse3_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - ssse3_compiler.commands += $$QMAKE_CFLAGS_SSSE3 + !contains(QT_CPU_FEATURES, ssse3):ssse3_compiler.commands += $$QMAKE_CFLAGS_SSSE3 ssse3_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} ssse3_compiler.dependency_type = TYPE_C ssse3_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} @@ -63,7 +63,7 @@ win32:!contains(QT_CONFIG, directwrite) { } avx { avx_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - avx_compiler.commands += $$QMAKE_CFLAGS_AVX + !contains(QT_CPU_FEATURES, avx):avx_compiler.commands += $$QMAKE_CFLAGS_AVX avx_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} avx_compiler.dependency_type = TYPE_C avx_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} @@ -79,7 +79,7 @@ win32:!contains(QT_CONFIG, directwrite) { DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM neon_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - neon_compiler.commands += $$QMAKE_CFLAGS_NEON + !contains(QT_CPU_FEATURES, neon):neon_compiler.commands += $$QMAKE_CFLAGS_NEON neon_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} neon_compiler.dependency_type = TYPE_C neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} @@ -132,7 +132,7 @@ win32:!contains(QT_CONFIG, directwrite) { } else:win32-msvc* { sse2 { sse2_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - sse2_compiler.commands += $$QMAKE_CFLAGS_SSE2 + !contains(QT_CPU_FEATURES, sse2):sse2_compiler.commands += $$QMAKE_CFLAGS_SSE2 sse2_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -Fo${QMAKE_FILE_OUT} sse2_compiler.dependency_type = TYPE_C sse2_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} @@ -144,7 +144,9 @@ win32:!contains(QT_CONFIG, directwrite) { } ssse3 { ssse3_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - ssse3_compiler.commands += $$QMAKE_CFLAGS_SSSE3 + # MSVC doesn't have an option for SSSE3 specifically, so check if SSE2 is + # already enabled instead + !contains(QT_CPU_FEATURES, sse2):ssse3_compiler.commands += $$QMAKE_CFLAGS_SSSE3 ssse3_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -Fo${QMAKE_FILE_OUT} ssse3_compiler.dependency_type = TYPE_C ssse3_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} @@ -156,7 +158,7 @@ win32:!contains(QT_CONFIG, directwrite) { } avx { avx_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) -D_M_AVX - avx_compiler.commands += $$QMAKE_CFLAGS_AVX + !contains(QT_CPU_FEATURES, avx):avx_compiler.commands += $$QMAKE_CFLAGS_AVX avx_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -Fo${QMAKE_FILE_OUT} avx_compiler.dependency_type = TYPE_C avx_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}