From b99e7f6041add66e4cb09cc7f71801e2785fdd50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Devernay?= <frederic.devernay@m4x.org>
Date: Fri, 8 Dec 2017 11:54:09 +0100
Subject: [PATCH] fix CONFIG+=fast

---
 INSTALL_OSX.md | 10 ++++++++--
 global.pri     | 14 ++++++++++----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/INSTALL_OSX.md b/INSTALL_OSX.md
index 4fbbe5b2e2..139c82a33e 100644
--- a/INSTALL_OSX.md
+++ b/INSTALL_OSX.md
@@ -216,7 +216,10 @@ config.pri:
 cat > config.pri << EOF
 boost: INCLUDEPATH += /opt/local/include
 boost: LIBS += -L/opt/local/lib -lboost_serialization-mt
-openmp {
+macx:openmp {
+  QMAKE_CC=/opt/local/bin/clang-mp-5.0
+  QMAKE_CXX=/opt/local/bin/clang++-mp-5.0
+  
   INCLUDEPATH += /opt/local/include/libomp
   LIBS += -L/opt/local/lib/libomp -liomp5
   cc_setting.name = CC
@@ -246,7 +249,10 @@ boost: LIBS += -L/usr/local/lib -lboost_serialization-mt -lboost_thread-mt -lboo
 expat: PKGCONFIG -= expat
 expat: INCLUDEPATH += /usr/local/opt/expat/include
 expat: LIBS += -L/usr/local/opt/expat/lib -lexpat
-openmp {
+macx:openmp {
+  QMAKE_CC=/usr/local/opt/llvm/bin/clang
+  QMAKE_CXX=/usr/local/opt/llvm/bin/clang++
+
   LIBS += -L/usr/local/opt/llvm/lib -liomp5
   cc_setting.name = CC
   cc_setting.value = /usr/local/opt/llvm/bin/clang
diff --git a/global.pri b/global.pri
index dd07fe78fa..f9cd5d711e 100644
--- a/global.pri
+++ b/global.pri
@@ -64,10 +64,16 @@ run-without-python {
         QMAKE_LFLAGS_RELEASE =
     }
     CONFIG(fast) {
-        QMAKE_CFLAGS += -Ofast
-        QMAKE_CFLAGS -= -O2 -O3
-        QMAKE_CXXFLAGS += -Ofast
-        QMAKE_CXXFLAGS -= -O2 -O3
+        QMAKE_CFLAGS_RELEASE += -Ofast
+        QMAKE_CFLAGS_RELEASE -= -O -O2 -O3
+        QMAKE_CXXFLAGS_RELEASE += -Ofast
+        QMAKE_CXXFLAGS_RELEASE -= -O -O2 -O3
+        QMAKE_CFLAGS_DEBUG += -Ofast
+        QMAKE_CFLAGS_DEBUG -= -O -O2 -O3
+        QMAKE_CXXFLAGS_DEBUG += -Ofast
+        QMAKE_CXXFLAGS_DEBUG -= -O -O2 -O3
+        QMAKE_CXXFLAGS -= -O -O2 -O3
+        QMAKE_CFLAGS -= -O -O2 -O3
     }
 }