Convert static common simulator plugins to shared ones

Test Plan:
- Check that the new shared libraries are packaged in all platform installers.
- check that plugins are loaded properly on all platforms.

Reviewers: #swift_pilot_client, msutcliffe

Reviewed By: #swift_pilot_client, msutcliffe

Maniphest Tasks: T471

Differential Revision: https://dev.swift-project.org/D79
This commit is contained in:
Roland Rossgotterer
2018-12-17 15:59:14 +01:00
committed by Mat Sutcliffe
parent 0970dbdcfc
commit d639187f91
28 changed files with 194 additions and 63 deletions

View File

@@ -2,7 +2,7 @@
<name>qt5binaries</name>
<description>Qt5 binaries</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>Qt 5.5 runtime binaries</detailedDescription>
<detailedDescription>Qt5 runtime binaries</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>

View File

@@ -64,6 +64,15 @@ This installs the binaries to run all swift applications.</detailedDescription>
<distributionFile>
<origin>../../dist/bin/blackmisc.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/simulatorplugincommon.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/simulatorfscommon.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/simulatorfsxcommon.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
<folder>
@@ -103,6 +112,10 @@ This installs the binaries to run all swift applications.</detailedDescription>
<allowWildcards>1</allowWildcards>
<origin>../../dist/lib/libblacksound*</origin>
</distributionFile>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>../../dist/lib/libsimulatorplugincommon*</origin>
</distributionFile>
</distributionFileList>
</folder>
<folder>

View File

