Replace qmake variable BLACK_CONFIG with a system based on json files.

The config is loaded from json files by qmake, and we define the qmake
function `swiftConfig` for checking whether a feature is enabled.
This function can be directly used in `buildconfig_gen.cpp.in`,
so the trick with C++ comment tokens in variables is not needed.
This commit is contained in:
Mat Sutcliffe
2018-11-04 17:13:27 +00:00
parent 188d3d914e
commit 82679a3010
25 changed files with 232 additions and 160 deletions

16
Jenkinsfile vendored
View File

@@ -15,8 +15,8 @@ builders['Build swift Linux'] = {
def eolInMonth = 6 def eolInMonth = 6
withEnv(['BITROCK_BUILDER=/opt/installbuilder/bin/builder', 'BITROCK_CUSTOMIZE=/opt/installbuilder/autoupdate/bin/customize.run']) { withEnv(['BITROCK_BUILDER=/opt/installbuilder/bin/builder', 'BITROCK_CUSTOMIZE=/opt/installbuilder/autoupdate/bin/customize.run']) {
sh ''' sh '''
cp ~/vatsim.pri.official mkspecs/features/vatsim.pri cp ~/vatsim.json .
python3 -u scripts/jenkins.py -w 64 -t gcc -d -j 2 -e ''' + getEolInMonth() + ''' python3 -u scripts/jenkins.py -w 64 -t gcc -d -j 2 -e ''' + getEolInMonth() + ''' -q SWIFT_CONFIG_JSON+=vatsim.json
''' '''
} }
@@ -62,8 +62,8 @@ builders['Build swift MacOS'] = {
stage('MacOS Build') { stage('MacOS Build') {
withEnv(['PATH+LOCAL=/usr/local/bin', 'BITROCK_BUILDER=/Applications/BitRockInstallBuilderQt/bin/builder', 'BITROCK_CUSTOMIZE=/Applications/BitRockInstallBuilderQt/autoupdate/bin/customize.sh']) { withEnv(['PATH+LOCAL=/usr/local/bin', 'BITROCK_BUILDER=/Applications/BitRockInstallBuilderQt/bin/builder', 'BITROCK_CUSTOMIZE=/Applications/BitRockInstallBuilderQt/autoupdate/bin/customize.sh']) {
sh ''' sh '''
cp ~/vatsim.pri.official mkspecs/features/vatsim.pri cp ~/vatsim.json .
python -u scripts/jenkins.py -w 64 -t clang -d -j2 -e ''' + getEolInMonth() + ''' python -u scripts/jenkins.py -w 64 -t clang -d -j2 -e ''' + getEolInMonth() + ''' -q SWIFT_CONFIG_JSON+=vatsim.json
''' '''
} }
@@ -101,8 +101,8 @@ builders['Build swift Win32'] = {
stage('Win32 Build') { stage('Win32 Build') {
bat ''' bat '''
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri copy c:\\var\\vatsim.json .
python -u scripts/jenkins.py -w 32 -t msvc -d -e ''' + getEolInMonth() + ''' python -u scripts/jenkins.py -w 32 -t msvc -d -e ''' + getEolInMonth() + ''' -q SWIFT_CONFIG_JSON+=vatsim.json
''' '''
warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0' warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'
@@ -140,8 +140,8 @@ builders['Build swift Win64'] = {
stage('Win64 Build') { stage('Win64 Build') {
bat ''' bat '''
copy /Y c:\\var\\vatsim.pri.official mkspecs\\features\\vatsim.pri copy c:\\var\\vatsim.json .
python -u scripts/jenkins.py -w 64 -t msvc -d -e ''' + getEolInMonth() + ''' python -u scripts/jenkins.py -w 64 -t msvc -d -e ''' + getEolInMonth() + ''' -q SWIFT_CONFIG_JSON+=vatsim.json
''' '''
warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0' warnings consoleParsers: [[parserName: 'MSBuild']], unstableTotalAll: '0'

37
default.json Normal file
View File

@@ -0,0 +1,37 @@
{
"libs": {
"blackcore": true,
"blackgui": true,
"blacksound": true,
"blackinput": true
},
"samples": true,
"unitTests": true,
"apps": {
"swiftdata": true,
"swiftcore": true,
"swiftgui": true,
"swiftlauncher": true
},
"sims": {
"fs9": true,
"fsx": true,
"p3d": true,
"fsuipc": true,
"xplane": true
},
"profileRelease": true,
"assertsInRelease": true,
"allowNoisyWarnings": false,
"packageInstaller": true,
"static": false,
"doxygen": true,
"devBranch": false,
"stableBranch": false,
"endOfLife": "20190601",
"vatsimSupport": true,
"vatsim": {
"id": "0xb9ba",
"key": "727d1efd5cb9f8d2c28372469d922bb4"
}
}

View File

@@ -57,7 +57,7 @@ contains(TEMPLATE, "vc.*"): QMAKE_CXXFLAGS *= /MP
# Profile build # Profile build
################################ ################################
contains(BLACK_CONFIG, ProfileRelease) { swiftConfig(profileRelease) {
msvc { msvc {
QMAKE_CXXFLAGS_RELEASE *= /Zi QMAKE_CXXFLAGS_RELEASE *= /Zi
QMAKE_LFLAGS_RELEASE *= /DEBUG /PROFILE /INCREMENTAL:NO /OPT:REF /OPT:ICF QMAKE_LFLAGS_RELEASE *= /DEBUG /PROFILE /INCREMENTAL:NO /OPT:REF /OPT:ICF
@@ -90,9 +90,9 @@ win32-g++: QMAKE_CXXFLAGS *= -Wa,-mbig-obj
# FSX or FS9 on 32bit Windows only # FSX or FS9 on 32bit Windows only
################################ ################################
!win32: BLACK_CONFIG -= P3D !win32: disableSwiftConfig(sims.p3d)
equals(WORD_SIZE,64)|!win32: BLACK_CONFIG -= FSX FS9 equals(WORD_SIZE,64)|!win32: disableSwiftConfig(sims.fsx, sims.fs9)
# equals(WORD_SIZE,64):win32-g++: BLACK_CONFIG -= P3D # equals(WORD_SIZE,64):win32-g++: disableSwiftConfig(sims.p3d)
################################ ################################
# For BlackMisc::getStackTrace # For BlackMisc::getStackTrace
@@ -163,7 +163,7 @@ defineTest(addStaticLibraryDependency) {
export(PRE_TARGETDEPS) export(PRE_TARGETDEPS)
} }
defineTest(addLibraryDependency) { defineTest(addLibraryDependency) {
contains(BLACK_CONFIG, Static) { swiftConfig(static) {
addStaticLibraryDependency($$1) addStaticLibraryDependency($$1)
} }
else { else {

View File

@@ -1,63 +1,120 @@
## Public Area ## # Make sure _QMAKE_CACHE_ is initialized (otherwise config.log goes to the root directory)
cache()
BLACK_CONFIG *= BlackCore ################################
BLACK_CONFIG *= BlackGui # Parse json config files
BLACK_CONFIG *= BlackSound ################################
BLACK_CONFIG *= BlackInput
BLACK_CONFIG *= Samples
BLACK_CONFIG *= Unittests
BLACK_CONFIG *= SwiftData
BLACK_CONFIG *= SwiftCore
BLACK_CONFIG *= SwiftGui
BLACK_CONFIG *= SwiftLauncher
BLACK_CONFIG *= FS9
BLACK_CONFIG *= FSX
BLACK_CONFIG *= P3D
BLACK_CONFIG *= XPlane
BLACK_CONFIG *= ProfileRelease
BLACK_CONFIG *= AssertsInRelease
#BLACK_CONFIG *= AllowNoisyWarnings
BLACK_CONFIG *= PackageInstaller
#BLACK_CONFIG *= Static
BLACK_CONFIG *= Doxygen
#BLACK_CONFIG *= SwiftDevBranch
#BLACK_CONFIG *= SwiftStableBranch
BLACK_CONFIG *= FSUIPC
isEmpty(BLACK_EOL): BLACK_EOL = "20190601" # Copy json keys/values from one variable prefix to another, optionally caching the result
defineTest(copyJsonFromTo) {
from = $$1
to = $$2
options = $$3
## Private Area ## unset($${to}._KEYS_)
for(key, $${from}._KEYS_) {
$${to}._KEYS_ += $$key
export($${to}._KEYS_)
copyJsonFromTo($${from}.$$key, $${to}.$$key, $$options)
}
contains(options, cache):defined($${to}._KEYS_, var): cache($${to}._KEYS_)
defined($$from, var) {
contains(options, overwrite)|!defined($$to, var) {
eval(newValue = \$\${$$from})
$$to = $$newValue
export($$to)
}
contains(options, cache):defined($$to, var): cache($$to)
}
}
# Options that control how the config works
!swiftNoDefaultJson: SWIFT_CONFIG_JSON = default.json $$SWIFT_CONFIG_JSON
equals(_PRO_FILE_PWD_, $$SourceRoot): CONFIG *= swiftNoCacheConfig
# Parse the json files (or get the values from the cache)
for(jsonFile, SWIFT_CONFIG_JSON) {
contains(jsonFile, [^A-Za-z0-9_\\.]): error(Illegal character in filename \"$$jsonFile\")
jsonPath = $$SourceRoot/$$jsonFile
!exists($$jsonPath): error($$jsonPath not found)
SWIFT_CONFIG_JSON_PATHS += $$jsonPath
export(SWIFT_CONFIG_JSON_PATHS)
swiftNoCacheConfig {
message(Parsing $${jsonFile}...)
jsonBlob = $$cat($$jsonPath, blob)
parseJson(jsonBlob, SWIFT_CONFIG_PARSED.$$jsonFile)
copyJsonFromTo(SWIFT_CONFIG_PARSED.$$jsonFile, SWIFT_CONFIG_PARSED_ALL, overwrite)
}
}
swiftNoCacheConfig {
copyJsonFromTo(SWIFT_CONFIG_PARSED_ALL, SWIFT_CONFIG)
copyJsonFromTo(SWIFT_CONFIG, SWIFT_CONFIG_CACHE, cache overwrite)
}
else {
copyJsonFromTo(SWIFT_CONFIG_CACHE, SWIFT_CONFIG)
}
# Automatically run qmake again when a json file changed
QMAKE_INTERNAL_INCLUDED_FILES *= $$SWIFT_CONFIG_JSON_PATHS
# The line above doesn't work with Qt Creator's MSVC kit, so we report an error as a fallback
load(touch)
system($$TOUCH $$system_path($$BuildRoot/swift_config.cookie)) {
swift_config_changed.target = $$shell_path($$BuildRoot/swift_config.cookie)
swift_config_changed.depends = $$shell_path($$SWIFT_CONFIG_JSON_PATHS)
swift_config_changed.commands = @echo ERROR: swift config changed, please run qmake again >&2 && exit 1
QMAKE_EXTRA_TARGETS += swift_config_changed
PRE_TARGETDEPS += $${swift_config_changed.target}
}
else:msvc {
warning(Failed to create swift_config.cookie, you will need to manually run qmake again after any changes in $$join(SWIFT_CONFIG_JSON, ", ").)
}
################################
# Functions to read json config
################################
defineTest(swiftConfig) {
equals(SWIFT_CONFIG.$$1, true): return(true)
return(false)
}
defineReplace(swiftConfig) {
eval(value = \$\${SWIFT_CONFIG.$$1})
return($$value)
}
################################
# Functions to modify json config
################################
defineTest(setSwiftConfig) {
SWIFT_CONFIG.$$1 = $$2
export(SWIFT_CONFIG.$$1)
}
defineTest(enableSwiftConfig) {
for(arg, ARGS): setSwiftConfig($$arg, true)
}
defineTest(disableSwiftConfig) {
for(arg, ARGS): setSwiftConfig($$arg, false)
}
################################
# Functions for checking dependencies
################################
## Dependency Checks ##
load(configure) load(configure)
defineTest(CheckMandatoryDependency) { defineTest(CheckMandatoryDependency) {
!qtCompileTest($${1}): error(Cannot find $${1} development package. Make sure it is installed. Inspect config.log for more information.) !qtCompileTest($${1}): error(Cannot find $${1} development package. Make sure it is installed. Inspect config.log for more information.)
} }
defineTest(CheckOptionalDependency) { defineTest(CheckOptionalDependency) {
qtCompileTest($${1}) qtCompileTest($${1})
} }
# include vatsim client id and key ################################
include(vatsim.pri) # Global compiler macros
################################
# Header based compiler macros swiftConfig(static) { DEFINES *= WITH_STATIC }
# DEFINES correspond with buildconfig_gen.cpp.in swiftConfig(assertsInRelease) { DEFINES *= QT_FORCE_ASSERTS }
!contains(BLACK_CONFIG, BlackSound) { DEFINE_WITH_BLACKSOUND = "//" }
!contains(BLACK_CONFIG, BlackInput) { DEFINE_WITH_BLACKINPUT = "//" }
!contains(BLACK_CONFIG, BlackCore) { DEFINE_WITH_BLACKCORE = "//" }
!contains(BLACK_CONFIG, BlackGui) { DEFINE_WITH_BLACKGUI = "//" }
!contains(BLACK_CONFIG, SwiftData) { DEFINE_WITH_SWIFTDATA = "//" }
!contains(BLACK_CONFIG, SwiftGui) { DEFINE_WITH_SWIFTGUI = "//" }
!contains(BLACK_CONFIG, SwiftCore) { DEFINE_WITH_SWIFTCORE = "//" }
!contains(BLACK_CONFIG, P3D) { DEFINE_WITH_P3D = "//" }
!contains(BLACK_CONFIG, FSX) { DEFINE_WITH_FSX = "//" }
!contains(BLACK_CONFIG, FS9) { DEFINE_WITH_FS9 = "//" }
!contains(BLACK_CONFIG, FSUIPC) { DEFINE_WITH_FSUIPC = "//" }
!contains(BLACK_CONFIG, XPlane) { DEFINE_WITH_XPLANE = "//" }
!contains(BLACK_CONFIG, SwiftVatsimSupport) { DEFINE_SWIFT_VATSIM_SUPPORT = "//" }
# Global compiler Macros
contains(BLACK_CONFIG, Static) { DEFINES *= WITH_STATIC }
contains(BLACK_CONFIG, AssertsInRelease) { DEFINES *= QT_FORCE_ASSERTS }

View File

@@ -1,4 +1,4 @@
contains(BLACK_CONFIG, Templight) { swiftConfig(templight) {
QMAKE_CXXFLAGS += -Xtemplight -profiler -Xtemplight -ignore-system QMAKE_CXXFLAGS += -Xtemplight -profiler -Xtemplight -ignore-system
QMAKE_CXXFLAGS += -Xtemplight -blacklist -Xtemplight $$PWD/templight_blacklist QMAKE_CXXFLAGS += -Xtemplight -blacklist -Xtemplight $$PWD/templight_blacklist
clang_cl { clang_cl {

View File

@@ -1,5 +1,5 @@
win32:isEmpty(MINGW_IN_SHELL) { win32:isEmpty(MINGW_IN_SHELL) {
TOUCH = copy /y nul TOUCH = copy /y nul >nul
} }
else { else {
TOUCH = touch TOUCH = touch

View File

@@ -1,11 +0,0 @@
# This is in a separate file to allow easy patching.
# VATSIM client id as assigned by VATSIM Network team. The one below is a test key.
# It is working only with VATGER test server.
isEmpty(VATSIM_CLIENT_ID):VATSIM_CLIENT_ID = "0xb9ba"
# VATSIM private key, which belongs to the id above.
isEmpty(VATSIM_CLIENT_PRIVATE_KEY):VATSIM_CLIENT_PRIVATE_KEY = "727d1efd5cb9f8d2c28372469d922bb4"
# Comment the section below to build a version without VATSIM features enabled
BLACK_CONFIG *= SwiftVatsimSupport

View File

@@ -7,7 +7,7 @@ gcc:QMAKE_CXXFLAGS_WARN_ON *= -Woverloaded-virtual
gcc:QMAKE_CXXFLAGS_USE_PRECOMPILE = -Winvalid-pch $$QMAKE_CXXFLAGS_USE_PRECOMPILE gcc:QMAKE_CXXFLAGS_USE_PRECOMPILE = -Winvalid-pch $$QMAKE_CXXFLAGS_USE_PRECOMPILE
# elevated warnings # elevated warnings
contains(BLACK_CONFIG, AllowNoisyWarnings) { swiftConfig(allowNoisyWarnings) {
clang { clang {
QMAKE_CXXFLAGS_WARN_ON *= -Weverything --system-header-prefix=$$[QT_INSTALL_HEADERS] QMAKE_CXXFLAGS_WARN_ON *= -Weverything --system-header-prefix=$$[QT_INSTALL_HEADERS]
QMAKE_CXXFLAGS_WARN_ON += -Wno-system-headers -Wno-c++98-compat-pedantic -Wno-class-varargs -Wno-covered-switch-default QMAKE_CXXFLAGS_WARN_ON += -Wno-system-headers -Wno-c++98-compat-pedantic -Wno-class-varargs -Wno-covered-switch-default
@@ -32,7 +32,7 @@ gcc {
greaterThan(GCC_MAJOR, 5) { greaterThan(GCC_MAJOR, 5) {
QMAKE_CXXFLAGS_WARN_ON *= -Wsuggest-override QMAKE_CXXFLAGS_WARN_ON *= -Wsuggest-override
} }
greaterThan(GCC_MAJOR, 4):contains(BLACK_CONFIG, AllowNoisyWarnings) { greaterThan(GCC_MAJOR, 4):swiftConfig(allowNoisyWarnings) {
QMAKE_CXXFLAGS_WARN_ON *= -Wsuggest-override QMAKE_CXXFLAGS_WARN_ON *= -Wsuggest-override
} }
} }

View File

@@ -45,7 +45,7 @@ class Builder:
shared_path = os.path.abspath(os.path.join(source_path, 'resources', 'share')) shared_path = os.path.abspath(os.path.join(source_path, 'resources', 'share'))
datastore.update_shared(host, datastore_version, shared_path) datastore.update_shared(host, datastore_version, shared_path)
def build(self, jobs, dev_build, eolInMonth): def build(self, jobs, qmake_args, dev_build, eolInMonth):
""" """
Run the build itself. Pass dev_build=True to enable a dev build Run the build itself. Pass dev_build=True to enable a dev build
""" """
@@ -55,9 +55,9 @@ class Builder:
os.makedirs(build_path) os.makedirs(build_path)
os.chdir(build_path) os.chdir(build_path)
qmake_call = ['qmake'] qmake_call = ['qmake'] + qmake_args
if dev_build: if dev_build:
qmake_call += ['"BLACK_CONFIG+=SwiftDevBranch"'] qmake_call += ['"SWIFT_CONFIG.devBranch=true"']
if eolInMonth > 0: if eolInMonth > 0:
eolYear = date.today().year eolYear = date.today().year
@@ -66,7 +66,7 @@ class Builder:
eolMonth = eolMonth % 12 + 1 eolMonth = eolMonth % 12 + 1
eolDate = date(int(eolYear), int(eolMonth), 1) eolDate = date(int(eolYear), int(eolMonth), 1)
print('Setting EOL date to ' + eolDate.strftime('%Y%m%d')) print('Setting EOL date to ' + eolDate.strftime('%Y%m%d'))
qmake_call += ['BLACK_EOL=' + eolDate.strftime('%Y%m%d')] qmake_call += ['SWIFT_CONFIG.endOfLife=' + eolDate.strftime('%Y%m%d')]
qmake_call += ['-r', os.pardir] qmake_call += ['-r', os.pardir]
subprocess.check_call(qmake_call, env=dict(os.environ)) subprocess.check_call(qmake_call, env=dict(os.environ))
@@ -384,7 +384,7 @@ def print_help():
'Windows': ['msvc', 'mingw'] 'Windows': ['msvc', 'mingw']
} }
compiler_help = '|'.join(supported_compilers[platform.system()]) compiler_help = '|'.join(supported_compilers[platform.system()])
print('jenkins.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-d] [-e <end of life in month>]') print('jenkins.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-d] [-e <end of life in month>] [-q <extra qmake argument>]')
# Entry point if called as a standalone program # Entry point if called as a standalone program
@@ -396,9 +396,10 @@ def main(argv):
jobs = None jobs = None
upload_symbols = False upload_symbols = False
eolInMonth = 0 eolInMonth = 0
qmake_args = []
try: try:
opts, args = getopt.getopt(argv, 'hc:w:t:j:due:', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload', 'eol']) opts, args = getopt.getopt(argv, 'hc:w:t:j:due:q:', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload', 'eol', 'qmake-arg='])
except getopt.GetoptError: except getopt.GetoptError:
print_help() print_help()
sys.exit(2) sys.exit(2)
@@ -428,6 +429,8 @@ def main(argv):
upload_symbols = True upload_symbols = True
elif opt in ('-e', '--eol'): elif opt in ('-e', '--eol'):
eolInMonth = int(arg) eolInMonth = int(arg)
elif opt in ('-q', '--qmake-arg'):
qmake_args += [arg]
if word_size not in ['32', '64']: if word_size not in ['32', '64']:
print('Unsupported word size. Choose 32 or 64') print('Unsupported word size. Choose 32 or 64')
@@ -450,7 +453,7 @@ def main(argv):
builder = builders[platform.system()][tool_chain](config_file, word_size) builder = builders[platform.system()][tool_chain](config_file, word_size)
builder.prepare() builder.prepare()
builder.build(jobs, dev_build, eolInMonth) builder.build(jobs, qmake_args, dev_build, eolInMonth)
builder.checks() builder.checks()
builder.install() builder.install()
builder.publish() builder.publish()

View File

@@ -13,20 +13,20 @@
const QDateTime &BlackConfig::CBuildConfig::getEol() const QDateTime &BlackConfig::CBuildConfig::getEol()
{ {
static const QString eol(\"$$BLACK_EOL\"); // config.pri static const QString eol(\"$$swiftConfig(endOfLife)\"); // config.pri
static const QDateTime dt(eol.isEmpty() ? QDateTime() : QDateTime::fromString(eol, \"yyyyMMdd\")); static const QDateTime dt(eol.isEmpty() ? QDateTime() : QDateTime::fromString(eol, \"yyyyMMdd\"));
return dt; return dt;
} }
int BlackConfig::CBuildConfig::vatsimClientId() int BlackConfig::CBuildConfig::vatsimClientId()
{ {
static const int id { $$VATSIM_CLIENT_ID }; static const int id { $$swiftConfig(vatsim.id) };
return id; return id;
} }
const QString &BlackConfig::CBuildConfig::vatsimPrivateKey() const QString &BlackConfig::CBuildConfig::vatsimPrivateKey()
{ {
static const auto pk = QString { \"$$VATSIM_CLIENT_PRIVATE_KEY\" }; static const auto pk = QString { \"$$swiftConfig(vatsim.key)\" };
return pk; return pk;
} }

View File

@@ -11,108 +11,94 @@
#error This file is only to be included by buildconfig.inc #error This file is only to be included by buildconfig.inc
#endif #endif
$$DEFINE_WITH_BLACKCORE#define WITH_BLACKCORE
$$DEFINE_WITH_BLACKSOUND#define WITH_BLACKSOUND
$$DEFINE_WITH_BLACKINPUT#define WITH_BLACKINPUT
$$DEFINE_WITH_BLACKGUI#define WITH_BLACKGUI
$$DEFINE_WITH_SWIFTDATA#define WITH_SWIFTDATA
$$DEFINE_WITH_SWIFTGUI#define WITH_SWIFTGUI
$$DEFINE_WITH_SWIFTCORE#define WITH_SWIFTCORE
$$DEFINE_WITH_FSX#define WITH_FSX
$$DEFINE_WITH_P3D#define WITH_P3D
$$DEFINE_WITH_FS9#define WITH_FS9
$$DEFINE_WITH_FSUIPC#define WITH_FSUIPC
$$DEFINE_WITH_XPLANE#define WITH_XPLANE
$$DEFINE_SWIFT_VATSIM_SUPPORT#define SWIFT_VATSIM_SUPPORT
constexpr bool BlackConfig::CBuildConfig::isCompiledWithBlackCore() constexpr bool BlackConfig::CBuildConfig::isCompiledWithBlackCore()
{ {
#ifdef WITH_BLACKCORE !!IF swiftConfig(libs.blackcore)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithBlackSound() constexpr bool BlackConfig::CBuildConfig::isCompiledWithBlackSound()
{ {
#ifdef WITH_BLACKSOUND !!IF swiftConfig(libs.blacksound)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithBlackInput() constexpr bool BlackConfig::CBuildConfig::isCompiledWithBlackInput()
{ {
#ifdef WITH_BLACKINPUT !!IF swiftConfig(libs.blackinput)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithFs9Support() constexpr bool BlackConfig::CBuildConfig::isCompiledWithFs9Support()
{ {
#ifdef WITH_FS9 !!IF swiftConfig(sims.fs9)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithP3DSupport() constexpr bool BlackConfig::CBuildConfig::isCompiledWithP3DSupport()
{ {
#ifdef WITH_P3D !!IF swiftConfig(sims.p3d)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithFsxSupport() constexpr bool BlackConfig::CBuildConfig::isCompiledWithFsxSupport()
{ {
#ifdef WITH_FSX !!IF swiftConfig(sims.fsx)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithFsuipcSupport() constexpr bool BlackConfig::CBuildConfig::isCompiledWithFsuipcSupport()
{ {
#ifdef WITH_FSUIPC !!IF swiftConfig(sims.fsuipc)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithXPlaneSupport() constexpr bool BlackConfig::CBuildConfig::isCompiledWithXPlaneSupport()
{ {
#ifdef WITH_XPLANE !!IF swiftConfig(sims.xplane)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isCompiledWithGui() constexpr bool BlackConfig::CBuildConfig::isCompiledWithGui()
{ {
#ifdef WITH_BLACKGUI !!IF swiftConfig(libs.blackgui)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr bool BlackConfig::CBuildConfig::isVatsimVersion() constexpr bool BlackConfig::CBuildConfig::isVatsimVersion()
{ {
#ifdef SWIFT_VATSIM_SUPPORT !!IF swiftConfig(vatsimSupport)
return true; return true;
#else !!ELSE
return false; return false;
#endif !!ENDIF
} }
constexpr int BlackConfig::CBuildConfig::versionMajor() { return $$BLACK_VER_MAJ; } constexpr int BlackConfig::CBuildConfig::versionMajor() { return $$BLACK_VER_MAJ; }

View File

@@ -8,7 +8,7 @@ TARGET = blackcore
TEMPLATE = lib TEMPLATE = lib
CONFIG += blackconfig blackmisc blackinput blacksound precompile_header CONFIG += blackconfig blackmisc blackinput blacksound precompile_header
contains(BLACK_CONFIG, Static) { swiftConfig(static) {
CONFIG += staticlib CONFIG += staticlib
} }

View File

@@ -6,7 +6,7 @@ TARGET = blackgui
TEMPLATE = lib TEMPLATE = lib
CONFIG += blackconfig blackmisc blackcore precompile_header CONFIG += blackconfig blackmisc blackcore precompile_header
contains(BLACK_CONFIG, Static) { swiftConfig(static) {
CONFIG += staticlib CONFIG += staticlib
} }

View File

@@ -7,7 +7,7 @@ TARGET = blackinput
TEMPLATE = lib TEMPLATE = lib
CONFIG += blackmisc CONFIG += blackmisc
contains(BLACK_CONFIG, Static) { swiftConfig(static) {
CONFIG += staticlib CONFIG += staticlib
} }

View File

@@ -6,7 +6,7 @@ TARGET = blackmisc
TEMPLATE = lib TEMPLATE = lib
CONFIG += blackconfig precompile_header CONFIG += blackconfig precompile_header
contains(BLACK_CONFIG, Static) { swiftConfig(static) {
CONFIG += staticlib CONFIG += staticlib
} }

View File

@@ -6,7 +6,7 @@ TARGET = blacksound
TEMPLATE = lib TEMPLATE = lib
CONFIG += blackconfig blackmisc CONFIG += blackconfig blackmisc
contains(BLACK_CONFIG, Static) { swiftConfig(static) {
CONFIG += staticlib CONFIG += staticlib
} }

View File

@@ -17,7 +17,7 @@ HEADERS += *.h
LIBS *= -lsimulatorplugincommon LIBS *= -lsimulatorplugincommon
addStaticLibraryDependency(simulatorplugincommon) addStaticLibraryDependency(simulatorplugincommon)
contains(BLACK_CONFIG, FSUIPC) { swiftConfig(sims.fsuipc) {
equals(WORD_SIZE,32) { equals(WORD_SIZE,32) {
DEFINES += SWIFT_USING_FSUIPC32 DEFINES += SWIFT_USING_FSUIPC32
} }

View File

@@ -15,7 +15,7 @@ DESTDIR = $$DestRoot/bin/plugins/simulator
SOURCES += *.cpp SOURCES += *.cpp
HEADERS += *.h HEADERS += *.h
REQUIRES += contains(BLACK_CONFIG,FSX) REQUIRES += swiftConfig(sims.fsx)
TARGET = simulatorfsx TARGET = simulatorfsx
DISTFILES += simulatorfsx.json DISTFILES += simulatorfsx.json

View File

@@ -15,7 +15,7 @@ DESTDIR = $$DestRoot/bin/plugins/simulator
SOURCES += *.cpp SOURCES += *.cpp
HEADERS += *.h HEADERS += *.h
REQUIRES += contains(BLACK_CONFIG,FSX) REQUIRES += swiftConfig(sims.fsx)
TARGET = simulatorfsxconfig TARGET = simulatorfsxconfig
DISTFILES += simulatorfsx.json DISTFILES += simulatorfsx.json

View File

@@ -20,7 +20,7 @@ DESTDIR = $$DestRoot/bin/plugins/simulator
SOURCES += *.cpp SOURCES += *.cpp
HEADERS += *.h HEADERS += *.h
REQUIRES += contains(BLACK_CONFIG,P3D) REQUIRES += swiftConfig(sims.p3d)
TARGET = simulatorp3d TARGET = simulatorp3d
DISTFILES += simulatorp3d.json DISTFILES += simulatorp3d.json

View File

@@ -15,7 +15,7 @@ DESTDIR = $$DestRoot/bin/plugins/simulator
SOURCES += *.cpp SOURCES += *.cpp
HEADERS += *.h HEADERS += *.h
REQUIRES += contains(BLACK_CONFIG,P3D) REQUIRES += swiftConfig(sims.p3d)
TARGET = simulatorp3dconfig TARGET = simulatorp3dconfig
DISTFILES += simulatorp3d.json DISTFILES += simulatorp3d.json

View File

@@ -7,26 +7,26 @@ SUBDIRS += plugincommon
SUBDIRS += emulated SUBDIRS += emulated
SUBDIRS += emulatedconfig SUBDIRS += emulatedconfig
contains(BLACK_CONFIG,FSX|FS9|P3D) { swiftConfig(sims.fsx)|swiftConfig(sims.fs9)|swiftConfig(sims.p3d) {
SUBDIRS += fsuipc32 SUBDIRS += fsuipc32
SUBDIRS += fsuipc64 SUBDIRS += fsuipc64
SUBDIRS += fscommon SUBDIRS += fscommon
} }
contains(BLACK_CONFIG,FSX|P3D) { swiftConfig(sims.fsx)|swiftConfig(sims.p3d) {
SUBDIRS += fsxcommon SUBDIRS += fsxcommon
} }
contains(BLACK_CONFIG,P3D) { swiftConfig(sims.p3d) {
SUBDIRS += p3d SUBDIRS += p3d
SUBDIRS += p3dconfig SUBDIRS += p3dconfig
} }
contains(BLACK_CONFIG,FSX) { swiftConfig(sims.fsx) {
SUBDIRS += fsx SUBDIRS += fsx
SUBDIRS += fsxconfig SUBDIRS += fsxconfig
} }
contains(BLACK_CONFIG,FS9):contains(BLACK_CONFIG,FSUIPC) { swiftConfig(sims.fs9):swiftConfig(sims.fsuipc) {
SUBDIRS += fs9 SUBDIRS += fs9
} }
contains(BLACK_CONFIG,XPlane) { swiftConfig(sims.xplane) {
SUBDIRS += xplane SUBDIRS += xplane
SUBDIRS += xplaneconfig SUBDIRS += xplaneconfig
} }

View File

@@ -5,31 +5,31 @@ CONFIG += ordered
SUBDIRS += blackconfig SUBDIRS += blackconfig
SUBDIRS += blackmisc SUBDIRS += blackmisc
contains(BLACK_CONFIG,BlackSound) { swiftConfig(libs.blacksound) {
SUBDIRS += blacksound SUBDIRS += blacksound
} }
contains(BLACK_CONFIG,BlackInput) { swiftConfig(libs.blackinput) {
SUBDIRS += blackinput SUBDIRS += blackinput
} }
contains(BLACK_CONFIG,BlackCore) { swiftConfig(libs.blackcore) {
SUBDIRS += blackcore SUBDIRS += blackcore
} }
contains(BLACK_CONFIG,BlackGui) { swiftConfig(libs.blackgui) {
SUBDIRS += blackgui SUBDIRS += blackgui
} }
contains(BLACK_CONFIG,SwiftGui) { swiftConfig(apps.swiftgui) {
SUBDIRS += swiftguistandard SUBDIRS += swiftguistandard
} }
contains(BLACK_CONFIG,SwiftCore) { swiftConfig(apps.swiftcore) {
SUBDIRS += swiftcore SUBDIRS += swiftcore
} }
contains(BLACK_CONFIG,SwiftData) { swiftConfig(apps.swiftdata) {
SUBDIRS += swiftdata SUBDIRS += swiftdata
} }
contains(BLACK_CONFIG,SwiftLauncher) { swiftConfig(apps.swiftlauncher) {
SUBDIRS += swiftlauncher SUBDIRS += swiftlauncher
} }
contains(BLACK_CONFIG,XPlane) { swiftConfig(sims.xplane) {
SUBDIRS += xswiftbus SUBDIRS += xswiftbus
} }
SUBDIRS += plugins SUBDIRS += plugins

View File

@@ -13,15 +13,15 @@ CheckMandatoryDependency(glu)
CheckMandatoryDependency(libpng) CheckMandatoryDependency(libpng)
CheckMandatoryDependency(zlib) CheckMandatoryDependency(zlib)
contains(BLACK_CONFIG,Doxygen) { swiftConfig(doxygen) {
SUBDIRS += docs SUBDIRS += docs
} }
SUBDIRS += resources SUBDIRS += resources
SUBDIRS += src SUBDIRS += src
contains(BLACK_CONFIG,Samples) { swiftConfig(samples) {
SUBDIRS += samples SUBDIRS += samples
} }
contains(BLACK_CONFIG,Unittests) { swiftConfig(unitTests) {
SUBDIRS += tests SUBDIRS += tests
} }

View File

@@ -11,7 +11,7 @@ SUBDIRS += blackgui
# testblackcore.file = blackcore/testblackcore.pro # testblackcore.file = blackcore/testblackcore.pro
# testblackgui.file = blackgui/testblackgui.pro # testblackgui.file = blackgui/testblackgui.pro
contains(BLACK_CONFIG,FSX|P3D) { swiftConfig(sims.fsx)|swiftConfig(sims.p3d) {
SUBDIRS += testsimpluginfsxp3d SUBDIRS += testsimpluginfsxp3d
testsimpluginfsxp3d.file = blacksimpluginfsxp3d/testblacksimpluginfsxp3d.pro testsimpluginfsxp3d.file = blacksimpluginfsxp3d/testblacksimpluginfsxp3d.pro
} }