Cleaned up c++11 config a bit

master
Marius Kintel 2014-11-06 12:53:53 +01:00
parent 637244d59e
commit 2bdf02d352
3 changed files with 40 additions and 35 deletions

38
c++11.pri Normal file
View File

@ -0,0 +1,38 @@
macx {
# Mac needs special care to link against the correct C++ library
# We attempt to auto-detect it by inspecting Boost
dirs = $${BOOSTDIR} $${QMAKE_LIBDIR}
for(dir, dirs) {
system(grep -q __112basic_string $${dir}/libboost_thread* >& /dev/null) {
message("Using libc++11")
CONFIG += libc++
}
else {
message("Using libstdc++")
CONFIG += libstdc++
c++11 {
# libc++ is a requirement for using C++11
warning("Disabling C++11 since libstdc++ dependencies were found")
CONFIG -= c++11
}
}
}
libc++ {
QMAKE_CXXFLAGS += -stdlib=libc++
QMAKE_LFLAGS += -stdlib=libc++
QMAKE_OBJECTIVE_CFLAGS += -stdlib=libc++
# libc++ on requires Mac OS X 10.7+
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
}
}
c++11 {
QMAKE_CXXFLAGS += -std=c++11
message("Using C++11")
}
else {
*clang* {
QMAKE_CXXFLAGS_WARN_ON += -Wno-c++11-extensions
}
}

View File

@ -17,3 +17,4 @@ include(harfbuzz.pri)
include(freetype.pri)
include(fontconfig.pri)
include(scintilla.pri)
include(c++11.pri)

View File

@ -63,8 +63,6 @@ macx:isEmpty(OPENSCAD_LIBDIR) {
QMAKE_LIBDIR = $$OPENSCAD_LIBDIR/lib
}
CONFIG += c++11
# add CONFIG+=deploy to the qmake command-line to make a deployment build
deploy {
message("Building deployment version")
@ -86,41 +84,9 @@ macx {
APP_RESOURCES.files = OpenSCAD.sdef dsa_pub.pem icons/SCAD.icns
QMAKE_BUNDLE_DATA += APP_RESOURCES
LIBS += -framework Cocoa -framework ApplicationServices
# Mac needs special care to link against the correct C++ library
# We attempt to auto-detect it by inspecting Boost
dirs = $${BOOSTDIR} $${QMAKE_LIBDIR}
for(dir, dirs) {
system(grep -q __112basic_string $${dir}/libboost_thread* >& /dev/null) {
message("Using libc++11")
CONFIG += libc++
}
else {
message("Using libstdc++")
CONFIG += libstdc++
}
}
c++11 {
libstdc++: error("libc++ vs. libstdc++ conflict: Dependencies must be linked with libc++")
else: CONFIG += libc++
}
libc++ {
QMAKE_CXXFLAGS += -stdlib=libc++
QMAKE_LFLAGS += -stdlib=libc++
QMAKE_OBJECTIVE_CFLAGS += -stdlib=libc++
# libc++ on requires Mac OS X 10.7+
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
}
}
c++11 {
QMAKE_CXXFLAGS += -std=c++11
message("Using C++11")
}
win* {
RC_FILE = openscad_win32.rc
QTPLUGIN += qtaccessiblewidgets
@ -174,7 +140,6 @@ netbsd* {
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-variable
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function
QMAKE_CXXFLAGS_WARN_ON += -Wno-c++11-extensions
# might want to actually turn this on once in a while
QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare
}
@ -186,6 +151,7 @@ CONFIG(skip-version-check) {
# Application configuration
macx:CONFIG += mdi
CONFIG += c++11
CONFIG += cgal
CONFIG += opencsg
CONFIG += boost