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

@@ -37,12 +37,15 @@ DEFINES += LOG_IN_FILE
HEADERS += *.h
SOURCES += *.cpp
HEADERS += $$PWD/fsx/*.h
SOURCES += $$PWD/fsx/*.cpp
win32 {
HEADERS += $$PWD/win/*.h
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

View File

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

View File

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