@@ -7,17 +7,17 @@ unix:!macx {
}
simulatorfsxcommon {
addStaticLibraryDependency(simulatorfsxcommon)
addLibraryDependency(simulatorfsxcommon)
LIBS += -lsimulatorfsxcommon
}
simulatorfscommon {
addStaticLibraryDependency(simulatorfscommon)
addLibraryDependency(simulatorfscommon)
LIBS += -lsimulatorfscommon
}
simulatorplugincommon {
addStaticLibraryDependency(simulatorplugincommon)
addLibraryDependency(simulatorplugincommon)
LIBS += -lsimulatorplugincommon
}
@@ -35,8 +35,6 @@ simconnect {
equals(WORD_SIZE,32) {
INCLUDEPATH *= $$EXTERNALSROOT/common/include/simconnect/FSX-XPack
}
RC_FILE = $$SourceRoot/src/plugins/simulator/fsxcommon/simconnect.rc
}
blackgui {

View File

@@ -7,6 +7,7 @@ TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore blackgui
CONFIG += simulatorplugincommon
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
@@ -17,9 +18,6 @@ FORMS += *.ui
DISTFILES += simulatoremulated.json
DESTDIR = $$DestRoot/bin/plugins/simulator
LIBS *= -lsimulatorplugincommon
addStaticLibraryDependency(simulatorplugincommon)
win32 {
dlltarget.path = $$PREFIX/bin/plugins/simulator
INSTALLS += dlltarget

View File

@@ -7,15 +7,12 @@ TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore blackgui
CONFIG += simulatorfscommon simulatorplugincommon
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
addStaticLibraryDependency(simulatorplugincommon)
addStaticLibraryDependency(simulatorfscommon)
addStaticLibraryDependency(fsuipc)
LIBS += -lsimulatorfscommon -lfsuipc -luuid -lsimulatorplugincommon
LIBS += -ldxguid -lole32
LIBS += -luuid -ldxguid -lole32
SOURCES += *.cpp
HEADERS += *.h

View File

@@ -1,12 +1,16 @@
load(common_pre)
QT += core dbus network
QT += core dbus network widgets
TARGET = simulatorfscommon
TEMPLATE = lib
CONFIG += blackconfig blackmisc blackcore blackgui
CONFIG += simulatorplugincommon fsuipc
contains(BLACK_CONFIG, Static) {
CONFIG += staticlib
CONFIG += blackconfig blackmisc
}
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
@@ -14,8 +18,7 @@ INCLUDEPATH += . $$SourceRoot/src
SOURCES += *.cpp
HEADERS += *.h
LIBS *= -lsimulatorplugincommon
addStaticLibraryDependency(simulatorplugincommon)
DEFINES += BUILD_FSCOMMON_LIB
swiftConfig(sims.fsuipc) {
equals(WORD_SIZE,32) {
@@ -27,5 +30,9 @@ swiftConfig(sims.fsuipc) {
}
DESTDIR = $$DestRoot/lib
DLLDESTDIR = $$DestRoot/bin
dlltarget.path = $$PREFIX/bin
INSTALLS += dlltarget
load(common_post)

View File

@@ -0,0 +1,32 @@
/* Copyright (C) 2018
* 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.
*/
//! \file
#ifndef BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_MACROS_H
#define BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_MACROS_H
#include <QtGlobal>
/*!
* \def FSCOMMON_EXPORT
* FSCommon Export Macro
*/
#ifndef WITH_STATIC
# if defined(BUILD_FSCOMMON_LIB)
# define FSCOMMON_EXPORT Q_DECL_EXPORT
# else
# define FSCOMMON_EXPORT Q_DECL_IMPORT
# endif
#else
# define FSCOMMON_EXPORT
#endif
#endif // guard

View File

@@ -12,6 +12,7 @@
#ifndef BLACKSIMPLUGIN_FSUIPC_H
#define BLACKSIMPLUGIN_FSUIPC_H
#include "plugins/simulator/fscommon/fscommonexport.h"
#include "blackmisc/simulation/simulatedaircraft.h"
#include "blackmisc/weather/weathergrid.h"
#include <QStringList>
@@ -21,7 +22,7 @@ namespace BlackSimPlugin
namespace FsCommon
{
//! Class representing a FSUIPC "interface"
class CFsuipc : public QObject
class FSCOMMON_EXPORT CFsuipc : public QObject
{
Q_OBJECT

View File

@@ -12,10 +12,10 @@
#ifndef BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_H
#define BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_H
#include "../plugincommon/simulatorplugincommon.h"
#include "plugins/simulator/fscommon/fsuipc.h"
#include "plugins/simulator/plugincommon/simulatorplugincommon.h"
#include "blackmisc/simulation/interpolator.h"
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
#include "fsuipc.h"
#include <QObject>
#include <memory>
@@ -25,7 +25,7 @@ namespace BlackSimPlugin
namespace FsCommon
{
//! Common base class for MS flight simulators
class CSimulatorFsCommon : public Common::CSimulatorPluginCommon
class FSCOMMON_EXPORT CSimulatorFsCommon : public Common::CSimulatorPluginCommon
{
Q_OBJECT
Q_INTERFACES(BlackCore::ISimulator)

View File

@@ -6,7 +6,7 @@ TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackconfig blackmisc blackcore blackgui
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon fsuipc simconnect
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon simconnect
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src

View File

@@ -9,20 +9,24 @@ SOURCES += *.cpp
HEADERS += *.h
FORMS += *.ui
CONFIG += staticlib
CONFIG += blackconfig blackmisc blackcore blackgui simconnect
CONFIG += blackconfig blackmisc blackcore blackgui
CONFIG += simulatorfscommon simulatorplugincommon simconnect
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
DESTDIR = $$DestRoot/lib
LIBS += -lsimulatorfscommon -lfsuipc -lsimulatorplugincommon
addStaticLibraryDependency(fsuipc)
addStaticLibraryDependency(simulatorplugincommon)
DEFINES += BUILD_FSXCOMMON_LIB BUID_SIMCONNECT_LIB
OTHER_FILES += \
*.manifest \
*.rc
RC_FILE = $$SourceRoot/src/plugins/simulator/fsxcommon/simconnect.rc
DESTDIR = $$DestRoot/lib
DLLDESTDIR = $$DestRoot/bin
dlltarget.path = $$PREFIX/bin
INSTALLS += dlltarget
load(common_post)

View File

@@ -0,0 +1,32 @@
/* Copyright (C) 2018
* 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.
*/
//! \file
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCOMMON_MACROS_H
#define BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCOMMON_MACROS_H
#include <QtGlobal>
/*!
* \def FSXCOMMON_EXPORT
* FSXCommon Export Macro
*/
#ifndef WITH_STATIC
# if defined(BUILD_FSXCOMMON_LIB)
# define FSXCOMMON_EXPORT Q_DECL_EXPORT
# else
# define FSXCOMMON_EXPORT Q_DECL_IMPORT
# endif
#else
# define FSXCOMMON_EXPORT
#endif
#endif // guard

View File

@@ -12,6 +12,7 @@
#ifndef BLACKSIMPLUGIN_FSXCOMMON_FSXSETTINGSCOMPONENT_H
#define BLACKSIMPLUGIN_FSXCOMMON_FSXSETTINGSCOMPONENT_H
#include "plugins/simulator/fsxcommon/fsxcommonexport.h"
#include "blackmisc/simulation/simulatorinfo.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include <QFrame>
@@ -26,7 +27,7 @@ namespace BlackSimPlugin
class CSimulatorFsxCommon;
//! FSX/P3D settings
class CFsxSettingsComponent : public QFrame
class FSXCOMMON_EXPORT CFsxSettingsComponent : public QFrame
{
Q_OBJECT

View File

@@ -12,11 +12,12 @@
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECT_DATADEFINITION_H
#define BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECT_DATADEFINITION_H
#include <QtGlobal>
#include "plugins/simulator/fsxcommon/fsxcommonexport.h"
#include "plugins/simulator/fsxcommon/simconnectwindows.h"
#include "blackmisc/aviation/aircraftlights.h"
#include "../fsxcommon/simconnectwindows.h"
#include <algorithm>
#include <QtGlobal>
#include <QString>
namespace BlackMisc { namespace Aviation { class CAircraftParts; }}
@@ -86,7 +87,7 @@ namespace BlackSimPlugin
};
//! Data struct of remote aircraft parts
struct DataDefinitionRemoteAircraftPartsWithoutLights
struct FSXCOMMON_EXPORT DataDefinitionRemoteAircraftPartsWithoutLights
{
double flapsLeadingEdgeLeftPercent; //!< Leading edge left in percent
double flapsLeadingEdgeRightPercent; //!< Leading edge right in percent
@@ -128,7 +129,7 @@ namespace BlackSimPlugin
};
//! Data for aircraft lighs
struct DataDefinitionRemoteAircraftLights
struct FSXCOMMON_EXPORT DataDefinitionRemoteAircraftLights
{
double lightStrobe; //!< Is strobe light on?
double lightLanding; //!< Is landing light on?
@@ -206,7 +207,7 @@ namespace BlackSimPlugin
};
//! Handles SimConnect data definitions
class CSimConnectDefinitions
class FSXCOMMON_EXPORT CSimConnectDefinitions
{
public:
//! SimConnect definiton IDs

View File

@@ -12,7 +12,8 @@
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTOBJECT_H
#define BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTOBJECT_H
#include "simconnectdatadefinition.h"
#include "plugins/simulator/fsxcommon/fsxcommonexport.h"
#include "plugins/simulator/fsxcommon/simconnectdatadefinition.h"
#include "blackmisc/simulation/simulatedaircraft.h"
#include "blackmisc/simulation/interpolatormulti.h"
#include <QSharedPointer>
@@ -24,7 +25,7 @@ namespace BlackSimPlugin
namespace FsxCommon
{
//! Class representing a SimConnect object
class CSimConnectObject
class FSXCOMMON_EXPORT CSimConnectObject
{
public:
//! Type

View File

@@ -12,6 +12,7 @@
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTSETTINGSCOMPONENT_H
#define BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTSETTINGSCOMPONENT_H
#include "plugins/simulator/fsxcommon/fsxcommonexport.h"
#include "blackgui/overlaymessagesframe.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/simulation/settings/simulatorsettings.h"
@@ -27,7 +28,7 @@ namespace BlackSimPlugin
/*!
* A component that gathers all SimConnect related settings.
*/
class CSimConnectSettingsComponent : public BlackGui::COverlayMessagesFrame
class FSXCOMMON_EXPORT CSimConnectSettingsComponent : public BlackGui::COverlayMessagesFrame
{
Q_OBJECT

View File

@@ -12,6 +12,8 @@
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTSYMBOLS_H
#define BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTSYMBOLS_H
#include "plugins/simulator/fsxcommon/fsxcommonexport.h"
#include <QtGlobal>
#ifdef Q_OS_WIN64
@@ -26,12 +28,12 @@ enum P3DSimConnectVersion
};
//! String to the enum
P3DSimConnectVersion stringToP3DVersion(const QString &p3d);
FSXCOMMON_EXPORT P3DSimConnectVersion stringToP3DVersion(const QString &p3d);
//! Load and resolve versioned P3D SimConnect.
//! If a another version was already loaded previously, it won't unload it.
//! You have to call /sa unloadSimConnect() before.
bool loadAndResolveP3DSimConnect(P3DSimConnectVersion version);
FSXCOMMON_EXPORT bool loadAndResolveP3DSimConnect(P3DSimConnectVersion version);
//! Same but string version
inline bool loadAndResolveP3DSimConnectByString(const QString &version) { return loadAndResolveP3DSimConnect(stringToP3DVersion(version)); }
@@ -41,7 +43,7 @@ inline bool loadAndResolveP3DSimConnectByString(const QString &version) { return
//! Load and resolve FSX SimConnect.
//! \param manifestProbing Set to true if you want to try loading from the assembly cache with manifests.
//! Otherwise the library in the bin folder will be loaded.
bool loadAndResolveFsxSimConnect(bool manifestProbing);
FSXCOMMON_EXPORT bool loadAndResolveFsxSimConnect(bool manifestProbing);
#endif

View File

@@ -12,10 +12,11 @@
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCOMMON_H
#define BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCOMMON_H
#include "simconnectdatadefinition.h"
#include "simconnectobject.h"
#include "../fsxcommon/simconnectwindows.h"
#include "../fscommon/simulatorfscommon.h"
#include "plugins/simulator/fsxcommon/fsxcommonexport.h"
#include "plugins/simulator/fsxcommon/simconnectdatadefinition.h"
#include "plugins/simulator/fsxcommon/simconnectobject.h"
#include "plugins/simulator/fsxcommon/simconnectwindows.h"
#include "plugins/simulator/fscommon/simulatorfscommon.h"
#include "blackcore/simulator.h"
#include "blackmisc/simulation/interpolatorlinear.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
@@ -115,7 +116,7 @@ namespace BlackSimPlugin
};
//! FSX Simulator Implementation
class CSimulatorFsxCommon : public FsCommon::CSimulatorFsCommon
class FSXCOMMON_EXPORT CSimulatorFsxCommon : public FsCommon::CSimulatorFsCommon
{
Q_OBJECT
Q_INTERFACES(BlackCore::ISimulator)
@@ -615,7 +616,7 @@ namespace BlackSimPlugin
};
//! Listener for FSX
class CSimulatorFsxCommonListener : public BlackCore::ISimulatorListener
class FSXCOMMON_EXPORT CSimulatorFsxCommonListener : public BlackCore::ISimulatorListener
{
Q_OBJECT

View File

@@ -12,6 +12,7 @@
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCONFIGWINDOW_H
#define BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCONFIGWINDOW_H
#include "plugins/simulator/fsxcommon/fsxcommonexport.h"
#include "blackgui/pluginconfigwindow.h"
#include "blackmisc/simulation/simulatorinfo.h"
#include <QScopedPointer>
@@ -24,7 +25,7 @@ namespace BlackSimPlugin
/**
* A window that lets user set up the FSX plugin.
*/
class CSimulatorFsxConfigWindow : public BlackGui::CPluginConfigWindow
class FSXCOMMON_EXPORT CSimulatorFsxConfigWindow : public BlackGui::CPluginConfigWindow
{
Q_OBJECT

View File

@@ -6,7 +6,7 @@ TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackconfig blackmisc blackcore blackgui
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon fsuipc simconnect
CONFIG += simulatorfsxcommon
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src

View File

@@ -11,7 +11,7 @@ TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackconfig blackmisc blackcore blackgui
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon fsuipc simconnect
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon simconnect
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src

View File

@@ -6,7 +6,7 @@ TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackconfig blackmisc blackcore blackgui
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon fsuipc simconnect
CONFIG += simulatorfsxcommon
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src

View File

@@ -5,14 +5,25 @@ QT += core dbus xml network widgets
TARGET = simulatorplugincommon
TEMPLATE = lib
CONFIG += staticlib
CONFIG += blackconfig blackmisc blackgui
CONFIG += blackconfig blackmisc blackcore blackgui
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
DEFINES += BUILD_SIMULATORPLUGINCOMMON_LIB
SOURCES += *.cpp
HEADERS += *.h
DESTDIR = $$DestRoot/lib
DLLDESTDIR = $$DestRoot/bin
win32 {
dlltarget.path = $$PREFIX/bin
INSTALLS += dlltarget
} else {
target.path = $$PREFIX/lib
INSTALLS += target
}
load(common_post)

View File

@@ -12,6 +12,7 @@
#ifndef BLACKSIMPLUGIN_COMMON_SIMULATORPLUGINCOMMON_H
#define BLACKSIMPLUGIN_COMMON_SIMULATORPLUGINCOMMON_H
#include "plugins/simulator/plugincommon/simulatorplugincommonexport.h"
#include "blackcore/simulator.h"
#include <QObject>
#include <QPointer>
@@ -22,7 +23,7 @@ namespace BlackSimPlugin
namespace Common
{
//! Common base class for simulator plugins
class CSimulatorPluginCommon : public BlackCore::ISimulator
class SIMULATORPLUGINCOMMON_EXPORT CSimulatorPluginCommon : public BlackCore::ISimulator
{
Q_OBJECT
Q_INTERFACES(BlackCore::ISimulator)

View File

@@ -0,0 +1,32 @@
/* Copyright (C) 2018
* 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.
*/
//! \file
#ifndef BLACKSIMPLUGIN_SIMULATORPLUGINCOMMON_MACROS_H
#define BLACKSIMPLUGIN_SIMULATORPLUGINCOMMON_MACROS_H
#include <QtGlobal>
/*!
* \def SIMULATORPLUGINCOMMON_EXPORT
* SimulatorPluginCommon Export Macro
*/
#ifndef WITH_STATIC
# if defined(BUILD_SIMULATORPLUGINCOMMON_LIB)
# define SIMULATORPLUGINCOMMON_EXPORT Q_DECL_EXPORT
# else
# define SIMULATORPLUGINCOMMON_EXPORT Q_DECL_IMPORT
# endif
#else
# define SIMULATORPLUGINCOMMON_EXPORT
#endif
#endif // guard

View File

@@ -6,7 +6,7 @@ TARGET = simulatorxplane
TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore blackgui blackconfig
CONFIG += blackmisc blackcore blackgui blackconfig simulatorplugincommon
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
@@ -21,9 +21,6 @@ HEADERS += *.h
DISTFILES += simulatorxplane.json
DESTDIR = $$DestRoot/bin/plugins/simulator
LIBS *= -lsimulatorplugincommon
addStaticLibraryDependency(simulatorplugincommon)
win32 {
dlltarget.path = $$PREFIX/bin/plugins/simulator
INSTALLS += dlltarget

View File

@@ -5,7 +5,7 @@ QT += core testlib dbus network gui widgets
TARGET = testblacksimpluginfsxp3d
CONFIG -= app_bundle
CONFIG += blackmisc blackcore blackconfig blackgui
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon fsuipc simconnect
CONFIG += simulatorfsxcommon simulatorfscommon simulatorplugincommon simconnect
CONFIG += testcase
CONFIG += no_testcase_installs