From dbb5a240dacc395b4702c7cbb04804112d033fac Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Tue, 6 Oct 2015 23:33:22 +0100 Subject: [PATCH] refs #482 Added new qmake feature files and includes. --- .qmake.conf | 4 +- mkspecs/features/common_post.prf | 39 +++++++++++ mkspecs/features/common_pre.prf | 112 +++++++++++++++++++++++++++++++ mkspecs/features/config.pri | 15 +++++ mkspecs/features/defines.pri | 14 ++++ mkspecs/features/libraries.pri | 81 ++++++++++++++++++++++ mkspecs/features/version.pri | 4 ++ mkspecs/features/warnings.pri | 11 +++ mkspecs/features/wordsize.pri | 37 ++++++++++ 9 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 mkspecs/features/common_post.prf create mode 100644 mkspecs/features/common_pre.prf create mode 100644 mkspecs/features/config.pri create mode 100644 mkspecs/features/defines.pri create mode 100644 mkspecs/features/libraries.pri create mode 100644 mkspecs/features/version.pri create mode 100644 mkspecs/features/warnings.pri create mode 100644 mkspecs/features/wordsize.pri diff --git a/.qmake.conf b/.qmake.conf index 8305af792..9e677d28a 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,2 +1,4 @@ SourceRoot=$$PWD -BuildRoot=$$shadowed($$PWD) +BuildRoot=$$shadowed($$SourceRoot) +DestRootDebug=$$BuildRoot/out/debug +DestRootRelease=$$BuildRoot/out/release diff --git a/mkspecs/features/common_post.prf b/mkspecs/features/common_post.prf new file mode 100644 index 000000000..5695e201f --- /dev/null +++ b/mkspecs/features/common_post.prf @@ -0,0 +1,39 @@ +################################ +# Externals +################################ + +INCLUDEPATH *= $$EXTERNALDIR/common/include + +# and the library path depending on the used compiler +win32-msvc2010 { + equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/vs2010_64/lib + equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/vs2010_32/lib + equals(WORD_SIZE,32): LIBS += -luser32 +} +win32-msvc2013 { + INCLUDEPATH *= $$EXTERNALDIR/win32-vs2013/include + equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/win32-vs2013/lib64 + equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/win32-vs2013/lib32 + equals(WORD_SIZE,32): LIBS += -luser32 +} +win32-g++ { + INCLUDEPATH *= $$EXTERNALDIR/win32-g++/include + equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/win32-g++/lib64 + equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/win32-g++/lib32 + LIBS += -luser32 +} +linux-g++* { + equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/linux-g++/lib64 + equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/linux-g++/lib32 +} +macx-clang { + INCLUDEPATH *= $$EXTERNALDIR/macx-clang/include + equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/macx-clang/lib64 -F$$EXTERNALDIR/macx-clang/lib64 + equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/macx-clang/lib32 -F$$EXTERNALDIR/macx-clang/lib32 +} + +################################ +# Black libs +################################ + +include(libraries.pri) diff --git a/mkspecs/features/common_pre.prf b/mkspecs/features/common_pre.prf new file mode 100644 index 000000000..f5c088522 --- /dev/null +++ b/mkspecs/features/common_pre.prf @@ -0,0 +1,112 @@ +# Copyright (C) 2015 +# swift project Community / Contributors +# +# This file is part of swift project. It is subject to the license terms in +# the LICENSE file found in the top-level directory of this distribution and +# at http://www.swift-project.org/license.html. No part of swift project, +# including this file, may be copied, modified, propagated, or distributed +# except according to the terms contained in the LICENSE file. + +################################ +# Version number +################################ + +include(version.pri) + +!win32 { + VER_MAJ = $${BLACK_VER_MAJ} + VER_MIN = $${BLACK_VER_MIN} + VER_PAT = $${BLACK_VER_PAT} + VERSION = $${BLACK_VERSION} +} + +################################ +# Destination tree +################################ + +CONFIG(debug, debug|release): DestRoot = $$DestRootDebug +else: DestRoot = $$DestRootRelease + +################################ +# Build configuration +################################ + +include(config.pri) + +################################ +# QMake options +################################ + +CONFIG += qt +CONFIG += warn_on +CONFIG += c++11 + +################################ +# Detect 32 or 64 bit +################################ + +include(wordsize.pri) + +################################ +# Profile build +################################ + +contains(BLACK_CONFIG, ProfileRelease) { + win32-msvc* { + QMAKE_CXXFLAGS_RELEASE *= /Zi + QMAKE_LFLAGS_RELEASE *= /DEBUG /PROFILE /INCREMENTAL:NO /OPT:REF /OPT:ICF + } +} + +# Needed to workaround C1128 error +# TODO check whether this is still needed after CValueObject refactoring +win32-msvc*: QMAKE_CXXFLAGS *= /bigobj + +################################ +# No incremental build +################################ + +# win32-msvc*:QMAKE_LFLAGS_DEBUG *= /INCREMENTAL:NO + +################################ +# No gigantic MinGW obj files +################################ + +win32-g++: QMAKE_CXXFLAGS_DEBUG += -Og + +################################ +# No FSX or FS9 for 64 bit +################################ + +equals(WORD_SIZE,64): BLACK_CONFIG -= FSX FS9 + +################################ +# Suppress stupid warnings +################################ + +include(warnings.pri) + +################################ +# Preprocessor defines +################################ + +include(defines.pri) + +################################ +# Path to external dependencies +################################ + +# If you want to manually set the external path, uncomment the following line +# EXTERNALDIR = /path/to/externals + +isEmpty(EXTERNALDIR) { + EXTERNALDIR = $$(VATSIM_EXTERNAL_DIR) +} + +isEmpty(EXTERNALDIR) { + EXTERNALDIR = $$SourceRoot/externals +} + +!exists("$$EXTERNALDIR/common/include") { + error("Could not find externals in $$EXTERNALDIR. Please install it!") +} diff --git a/mkspecs/features/config.pri b/mkspecs/features/config.pri new file mode 100644 index 000000000..eefe1badc --- /dev/null +++ b/mkspecs/features/config.pri @@ -0,0 +1,15 @@ +BLACK_CONFIG += BlackCore +BLACK_CONFIG += BlackGui +BLACK_CONFIG += BlackSound +BLACK_CONFIG += BlackInput +BLACK_CONFIG += Samples +BLACK_CONFIG += Unittests +BLACK_CONFIG += SwiftData +BLACK_CONFIG += SwiftCore +BLACK_CONFIG += SwiftGui +BLACK_CONFIG += FS9 +BLACK_CONFIG += FSX +BLACK_CONFIG += XPlane +BLACK_CONFIG += ProfileRelease +#BLACK_CONFIG += Static +#BLACK_CONFIG += Doxygen diff --git a/mkspecs/features/defines.pri b/mkspecs/features/defines.pri new file mode 100644 index 000000000..f9038d5d5 --- /dev/null +++ b/mkspecs/features/defines.pri @@ -0,0 +1,14 @@ +DEFINES += BLACK_VERSION=$$BLACK_VERSION + +contains(BLACK_CONFIG, BlackSound) { DEFINES += WITH_BLACKSOUND } +contains(BLACK_CONFIG, BlackInput) { DEFINES += WITH_BLACKINPUT } +contains(BLACK_CONFIG, BlackSim) { DEFINES += WITH_BLACKSIM } +contains(BLACK_CONFIG, BlackCore) { DEFINES += WITH_BLACKCORE } +contains(BLACK_CONFIG, BlackGui) { DEFINES += WITH_BLACKGUI } +contains(BLACK_CONFIG, SwiftData) { DEFINES += WITH_SWIFTDATA } +contains(BLACK_CONFIG, SwiftGui) { DEFINES += WITH_SWIFTGUI } +contains(BLACK_CONFIG, SwiftCore) { DEFINES += WITH_SWIFTCORE } +contains(BLACK_CONFIG, FSX) { DEFINES += WITH_FSX } +contains(BLACK_CONFIG, FS9) { DEFINES += WITH_FS9 } +contains(BLACK_CONFIG, XPlane) { DEFINES += WITH_XPLANE } +contains(BLACK_CONFIG, Static) { DEFINES += WITH_STATIC } diff --git a/mkspecs/features/libraries.pri b/mkspecs/features/libraries.pri new file mode 100644 index 000000000..f3d0d7d2a --- /dev/null +++ b/mkspecs/features/libraries.pri @@ -0,0 +1,81 @@ +LIBS *= -L$$DestRoot/lib + +unix:!macx { + # Set the rpath-link to find dependent shared libraries when linking + # Note: This does not add any rpath into the binaries. + LIBS += -Wl,-rpath-link,$$DestRoot/lib +} + +blackgui { + contains(BLACK_CONFIG, Static) { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackgui.lib + else: PRE_TARGETDEPS += $$DestRoot/lib/libblackgui.a + } else { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackgui.lib + win32-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackgui.a + linux-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackgui.so + macx-clang: PRE_TARGETDEPS += $$DestRoot/lib/libblackgui.dylib + } + + LIBS *= -lblackgui +} + +blackcore { + contains(BLACK_CONFIG, Static) { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackcore.lib + else: PRE_TARGETDEPS += $$DestRoot/lib/libblackcore.a + } else { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackcore.lib + win32-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackcore.a + linux-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackcore.so + macx-clang: PRE_TARGETDEPS += $$DestRoot/lib/libblackcore.dylib + } + + LIBS *= -lblackcore -lvatlib2 + + win32 { + contains(BLACK_CONFIG, FSX) { + LIBS *= -lSimConnect + LIBS *= -lFSUIPC_User + } + } +} + +blacksound { + LIBS *= -lblacksound +} + +blackinput { + contains(BLACK_CONFIG, Static) { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackinput.lib + else: PRE_TARGETDEPS += $$DestRoot/lib/libblackinput.a + } else { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackinput.lib + win32-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackinput.a + linux-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackinput.so + macx-clang: PRE_TARGETDEPS += $$DestRoot/lib/libblackinput.dylib + } + + LIBS *= -lblackinput + + macx { + LIBS += -framework CoreFoundation -framework ApplicationServices -framework Foundation -framework AppKit + } + + win32 { + LIBS *= -ldxguid -lole32 -ldinput8 -lUser32 + } +} + +blackmisc { + contains(BLACK_CONFIG, Static) { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackmisc.lib + else: PRE_TARGETDEPS += $$DestRoot/lib/libblackmisc.a + } else { + win32-msvc*: PRE_TARGETDEPS += $$DestRoot/lib/blackmisc.lib + win32-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackmisc.a + linux-g++*: PRE_TARGETDEPS += $$DestRoot/lib/libblackmisc.so + macx-clang: PRE_TARGETDEPS += $$DestRoot/lib/libblackmisc.dylib + } + LIBS *= -lblackmisc +} diff --git a/mkspecs/features/version.pri b/mkspecs/features/version.pri new file mode 100644 index 000000000..381a2ecf2 --- /dev/null +++ b/mkspecs/features/version.pri @@ -0,0 +1,4 @@ +BLACK_VER_MAJ = 0 +BLACK_VER_MIN = 6 +BLACK_VER_PAT = 1 +BLACK_VERSION = $${BLACK_VER_MAJ}.$${BLACK_VER_MIN}.$${BLACK_VER_PAT} diff --git a/mkspecs/features/warnings.pri b/mkspecs/features/warnings.pri new file mode 100644 index 000000000..60db3e15b --- /dev/null +++ b/mkspecs/features/warnings.pri @@ -0,0 +1,11 @@ +win32-msvc*:DEFINES *= _SCL_SECURE_NO_WARNINGS +# win32-msvc*:QMAKE_CXXFLAGS *= + +# exclude Qt lib warnings +# win32-g++: QMAKE_CXXFLAGS += $$join(QMAKE_INCDIR_QT, " -isystem", "-isystem") + +# swift standard warnings +win32-msvc*:QMAKE_CXXFLAGS_WARN_ON *= /wd4351 /wd4661 + +# elevated warnings +# win32-msvc*:QMAKE_CXXFLAGS_WARN_ON *= /Wall /wd4640 /wd4619 /wd4350 /wd4351 /wd4946 /wd4510 /wd4820 /wd4571 /wd4625 /wd4626 /wd4127 diff --git a/mkspecs/features/wordsize.pri b/mkspecs/features/wordsize.pri new file mode 100644 index 000000000..32659ff30 --- /dev/null +++ b/mkspecs/features/wordsize.pri @@ -0,0 +1,37 @@ +win32-msvc* { + win32:contains(QMAKE_TARGET.arch, x86_64) { + WORD_SIZE = 64 + } + else { + WORD_SIZE = 32 + } +} +win32-g++ { + WIN_FIND = $$(SYSTEMROOT)\system32\find + MINGW64 = $$system($$QMAKE_CXX -Q --help=target | $$WIN_FIND \"-m64\") + contains(MINGW64,[enabled]) { + WORD_SIZE = 64 + } + else { + WORD_SIZE = 32 + } +} +linux-g++ { + GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64) + contains(GCC64,[enabled]) { + WORD_SIZE = 64 + } + else { + WORD_SIZE = 32 + } +} +linux-g++-32 { + WORD_SIZE = 32 +} +linux-g++-64 { + WORD_SIZE = 64 +} +macx-clang { + # TODO + WORD_SIZE = 64 +}