From 6a51062e996ec38b3ebc1e0de04af73a5c62a1a0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 31 May 2012 14:58:53 +0200 Subject: [PATCH] Move the SSE2/AVX/Neon/etc. flags into the compiler mkspecs This allows us to have different flags for the compilers for supporting the same feature. For example, the official flag in GCC to support AVX2 is -mavx2, but ICC does not support it (yet), requiring -march=core-avx2 or -xCORE-AVX2. That flag, instead, enables support for all the features that the "Core-AVX2" processor (codename Haswell) will support. And clearly, the MSVC flags are different. Change-Id: I33b6d8617520925e807747180a8dbaafd79b7a9a Reviewed-by: Sean Harmer Reviewed-by: Oswald Buddenhagen --- config.tests/unix/avx/avx.pro | 2 + config.tests/unix/avx2/avx2.pro | 2 + config.tests/unix/iwmmxt/iwmmxt.pro | 3 +- config.tests/unix/neon/neon.pro | 2 + config.tests/unix/sse2/sse2.pro | 2 + config.tests/unix/sse3/sse3.pro | 2 + config.tests/unix/sse4_1/sse4_1.pro | 2 + config.tests/unix/sse4_2/sse4_2.pro | 2 + config.tests/unix/ssse3/ssse3.pro | 2 + configure | 18 +++--- mkspecs/common/clang.conf | 10 ++++ mkspecs/common/gcc-base.conf | 10 ++++ mkspecs/linux-icc/qmake.conf | 8 +++ mkspecs/win32-g++/qmake.conf | 9 +++ mkspecs/win32-msvc11/qmake.conf | 7 +++ mkspecs/win32-msvc2005/qmake.conf | 5 ++ mkspecs/win32-msvc2008/qmake.conf | 5 ++ mkspecs/win32-msvc2010/qmake.conf | 7 +++ src/gui/gui.pro | 86 +++++++++++++++-------------- 19 files changed, 133 insertions(+), 51 deletions(-) diff --git a/config.tests/unix/avx/avx.pro b/config.tests/unix/avx/avx.pro index 00a05500eb..f16f7e8f4d 100644 --- a/config.tests/unix/avx/avx.pro +++ b/config.tests/unix/avx/avx.pro @@ -1,3 +1,5 @@ SOURCES = avx.cpp CONFIG -= x11 qt mac:CONFIG -= app_bundle +isEmpty(QMAKE_CFLAGS_AVX):error("This compiler does not support AVX") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX diff --git a/config.tests/unix/avx2/avx2.pro b/config.tests/unix/avx2/avx2.pro index 48374f11c4..09590a8379 100644 --- a/config.tests/unix/avx2/avx2.pro +++ b/config.tests/unix/avx2/avx2.pro @@ -1,3 +1,5 @@ SOURCES = avx2.cpp CONFIG -= x11 qt mac:CONFIG -= app_bundle +isEmpty(QMAKE_CFLAGS_AVX2):error("This compiler does not support AVX2") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2 diff --git a/config.tests/unix/iwmmxt/iwmmxt.pro b/config.tests/unix/iwmmxt/iwmmxt.pro index 20a5f1a546..f463176d5c 100644 --- a/config.tests/unix/iwmmxt/iwmmxt.pro +++ b/config.tests/unix/iwmmxt/iwmmxt.pro @@ -1,3 +1,4 @@ SOURCES = iwmmxt.cpp CONFIG -= x11 qt - +isEmpty(QMAKE_CFLAGS_IWMMXT):error("This compiler does not support iWMMXt") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_IWMMXT diff --git a/config.tests/unix/neon/neon.pro b/config.tests/unix/neon/neon.pro index de20c4e0ab..efd608bd63 100644 --- a/config.tests/unix/neon/neon.pro +++ b/config.tests/unix/neon/neon.pro @@ -1,2 +1,4 @@ SOURCES = neon.cpp CONFIG -= x11 qt +isEmpty(QMAKE_CFLAGS_NEON):error("This compiler does not support Neon") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_NEON diff --git a/config.tests/unix/sse2/sse2.pro b/config.tests/unix/sse2/sse2.pro index d4a21aad1a..13f252ae48 100644 --- a/config.tests/unix/sse2/sse2.pro +++ b/config.tests/unix/sse2/sse2.pro @@ -1,3 +1,5 @@ SOURCES = sse2.cpp CONFIG -= x11 qt mac:CONFIG -= app_bundle +isEmpty(QMAKE_CFLAGS_SSE2):error("This compiler does not support SSE2") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE2 diff --git a/config.tests/unix/sse3/sse3.pro b/config.tests/unix/sse3/sse3.pro index 009fea230a..8d9853ce77 100644 --- a/config.tests/unix/sse3/sse3.pro +++ b/config.tests/unix/sse3/sse3.pro @@ -1,3 +1,5 @@ SOURCES = sse3.cpp CONFIG -= x11 qt mac:CONFIG -= app_bundle +isEmpty(QMAKE_CFLAGS_SSE3):error("This compiler does not support SSE3") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE3 diff --git a/config.tests/unix/sse4_1/sse4_1.pro b/config.tests/unix/sse4_1/sse4_1.pro index c6c4746026..539517605d 100644 --- a/config.tests/unix/sse4_1/sse4_1.pro +++ b/config.tests/unix/sse4_1/sse4_1.pro @@ -1,3 +1,5 @@ SOURCES = sse4_1.cpp CONFIG -= x11 qt mac:CONFIG -= app_bundle +isEmpty(QMAKE_CFLAGS_SSE4_1):error("This compiler does not support SSE4.1") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_1 diff --git a/config.tests/unix/sse4_2/sse4_2.pro b/config.tests/unix/sse4_2/sse4_2.pro index cab171114d..044eb197af 100644 --- a/config.tests/unix/sse4_2/sse4_2.pro +++ b/config.tests/unix/sse4_2/sse4_2.pro @@ -1,3 +1,5 @@ SOURCES = sse4_2.cpp CONFIG -= x11 qt mac:CONFIG -= app_bundle +isEmpty(QMAKE_CFLAGS_SSE4_2):error("This compiler does not support SSE4.2") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_2 diff --git a/config.tests/unix/ssse3/ssse3.pro b/config.tests/unix/ssse3/ssse3.pro index 4864267c8f..dd86c41abb 100644 --- a/config.tests/unix/ssse3/ssse3.pro +++ b/config.tests/unix/ssse3/ssse3.pro @@ -1,3 +1,5 @@ SOURCES = ssse3.cpp CONFIG -= x11 qt mac:CONFIG -= app_bundle +isEmpty(QMAKE_CFLAGS_SSSE3):error("This compiler does not support SSSE3") +else:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSSE3 diff --git a/configure b/configure index 43093634da..5ea96ec657 100755 --- a/configure +++ b/configure @@ -3757,7 +3757,7 @@ fi # detect sse2 support if [ "${CFG_SSE2}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse2"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then CFG_SSE2=yes else CFG_SSE2=no @@ -3766,7 +3766,7 @@ fi # detect sse3 support if [ "${CFG_SSE3}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse3"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then CFG_SSE3=yes else CFG_SSE3=no @@ -3775,7 +3775,7 @@ fi # detect ssse3 support if [ "${CFG_SSSE3}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mssse3"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then CFG_SSSE3=yes else CFG_SSSE3=no @@ -3784,7 +3784,7 @@ fi # detect sse4.1 support if [ "${CFG_SSE4_1}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_1 "sse4_1" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse4.1"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_1 "sse4_1" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then CFG_SSE4_1=yes else CFG_SSE4_1=no @@ -3793,7 +3793,7 @@ fi # detect sse4.2 support if [ "${CFG_SSE4_2}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_2 "sse4_2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse4.2"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_2 "sse4_2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then CFG_SSE4_2=yes else CFG_SSE4_2=no @@ -3802,7 +3802,7 @@ fi # detect avx support if [ "${CFG_AVX}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mavx"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then case "$XQMAKESPEC" in *g++*|*-clang*) # Some clang versions produce internal compiler errors compiling Qt AVX code @@ -3832,7 +3832,7 @@ if [ "${CFG_AVX}" = "no" ]; then CFG_AVX2=no fi if [ "${CFG_AVX2}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx2 "avx2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-march=core-avx2"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx2 "avx2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then CFG_AVX2=yes else CFG_AVX2=no @@ -3841,7 +3841,7 @@ fi # check iWMMXt support if [ "$CFG_IWMMXT" = "yes" ]; then - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mcpu=iwmmxt" + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS if [ $? != "0" ]; then echo "The iWMMXt functionality test failed!" echo " Please make sure your compiler supports iWMMXt intrinsics!" @@ -3851,7 +3851,7 @@ fi # detect neon support if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/neon "neon" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mfpu=neon"; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/neon "neon" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then CFG_NEON=yes else CFG_NEON=no diff --git a/mkspecs/common/clang.conf b/mkspecs/common/clang.conf index 67fdf4c1f4..54ac56968b 100644 --- a/mkspecs/common/clang.conf +++ b/mkspecs/common/clang.conf @@ -18,3 +18,13 @@ QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE QMAKE_CXXFLAGS_CXX11 = -std=c++11 QMAKE_LFLAGS_CXX11 = + +QMAKE_CFLAGS_SSE2 += -msse2 +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_IWMMXT += -mcpu=iwmmxt +QMAKE_CFLAGS_NEON += -mfpu=neon diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf index a944dd71a3..43ebc0ab3a 100644 --- a/mkspecs/common/gcc-base.conf +++ b/mkspecs/common/gcc-base.conf @@ -63,3 +63,13 @@ QMAKE_LFLAGS_DEBUG += QMAKE_LFLAGS_APP += QMAKE_LFLAGS_RELEASE += QMAKE_LFLAGS_EXCEPTIONS_OFF += + +QMAKE_CFLAGS_SSE2 += -msse2 +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_IWMMXT += -mcpu=iwmmxt +QMAKE_CFLAGS_NEON += -mfpu=neon diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index eb837254e1..5eb0650fbf 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -24,6 +24,14 @@ QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_THREAD = -D_REENTRANT +QMAKE_CFLAGS_SSE2 += -xSSE2 +QMAKE_CFLAGS_SSE3 += -xSSE3 +QMAKE_CFLAGS_SSSE3 += -xSSSE3 +QMAKE_CFLAGS_SSE4_1 += -xSSE4.1 +QMAKE_CFLAGS_SSE4_2 += -xSSE4.2 +QMAKE_CFLAGS_AVX += -xAVX +QMAKE_CFLAGS_AVX2 += -xCORE-AVX2 + QMAKE_CXX = icpc QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index 2d60d86a8f..1e98789d9d 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -26,6 +26,15 @@ QMAKE_CFLAGS_WARN_OFF = -w QMAKE_CFLAGS_RELEASE = -O2 QMAKE_CFLAGS_DEBUG = -g QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses +QMAKE_CFLAGS_SSE2 = -msse2 +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_IWMMXT = -mcpu=iwmmxt +QMAKE_CFLAGS_NEON = -mfpu=neon QMAKE_CXX = g++ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/mkspecs/win32-msvc11/qmake.conf b/mkspecs/win32-msvc11/qmake.conf index 3c33182e8c..0603c10f0c 100644 --- a/mkspecs/win32-msvc11/qmake.conf +++ b/mkspecs/win32-msvc11/qmake.conf @@ -25,6 +25,13 @@ QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL QMAKE_CFLAGS_MP = -MP +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 +QMAKE_CFLAGS_AVX = -arch:AVX +QMAKE_CFLAGS_AVX2 = -arch:AVX QMAKE_CXX = $$QMAKE_CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 2467dbc163..e093ddfffb 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -24,6 +24,11 @@ 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 QMAKE_CXX = $$QMAKE_CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 72c9a9eaf6..71969ab6a2 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -25,6 +25,11 @@ QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL QMAKE_CFLAGS_MP = -MP +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 QMAKE_CXX = $$QMAKE_CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index c579257f63..9499cab729 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -25,6 +25,13 @@ QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL QMAKE_CFLAGS_MP = -MP +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 +QMAKE_CFLAGS_AVX = -arch:AVX +QMAKE_CFLAGS_AVX2 = -arch:AVX QMAKE_CXX = $$QMAKE_CC QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 3accb0b593..7498f48d6d 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -38,30 +38,14 @@ include(animation/animation.pri) QMAKE_LIBS += $$QMAKE_LIBS_GUI -neon:*-g++* { - HEADERS += $$NEON_HEADERS - - DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM - - neon_compiler.commands = $$QMAKE_CXX -c - neon_compiler.commands += $(CXXFLAGS) -mfpu=neon $(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)} - neon_compiler.input = DRAWHELPER_NEON_ASM_FILES NEON_SOURCES - neon_compiler.variable_out = OBJECTS - neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} - silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands - QMAKE_EXTRA_COMPILERS += neon_compiler -} - win32:!contains(QT_CONFIG, directwrite) { DEFINES += QT_NO_DIRECTWRITE } - win32-g++*|!win32:!win32-icc*:!macx-icc* { +*-g++*|linux-icc*|*-clang { sse2 { sse2_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - sse2_compiler.commands += -msse2 + 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)} @@ -73,7 +57,7 @@ win32:!contains(QT_CONFIG, directwrite) { } ssse3 { ssse3_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - ssse3_compiler.commands += -mssse3 + 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)} @@ -85,7 +69,7 @@ win32:!contains(QT_CONFIG, directwrite) { } avx { avx_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - avx_compiler.commands += -mavx + 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)} @@ -95,9 +79,25 @@ win32:!contains(QT_CONFIG, directwrite) { silent:avx_compiler.commands = @echo compiling[avx] ${QMAKE_FILE_IN} && $$avx_compiler.commands QMAKE_EXTRA_COMPILERS += avx_compiler } + neon { + HEADERS += $$NEON_HEADERS + + DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM + + neon_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) + 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)} + neon_compiler.input = DRAWHELPER_NEON_ASM_FILES NEON_SOURCES + neon_compiler.variable_out = OBJECTS + neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} + silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands + QMAKE_EXTRA_COMPILERS += neon_compiler + } iwmmxt { iwmmxt_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) - iwmmxt_compiler.commands += -mcpu=iwmmxt + iwmmxt_compiler.commands += $$QMAKE_CFLAGS_IWMMXT iwmmxt_compiler.commands += $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} iwmmxt_compiler.dependency_type = TYPE_C iwmmxt_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} @@ -107,26 +107,30 @@ win32:!contains(QT_CONFIG, directwrite) { silent:iwmmxt_compiler.commands = @echo compiling[iwmmxt] ${QMAKE_FILE_IN} && $$iwmmxt_compiler.commands QMAKE_EXTRA_COMPILERS += iwmmxt_compiler } - } else { - sse2: SOURCES += $$SSE2_SOURCES - ssse3: SOURCES += $$SSSE3_SOURCES - iwmmxt: SOURCES += $$IWMMXT_SOURCES - } + mips_dsp { + HEADERS += $$MIPS_DSP_HEADERS -mips_dsp:*-g++* { - HEADERS += $$MIPS_DSP_HEADERS - - DRAWHELPER_MIPS_DSP_ASM_FILES = $$MIPS_DSP_ASM - mips_dspr2 { - DRAWHELPER_MIPS_DSP_ASM_FILES += $$MIPS_DSPR2_ASM + DRAWHELPER_MIPS_DSP_ASM_FILES = $$MIPS_DSP_ASM + mips_dspr2:DRAWHELPER_MIPS_DSP_ASM_FILES += $$MIPS_DSPR2_ASM + mips_dsp_compiler.commands = $$QMAKE_CXX -c + mips_dsp_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + mips_dsp_compiler.dependency_type = TYPE_C + mips_dsp_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + mips_dsp_compiler.input = DRAWHELPER_MIPS_DSP_ASM_FILES MIPS_DSP_SOURCES + mips_dsp_compiler.variable_out = OBJECTS + mips_dsp_compiler.name = compiling[mips_dsp] ${QMAKE_FILE_IN} + silent:mips_dsp_compiler.commands = @echo compiling[mips_dsp] ${QMAKE_FILE_IN} && $$mips_dsp_compiler.commands + QMAKE_EXTRA_COMPILERS += mips_dsp_compiler } - mips_dsp_compiler.commands = $$QMAKE_CXX -c - mips_dsp_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} - mips_dsp_compiler.dependency_type = TYPE_C - mips_dsp_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} - mips_dsp_compiler.input = DRAWHELPER_MIPS_DSP_ASM_FILES MIPS_DSP_SOURCES - mips_dsp_compiler.variable_out = OBJECTS - mips_dsp_compiler.name = compiling[mips_dsp] ${QMAKE_FILE_IN} - silent:mips_dsp_compiler.commands = @echo compiling[mips_dsp] ${QMAKE_FILE_IN} && $$mips_dsp_compiler.commands - QMAKE_EXTRA_COMPILERS += mips_dsp_compiler +} else { + # This serves two purposes: + # 1) it allows an IDE like Creator to know that these files are part of the sources + # 2) with MSVC, we are allowed to build the extra helpers + # but we only build the SSE2 and SSSE3 ones for now since the AVX ones are just + # the other two with the VEX prefix + win32-msvc*: SOURCES += $$SSE2_SOURCES $$SSSE3_SOURCES + false: SOURCES += $$NEON_SOURCES $$NEON_ASM \ + $$IWMMXT_SOURCES \ + $$AVX_SOURCES \ + $$MIPS_DSP_SOURCES $$MIPS_DSP_ASM $$MIPS_DSPR2_ASM }