Silence cl.exe warning about -arch:SSE2 being unknown in 64-bit builds

That implies we need to differentiate between a variable set but empty
and an empty variable. GCC, Clang and the Intel compiler accept -msse2
on 64-bit builds without warning (they also accept -mno-sse2), but the
Microsoft compiler does not have that option.

Change-Id: I54233388ba10994996ae3e749fd829085e8fd7b7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Thiago Macieira 2015-11-16 14:56:07 -08:00
parent d386ec1fd8
commit 4242fe0a03
9 changed files with 21 additions and 14 deletions

View File

@ -1,5 +1,5 @@
SOURCES = avx.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(QMAKE_CFLAGS_AVX):error("This compiler does not support AVX")
!defined(QMAKE_CFLAGS_AVX, "var"):error("This compiler does not support AVX")
else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX

View File

@ -1,5 +1,5 @@
SOURCES = avx2.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(QMAKE_CFLAGS_AVX2):error("This compiler does not support AVX2")
!defined(QMAKE_CFLAGS_AVX2, "var"):error("This compiler does not support AVX2")
else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2

View File

@ -2,11 +2,11 @@ SOURCES = avx512.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(AVX512): error("You must set the AVX512 variable!")
!defined(AVX512, "var"): error("You must set the AVX512 variable!")
varname = QMAKE_CFLAGS_AVX512$$AVX512
value = $$eval($$varname)
isEmpty($$varname): error("This compiler does not support AVX512")
!defined($$varname, "var"): error("This compiler does not support AVX512")
QMAKE_CXXFLAGS += $$value
DEFINES += AVX512WANT=$$AVX512

View File

@ -1,5 +1,5 @@
SOURCES = sse2.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(QMAKE_CFLAGS_SSE2):error("This compiler does not support SSE2")
!defined(QMAKE_CFLAGS_SSE2, var): error("This compiler does not support SSE2")
else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE2

View File

@ -1,5 +1,5 @@
SOURCES = sse3.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(QMAKE_CFLAGS_SSE3):error("This compiler does not support SSE3")
!defined(QMAKE_CFLAGS_SSE3, "var"):error("This compiler does not support SSE3")
else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE3

View File

@ -1,5 +1,5 @@
SOURCES = sse4_1.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(QMAKE_CFLAGS_SSE4_1):error("This compiler does not support SSE4.1")
!defined(QMAKE_CFLAGS_SSE4_1, "var"):error("This compiler does not support SSE4.1")
else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_1

View File

@ -1,5 +1,5 @@
SOURCES = sse4_2.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(QMAKE_CFLAGS_SSE4_2):error("This compiler does not support SSE4.2")
!defined(QMAKE_CFLAGS_SSE4_2, "var"):error("This compiler does not support SSE4.2")
else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_2

View File

@ -1,5 +1,5 @@
SOURCES = ssse3.cpp
CONFIG -= qt dylib release debug_and_release
CONFIG += debug console
isEmpty(QMAKE_CFLAGS_SSSE3):error("This compiler does not support SSSE3")
!defined(QMAKE_CFLAGS_SSSE3, "var"):error("This compiler does not support SSSE3")
else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSSE3

View File

@ -35,11 +35,18 @@ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MDd
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_LTCG = -GL
QMAKE_CFLAGS_SSE2 = -arch:SSE2
QMAKE_CFLAGS_SSE3 = -arch:SSE2
QMAKE_CFLAGS_SSSE3 = -arch:SSE2
QMAKE_CFLAGS_SSE4_1 = -arch:SSE2
QMAKE_CFLAGS_SSE4_2 = -arch:SSE2
contains(QMAKE_TARGET.arch, x86_64) {
# SSE2 is mandatory on 64-bit mode, so skip the option. It triggers:
# cl : Command line warning D9002 : ignoring unknown option '-arch:SSE2'
QMAKE_CFLAGS_SSE2 =
} else {
QMAKE_CFLAGS_SSE2 = -arch:SSE2
}
QMAKE_CFLAGS_SSE3 = $$QMAKE_CFLAGS_SSE2
QMAKE_CFLAGS_SSSE3 = $$QMAKE_CFLAGS_SSE2
QMAKE_CFLAGS_SSE4_1 = $$QMAKE_CFLAGS_SSE2
QMAKE_CFLAGS_SSE4_2 = $$QMAKE_CFLAGS_SSE2
QMAKE_CXX = $$QMAKE_CC
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS