Files
pilotclient/mkspecs/features/common_pre.prf
2021-07-13 17:56:32 +01:00

248 lines
7.6 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
################################
include(version.pri)
################################
# QMake options
################################
CONFIG += qt
CONFIG += warn_on
CONFIG += c++17
################################
# Detect 32 or 64 bit
################################
include(wordsize.pri)
################################
# Multithreaded build in VS IDE
################################
contains(TEMPLATE, "vc.*"): QMAKE_CXXFLAGS *= /MP
################################
# Release build with debug info
################################
swiftConfig(releaseWithDebugInfo):swiftConfig(profileRelease) {
error(releaseWithDebugInfo and profileRelease can not be enabled together,\
as they require different PDB formats.)
}
swiftConfig(releaseWithDebugInfo) {
msvc {
QMAKE_CXXFLAGS_RELEASE *= /Z7
QMAKE_LFLAGS_RELEASE *= /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF
}
unix {
CONFIG += force_debug_info
CONFIG += separate_debug_info
llvm: QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -gline-tables-only
else: QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -g1 -gz
}
}
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
################################
# MinGW: Separate debug info into separate .debug files
################################
win32-g++: CONFIG += separate_debug_info
################################
# FSX or FS9 on 32bit Windows only
################################
!win32: disableSwiftConfig(sims.p3d, sims.msfs)
equals(WORD_SIZE,64)|!win32: disableSwiftConfig(sims.fsx, sims.fs9)
# equals(WORD_SIZE,64):win32-g++: disableSwiftConfig(sims.p3d)
################################
# xswiftbus on 64bit only
################################
equals(WORD_SIZE,32): disableSwiftConfig(sims.xswiftbus)
################################
# For BlackMisc::getStackTrace
################################
linux-g++: QMAKE_LFLAGS_DEBUG *= -rdynamic
################################
# Handle addresses larger than 2GB
################################
equals(WORD_SIZE,32) {
win32-g++: QMAKE_LFLAGS *= -Wl,--large-address-aware
}
################################
# Support different clang drivers
################################
defineReplace(clangArg) {
clang_cl: return(/clang:$$1)
else: return($$1)
}
################################
# Externals
################################
include(externals.pri)
################################
# Enable useful warnings, disable stupid ones
################################
include(warnings.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
################################
msvc: 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:gcc: 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)
}
}
################################
# ISO C++ conformance mode for MSVC
################################
msvc:greaterThan(QMAKE_MSC_VER, 1923): QMAKE_CXXFLAGS *= /permissive-
msvc:contains(QMAKE_CXXFLAGS, /permissive-): QMAKE_CXXFLAGS *= /FI$${SourceRoot}\src\permissiveworkarounds.h
################################
# Experimental support for Clang on Windows
################################
win32:llvm {
mingw {
equals(WORD_SIZE,32): QMAKE_CXXFLAGS += --target=i686-pc-windows-gnu
equals(WORD_SIZE,64): QMAKE_CXXFLAGS += --target=x86_64-pc-windows-gnu
}
else {
CONFIG += c++latest
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations
}
# 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$@ @<<
}