mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
181 lines
5.8 KiB
Prolog
181 lines
5.8 KiB
Prolog
load(common_pre)
|
|
|
|
TEMPLATE = lib
|
|
|
|
CONFIG += shared plugin
|
|
CONFIG -= qt
|
|
|
|
INCLUDEPATH += $$EXTERNALSROOT/common/include/XPLM
|
|
|
|
LIBS += -levent_core -ldbus-1
|
|
|
|
OTHER_FILES += \
|
|
org.swift_project.xswiftbus.*.xml \
|
|
xswiftbus.conf
|
|
|
|
win32 {
|
|
equals(WORD_SIZE,64): LIBS += -lXPLM_64 -lXPWidgets_64
|
|
equals(WORD_SIZE,32): LIBS += -lXPLM -lXPWidgets
|
|
}
|
|
else:macx {
|
|
LIBS += -framework XPLM -framework XPWidgets \
|
|
-framework Cocoa -framework CoreFoundation
|
|
DEFINES += XUTILS_EXCLUDE_MAC_CRAP=1
|
|
}
|
|
else:unix {
|
|
# Flags needed because there is no XPLM link library
|
|
QMAKE_LFLAGS += -shared -rdynamic -nodefaultlibs -undefined_warning -Wl,--version-script=$$PWD/xswiftbus.map
|
|
}
|
|
|
|
DEPENDPATH += . $$SourceRoot/src
|
|
INCLUDEPATH += . $$SourceRoot/src
|
|
|
|
SOURCES += *.cpp
|
|
HEADERS += *.h
|
|
|
|
# Using the $$files function so we can remove some with -= below
|
|
SOURCES += $$files(libxplanemp/src/*.cpp)
|
|
HEADERS += $$files(libxplanemp/src/*.h) $$files(libxplanemp/include/*.h)
|
|
INCLUDEPATH += ./libxplanemp ./libxplanemp/include ./libxplanemp/src
|
|
|
|
unix:!macx {
|
|
INCLUDEPATH *= /usr/include/dbus-1.0
|
|
INCLUDEPATH *= /usr/lib/x86_64-linux-gnu/dbus-1.0/include
|
|
}
|
|
|
|
# PlatformUtils also not used
|
|
SOURCES -= $$files(libxplanemp/src/PlatformUtils.*.cpp)
|
|
HEADERS -= libxplanemp/src/PlatformUtils.h
|
|
|
|
# Externals required by libxplanemp
|
|
CONFIG += opengl
|
|
msvc {
|
|
CONFIG(debug, debug|release): LIBS += -lpngd -lzd -lopengl32 -lglu32
|
|
CONFIG(release, debug|release): LIBS += -lpng -lz -lopengl32 -lglu32
|
|
}
|
|
else:win32: LIBS += -lpng -lz -lopengl32 -lglu32
|
|
else: LIBS += -lpng -lz
|
|
|
|
msvc: DEFINES += _CRT_SECURE_NO_WARNINGS
|
|
|
|
# Required by X-Plane SDK and libxplanemp
|
|
win32:DEFINES += IBM=1
|
|
linux:DEFINES += LIN=1
|
|
macx:DEFINES += APL=1
|
|
DEFINES += XPLM200=1
|
|
# XPLM210 is required for new features in libxplanemp,
|
|
# but means we lose support for X-Plane 9 and earlier versions.
|
|
# TODO add config option to select minimum X-Plane version when building
|
|
DEFINES += XPLM210=1
|
|
|
|
# Name will be used in libxplanemp log messages
|
|
DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\"
|
|
DEFINES += XPMP_CLIENT_LONGNAME=\\\"xswiftbus\\\"
|
|
|
|
win32: GIT_BIN = $$system($$(SYSTEMROOT)\system32\where git 2> nul)
|
|
else: GIT_BIN = $$system(which git 2> /dev/null)
|
|
|
|
isEmpty(GIT_BIN) {
|
|
GIT_HEAD_SHA1="<unknown>"
|
|
GIT_COMMIT_TS="0"
|
|
} else {
|
|
GIT_HEAD_SHA1=$$system(git rev-parse --short HEAD)
|
|
GIT_COMMIT_TS=$$system(git log -1 --date=format:'%Y%m%d%H%M' --pretty=format:%cd)
|
|
}
|
|
|
|
DEFINES += XSWIFTBUS_VERSION=\\\"$$swiftConfig(version.full)\\\"
|
|
DEFINES += GIT_COMMIT_TS=\\\"$$GIT_COMMIT_TS\\\"
|
|
|
|
# X-Plane plugins must follow a prescribed filename and directory structure.
|
|
TARGET_EXT = .xpl
|
|
win32:TARGET = win
|
|
linux:TARGET = lin
|
|
macx:TARGET = mac
|
|
|
|
equals(WORD_SIZE,64) {
|
|
XSWIFTBUS_DIR = xswiftbus/64
|
|
DEFINES += WORD_SIZE_64
|
|
}
|
|
equals(WORD_SIZE,32) {
|
|
XSWIFTBUS_DIR = xswiftbus/32
|
|
}
|
|
XSWIFTBUS_DESTDIR = $$DestRoot/$$XSWIFTBUS_DIR
|
|
|
|
# Default MSVC project name is $$TARGET, so use a better name
|
|
QMAKE_PROJECT_NAME = xswiftbus
|
|
|
|
# QMake ignores TARGET_EXT on Unix
|
|
macx: QMAKE_POST_LINK += mkdir -p $$XSWIFTBUS_DESTDIR && cp $$OUT_PWD/lib$${TARGET}.dylib $$XSWIFTBUS_DESTDIR/$${TARGET}.xpl
|
|
else:unix: QMAKE_POST_LINK += mkdir -p $$XSWIFTBUS_DESTDIR && cp $$OUT_PWD/lib$${TARGET}.so $$XSWIFTBUS_DESTDIR/$${TARGET}.xpl
|
|
else: DESTDIR = $$XSWIFTBUS_DESTDIR
|
|
|
|
target.path = $$PREFIX/$$XSWIFTBUS_DIR
|
|
target.files *= $$XSWIFTBUS_DESTDIR/$${TARGET}.xpl
|
|
target.CONFIG += no_check_exist
|
|
INSTALLS += target
|
|
|
|
dep_target.path = $$PREFIX/$$XSWIFTBUS_DIR
|
|
dep_target.CONFIG += no_check_exist
|
|
win32 {
|
|
dep_target.files *= $$DestRoot/bin/dbus-daemon.exe
|
|
win32-g++ {
|
|
dep_target.files *= $$DestRoot/bin/libdbus-1-3.dll
|
|
dep_target.files *= $$DestRoot/bin/libevent_core.dll
|
|
}
|
|
else {
|
|
dep_target.files *= $$DestRoot/bin/dbus-1-3.dll
|
|
dep_target.files *= $$DestRoot/bin/expat.dll
|
|
dep_target.files *= $$DestRoot/bin/event_core.dll
|
|
}
|
|
|
|
dbus_share.path = $$PREFIX/$$XSWIFTBUS_DIR/share/dbus-1
|
|
dbus_share.files = $$DestRoot/share/dbus-1/session.conf
|
|
dbus_share.CONFIG = no_check_exist
|
|
INSTALLS += dbus_share
|
|
|
|
legacy_data_target.path = $$PREFIX/xswiftbus
|
|
legacy_data_target.files *= LegacyData
|
|
} else:macx: {
|
|
dep_target.files *= $$DestRoot/lib/libdbus-1.3.dylib
|
|
dep_target.files *= $$DestRoot/lib/libevent_core.2.1.8.dylib
|
|
|
|
legacy_data_target.path = $$PREFIX/xswiftbus
|
|
legacy_data_target.files *= LegacyData
|
|
|
|
# We rely on legacy_data_target to be called after dep_target. So the library should already be installed and can be modified in place.
|
|
# We cannot modify the original library since this is xswiftbus specific.
|
|
legacy_data_target.depends += fix_plugin_rpath
|
|
fix_plugin_rpath.target = fix_plugin_rpath
|
|
fix_plugin_rpath.commands += install_name_tool -change \"@rpath/libevent_core.2.1.8.dylib\" \"@loader_path/libevent_core.2.1.8.dylib\" $$shell_path($$PREFIX/$$XSWIFTBUS_DIR/mac.xpl) &&
|
|
fix_plugin_rpath.commands += install_name_tool -change \"@rpath/libdbus-1.3.dylib\" \"@loader_path/libdbus-1.3.dylib\" $$shell_path($$PREFIX/$$XSWIFTBUS_DIR/mac.xpl)
|
|
QMAKE_EXTRA_TARGETS += fix_plugin_rpath
|
|
|
|
} else:unix: {
|
|
dep_target.files *= $$DestRoot/lib/libevent_core-2.0.so.5
|
|
dep_target.files *= $$DestRoot/lib/libpng12.so.0
|
|
|
|
legacy_data_target.path = $$PREFIX/xswiftbus
|
|
legacy_data_target.files *= LegacyData
|
|
}
|
|
|
|
win32-g++ {
|
|
equals(WORD_SIZE,32) {
|
|
dep_target.files *= $$[QT_INSTALL_BINS]/libgcc_s_dw2-1.dll
|
|
}
|
|
equals(WORD_SIZE,64) {
|
|
dep_target.files *= $$[QT_INSTALL_BINS]/libgcc_s_seh-1.dll
|
|
}
|
|
dep_target.files *= $$[QT_INSTALL_BINS]/libwinpthread-1.dll
|
|
dep_target.files *= $$[QT_INSTALL_BINS]/libstdc++-6.dll
|
|
}
|
|
|
|
conf_target.path = $$PREFIX/xswiftbus
|
|
conf_target.files *= xswiftbus.conf
|
|
|
|
|
|
INSTALLS += dep_target
|
|
INSTALLS += legacy_data_target
|
|
INSTALLS += conf_target
|
|
|
|
load(common_post)
|