Files
pilotclient/mkspecs/features/common_pre.prf
2019-02-22 20:23:28 +00:00

209 lines
6.4 KiB
Plaintext

# 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.
################################
# Destination tree
################################
CONFIG(debug, debug|release): DestRoot = $$DestRootDebug
else: DestRoot = $$DestRootRelease
################################
# Build configuration
################################
include(config.pri)
################################
# Version number
################################
setSwiftConfig(version.full, $$swiftConfig(version.major).$$swiftConfig(version.minor).$$swiftConfig(version.micro))
!win32 {
VER_MAJ = $$swiftConfig(version.major)
VER_MIN = $$swiftConfig(version.minor)
VER_MIC = $$swiftConfig(version.micro)
VERSION = $$swiftConfig(version.full)
}
################################
# QMake options
################################
CONFIG += qt
CONFIG += warn_on
CONFIG += c++14
################################
# Detect 32 or 64 bit
################################
include(wordsize.pri)
################################
# Multithreaded build in VS IDE
################################
contains(TEMPLATE, "vc.*"): QMAKE_CXXFLAGS *= /MP
################################
# Profile build
################################
swiftConfig(profileRelease) {
msvc {
QMAKE_CXXFLAGS_RELEASE *= /Zi
QMAKE_LFLAGS_RELEASE *= /DEBUG /PROFILE /INCREMENTAL:NO /OPT:REF /OPT:ICF
}
}
################################
# Workaround C1128 error
################################
msvc:!llvm: QMAKE_CXXFLAGS *= /bigobj
################################
# Force UTF-8 source code in MSVC
################################
msvc: QMAKE_CXXFLAGS *= /utf-8
# msvc: QMAKE_CXXFLAGS *= /source-charset:utf-8
# /utf-8 sets both the source charset and execution charset to UTF-8
################################
# No gigantic MinGW obj files
################################
# To reduce the size of MinGW binaries, uncomment the first and comment the second line
# win32-g++: CONFIG += optimize_debug
win32-g++: QMAKE_CXXFLAGS *= -Wa,-mbig-obj
################################
# FSX or FS9 on 32bit Windows only
################################
!win32: disableSwiftConfig(sims.p3d)
equals(WORD_SIZE,64)|!win32: disableSwiftConfig(sims.fsx, sims.fs9)
# equals(WORD_SIZE,64):win32-g++: disableSwiftConfig(sims.p3d)
################################
# For BlackMisc::getStackTrace
################################
linux-g++: QMAKE_LFLAGS_DEBUG *= -rdynamic
################################
# Suppress stupid warnings
################################
include(warnings.pri)
################################
# Handle addresses larger than 2GB
################################
equals(WORD_SIZE,32) {
win32-g++: QMAKE_LFLAGS *= -Wl,--large-address-aware
}
################################
# Externals
################################
include(externals.pri)
################################
# Includes
################################
INCLUDEPATH *= $$BuildRoot/src
################################
# Platform extensions
################################
isEmpty(QMAKE_EXTENSION_SHLIB) {
mac|ios: QMAKE_EXTENSION_SHLIB = dylib
else:win*: QMAKE_EXTENSION_SHLIB = dll
else: QMAKE_EXTENSION_SHLIB = so
}
isEmpty(QMAKE_EXTENSION_EXE) {
win32: QMAKE_EXTENSION_EXE = exe
}
################################
# Install prefix
################################
isEmpty(PREFIX) {
PREFIX = $$BuildRoot/dist
}
################################
# Debug Suffix
################################
win32: CONFIG(debug, debug|release): DLL_DEBUG_SUFFIX = d
################################
# Inter-project dependencies
################################
defineTest(addStaticLibraryDependency) {
win32:msvc: PRE_TARGETDEPS += $$DestRoot/lib/$${1}.lib
else: PRE_TARGETDEPS += $$DestRoot/lib/lib$${1}.a
export(PRE_TARGETDEPS)
}
defineTest(addLibraryDependency) {
swiftConfig(static) {
addStaticLibraryDependency($$1)
}
else {
win32:msvc: PRE_TARGETDEPS += $$DestRoot/lib/$${1}.lib
win32-g++*: PRE_TARGETDEPS += $$DestRoot/lib/lib$${1}.a
linux-g++*: PRE_TARGETDEPS += $$DestRoot/lib/lib$${1}.so
macx-clang: PRE_TARGETDEPS += $$DestRoot/lib/lib$${1}.dylib
export(PRE_TARGETDEPS)
}
}
################################
# Workarounds needed when using MSVC /permissive- flag
################################
msvc:contains(QMAKE_CXXFLAGS, /permissive-): QMAKE_CXXFLAGS *= /FIpermissiveworkarounds.h
################################
# Experimental support for Clang on Windows
################################
clang_cl {
# Address Sanitizer
# https://stackoverflow.com/a/48585886/1639256
# http://lists.llvm.org/pipermail/cfe-dev/2016-April/048288.html
contains(QMAKE_CXXFLAGS, -fsanitize=address) {
SANITIZER_LIB_DIR = $$system(clang -print-resource-dir)\lib\windows
equals(WORD_SIZE,32): SANITIZER_LIB_SUFFIX = i386.lib
equals(WORD_SIZE,64): SANITIZER_LIB_SUFFIX = x86_64.lib
LIBS += $$SANITIZER_LIB_DIR\clang_rt.asan_dynamic-$$SANITIZER_LIB_SUFFIX
QMAKE_LFLAGS += -wholearchive:$$SANITIZER_LIB_DIR\clang_rt.asan_dynamic_runtime_thunk-$$SANITIZER_LIB_SUFFIX
QMAKE_LFLAGS += -include:__asan_seh_interceptor
}
# Suppress warnings in Qt headers
QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH:-I$$system_path($$[QT_HOST_PREFIX])=/imsvc $$system_path($$[QT_HOST_PREFIX])) -Fo$obj $src
QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH:-I$$system_path($$[QT_HOST_PREFIX])=/imsvc $$system_path($$[QT_HOST_PREFIX])) -Fo$@ $<
QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH:-I$$system_path($$[QT_HOST_PREFIX])=/imsvc $$system_path($$[QT_HOST_PREFIX])) -Fo$@ @<<
QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH:-I$$system_path($$[QT_HOST_PREFIX])=/imsvc $$system_path($$[QT_HOST_PREFIX])) -Fo$obj $src
QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH:-I$$system_path($$[QT_HOST_PREFIX])=/imsvc $$system_path($$[QT_HOST_PREFIX])) -Fo$@ $<
QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH:-I$$system_path($$[QT_HOST_PREFIX])=/imsvc $$system_path($$[QT_HOST_PREFIX])) -Fo$@ @<<
}