Move the QT_COMPILER_SUPPORTS_xxx defines to qconfig.h
authorThiago Macieira <thiago.macieira@intel.com>
Sat, 11 Aug 2012 20:55:04 +0000 (22:55 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 22 Aug 2012 19:58:45 +0000 (21:58 +0200)
This reduces dramatically the command-line for compiling Qt sources.

These are private macros, only to be used by Qt's own modules, so the
compiler setting is either the same or, possibly, better. In other
words, in the worst case, when compiling a module with a better
compiler than for qtbase, such module might not enable all the
functionality it could otherwise do.

If we switch to a buildsystem that can support this properly in the
future, these macros should be removed.

Change-Id: I71f2d12ec98c9dd40eaab9de4a17446bd1066020
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
configure
mkspecs/features/qt_build_config.prf
tools/configure/configureapp.cpp

index cbd92da..9da128c 100755 (executable)
--- a/configure
+++ b/configure
@@ -5715,6 +5715,20 @@ if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
 fi
 
+# Add compiler sub-architecture support
+echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
+echo "// Compiler sub-arch support" >>"$outpath/src/corelib/global/qconfig.h.new"
+for SUBARCH in SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2 \
+    IWMMXT NEON \
+    MIPS_DSP MIPS_DSPR2; do
+    eval "VAL=\$CFG_$SUBARCH"
+    case "$VAL" in
+        yes)
+            echo "#define QT_COMPILER_SUPPORTS_$SUBARCH" \
+                >>"$outpath/src/corelib/global/qconfig.h.new"
+            ;;
+    esac
+done
 
 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
 
@@ -5744,7 +5758,6 @@ for DRIVER in $CFG_SQL_AVAILABLE; do
     esac
 done
 
-
 QMakeVar set sql-drivers "$SQL_DRIVERS"
 QMakeVar set sql-plugins "$SQL_PLUGINS"
 
index 3f48a20..6b41229 100644 (file)
@@ -17,16 +17,3 @@ mac {
 
 # Qt modules get compiled without exceptions enabled by default
 CONFIG += exceptions_off
-
-#SIMD defines:
-sse2:DEFINES += QT_COMPILER_SUPPORTS_SSE2
-sse3:DEFINES += QT_COMPILER_SUPPORTS_SSE3
-ssse3:DEFINES += QT_COMPILER_SUPPORTS_SSSE3
-sse4_1:DEFINES += QT_COMPILER_SUPPORTS_SSE4_1
-sse4_2:DEFINES += QT_COMPILER_SUPPORTS_SSE4_2
-avx:DEFINES += QT_COMPILER_SUPPORTS_AVX
-avx2:DEFINES += QT_COMPILER_SUPPORTS_AVX2
-iwmmxt:DEFINES += QT_COMPILER_SUPPORTS_IWMMXT
-neon:DEFINES += QT_COMPILER_SUPPORTS_NEON
-mips_dsp:DEFINES += QT_COMPILER_SUPPORTS_MIPS_DSP
-mips_dspr2:DEFINES += QT_COMPILER_SUPPORTS_MIPS_DSPR2
index 29f6de9..2d80325 100644 (file)
@@ -3053,6 +3053,27 @@ void Configure::generateConfigfiles()
             tmpStream << endl;
         }
 
+        tmpStream << endl << "// Compiler sub-arch support" << endl;
+        if (dictionary[ "SSE2" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_SSE2" << endl;
+        if (dictionary[ "SSE3" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_SSE3" << endl;
+        if (dictionary[ "SSSE3" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_SSSE3" << endl;
+        if (dictionary[ "SSE4_1" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_1" << endl;
+        if (dictionary[ "SSE4_2" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_2" << endl;
+        if (dictionary[ "AVX" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_AVX" << endl;
+        if (dictionary[ "AVX2" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_AVX2" << endl;
+        if (dictionary[ "IWMMXT" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_IWMMXT" << endl;
+        if (dictionary[ "NEON" ] == "yes")
+            tmpStream << "#define QT_COMPILER_SUPPORTS_NEON" << endl;
+
+
         tmpStream << endl << "// Compile time features" << endl;
 
         QStringList qconfigList;