Added a build flag for FSX specific code

FSX SimConnect code is build and linked only if enabled
by the build configuration.

refs #145
This commit is contained in:
Roland Winklmeier
2014-03-10 21:50:54 +01:00
parent e978b6dee1
commit 0349d8f212
6 changed files with 30 additions and 9 deletions

View File

@@ -26,4 +26,5 @@ BLACK_CONFIG += BlackSound
BLACK_CONFIG += BlackSim BLACK_CONFIG += BlackSim
BLACK_CONFIG += Samples BLACK_CONFIG += Samples
BLACK_CONFIG += Unittests BLACK_CONFIG += Unittests
#BLACK_CONFIG += FSX
#BLACK_CONFIG += Doxygen #BLACK_CONFIG += Doxygen

View File

@@ -21,7 +21,6 @@ isEmpty(EXTERNALDIR) {
} }
# Everything is fine. Add the include path # Everything is fine. Add the include path
message("Found externals: $$EXTERNALDIR")
INCLUDEPATH *= $$EXTERNALDIR/include INCLUDEPATH *= $$EXTERNALDIR/include
# and the library path depending on the used compiler # and the library path depending on the used compiler
@@ -50,11 +49,9 @@ linux-g++ {
GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64) GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64)
contains(GCC64,[enabled]) { contains(GCC64,[enabled]) {
LIBS *= -L$$EXTERNALDIR/linux64/lib LIBS *= -L$$EXTERNALDIR/linux64/lib
message("64 bit")
} }
else { else {
LIBS *= -L$$EXTERNALDIR/linux32/lib LIBS *= -L$$EXTERNALDIR/linux32/lib
message("32 bit")
} }
} }

View File

@@ -8,6 +8,12 @@ blackgui {
blackcore { blackcore {
LIBS += -lblackcore -lvatlib LIBS += -lblackcore -lvatlib
win32 {
contains(BLACK_CONFIG, FSX) {
LIBS += -lSimConnect
}
}
} }
blacksound { blacksound {

View File

@@ -37,12 +37,15 @@ DEFINES += LOG_IN_FILE
HEADERS += *.h HEADERS += *.h
SOURCES += *.cpp SOURCES += *.cpp
HEADERS += $$PWD/fsx/*.h
SOURCES += $$PWD/fsx/*.cpp
win32 { win32 {
HEADERS += $$PWD/win/*.h HEADERS += $$PWD/win/*.h
SOURCES += $$PWD/win/*.cpp SOURCES += $$PWD/win/*.cpp
contains(BLACK_CONFIG, FSX) {
DEFINES += BLACK_WITH_FSX
HEADERS += $$PWD/fsx/*.h
SOURCES += $$PWD/fsx/*.cpp
}
} }
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib ../../lib/blacksound.lib win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib ../../lib/blacksound.lib

View File

@@ -34,6 +34,7 @@ namespace BlackCore
public: public:
//! \brief Settings type
enum SettingsType enum SettingsType
{ {
SettingsHotKeys, SettingsHotKeys,

View File

@@ -5,7 +5,10 @@
#include "context_simulator_impl.h" #include "context_simulator_impl.h"
#include "coreruntime.h" #include "coreruntime.h"
#include "fsx/simulator_fsx.h"
#ifdef BLACK_WITH_FSX
#include "fsx/simulator_fsx.h"
#endif
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::PhysicalQuantities;
@@ -17,13 +20,17 @@ namespace BlackCore
// Init this context // Init this context
CContextSimulator::CContextSimulator(QObject *parent) : CContextSimulator::CContextSimulator(QObject *parent) :
IContextSimulator(parent), IContextSimulator(parent),
m_simulator(new BlackCore::FSX::CSimulatorFSX(this)), m_simulator(nullptr),
m_updateTimer(nullptr), m_updateTimer(nullptr),
m_contextNetwork(nullptr) m_contextNetwork(nullptr)
{ {
m_updateTimer = new QTimer(this); m_updateTimer = new QTimer(this);
#ifdef BLACK_WITH_FSX
m_simulator = new BlackCore::FSX::CSimulatorFSX(this);
connect(m_simulator, &ISimulator::connectionChanged, this, &CContextSimulator::setConnectionStatus); connect(m_simulator, &ISimulator::connectionChanged, this, &CContextSimulator::setConnectionStatus);
#endif
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft); connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
} }
@@ -34,6 +41,9 @@ namespace BlackCore
bool CContextSimulator::isConnected() const bool CContextSimulator::isConnected() const
{ {
if (!m_simulator)
return false;
return m_simulator->isConnected(); return m_simulator->isConnected();
} }
@@ -44,6 +54,9 @@ namespace BlackCore
void CContextSimulator::updateOwnAircraft() void CContextSimulator::updateOwnAircraft()
{ {
if (!m_simulator)
return;
m_ownAircraft = m_simulator->getOwnAircraft(); m_ownAircraft = m_simulator->getOwnAircraft();
if (!m_contextNetwork) if (!m_contextNetwork)