diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c3f17479..17d90d64c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,6 +203,7 @@ option(ENABLE_HID_INPUT "Set to ON to build HID-based input code" ${EVENT_INPUT option(ENABLE_PLIB_JOYSTICK "Set to ON to enable legacy joystick code (default)" ON) option(ENABLE_SWIFT "Set to ON to build the swift module" ON) option(ENABLE_SENTRY "Set to ON to build the Sentry.io crash reporting" ON) +option(ENABLE_HUD "Set to ON to build the default head-up display" ON) # Test-suite options. option(ENABLE_AUTOTESTING "Set to ON to execute the test suite after building the test_suite target (default)" ON) diff --git a/src/Include/config_cmake.h.in b/src/Include/config_cmake.h.in index ca7061fcb..ac6ab924d 100644 --- a/src/Include/config_cmake.h.in +++ b/src/Include/config_cmake.h.in @@ -78,3 +78,5 @@ #define SENTRY_API_KEY "@sentry_api_key@" #cmakedefine ENABLE_OSGXR + +#cmakedefine ENABLE_HUD diff --git a/src/Instrumentation/CMakeLists.txt b/src/Instrumentation/CMakeLists.txt index 006527116..530c43c18 100644 --- a/src/Instrumentation/CMakeLists.txt +++ b/src/Instrumentation/CMakeLists.txt @@ -34,17 +34,6 @@ set(SOURCES transponder.cxx turn_indicator.cxx vertical_speed_indicator.cxx - HUD/HUD.cxx - HUD/HUD_dial.cxx - HUD/HUD_gauge.cxx - HUD/HUD_instrument.cxx - HUD/HUD_label.cxx - HUD/HUD_ladder.cxx - HUD/HUD_misc.cxx - HUD/HUD_runway.cxx - HUD/HUD_scale.cxx - HUD/HUD_tape.cxx - HUD/HUD_tbi.cxx KLN89/kln89.cxx KLN89/kln89_page.cxx KLN89/kln89_page_act.cxx @@ -97,8 +86,6 @@ set(HEADERS transponder.hxx turn_indicator.hxx vertical_speed_indicator.hxx - HUD/HUD.hxx - HUD/HUD_private.hxx KLN89/kln89.hxx KLN89/kln89_page.hxx KLN89/kln89_page_act.hxx @@ -115,6 +102,26 @@ set(HEADERS KLN89/kln89_page_usr.hxx KLN89/kln89_page_vor.hxx KLN89/kln89_page_alt.hxx +) + +if (ENABLE_HUD) + list(APPEND SOURCES + HUD/HUD.cxx + HUD/HUD_dial.cxx + HUD/HUD_gauge.cxx + HUD/HUD_instrument.cxx + HUD/HUD_label.cxx + HUD/HUD_ladder.cxx + HUD/HUD_misc.cxx + HUD/HUD_runway.cxx + HUD/HUD_scale.cxx + HUD/HUD_tape.cxx + HUD/HUD_tbi.cxx ) + list(APPEND HEADERS + HUD/HUD.hxx + HUD/HUD_private.hxx + ) +endif() flightgear_component(Instruments "${SOURCES}" "${HEADERS}") diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 95babe922..ce06ba7f6 100755 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -114,7 +114,9 @@ #include #include #include +#ifdef ENABLE_HUD #include +#endif #include #include #include @@ -1081,7 +1083,9 @@ void fgCreateSubsystems(bool duringReset) { // SGSubsystemMgr::DISPLAY { +#ifdef ENABLE_HUD mgr->add(); +#endif mgr->add(); simgear::canvas::Canvas::setSystemAdapter( diff --git a/src/Main/subsystemFactory.cxx b/src/Main/subsystemFactory.cxx index d8fc89897..a7f6ea8cb 100644 --- a/src/Main/subsystemFactory.cxx +++ b/src/Main/subsystemFactory.cxx @@ -41,7 +41,9 @@ #include #include #include -#include +#ifdef ENABLE_HUD +# include +#endif #include #include #include @@ -88,7 +90,9 @@ SGSubsystem* createSubsystemByName(const std::string& name) MAKE_SUB(Ephemeris, "ephemeris"); MAKE_SUB(FGSystemMgr, "systems"); MAKE_SUB(FGInstrumentMgr, "instrumentation"); +#ifdef ENABLE_HUD MAKE_SUB(HUD, "hud"); +#endif MAKE_SUB(flightgear::CockpitDisplayManager, "cockpit-displays"); MAKE_SUB(FGRouteMgr, "route-manager"); MAKE_SUB(FGIO, "io"); diff --git a/src/Viewer/renderer.cxx b/src/Viewer/renderer.cxx index 5dc228d1f..ffd1b6bf3 100644 --- a/src/Viewer/renderer.cxx +++ b/src/Viewer/renderer.cxx @@ -96,7 +96,9 @@ #include #include -#include +#ifdef ENABLE_HUD +# include +#endif #include #include #include @@ -146,6 +148,7 @@ private: SGPropertyNode_ptr mConfigNode; }; +#ifdef ENABLE_HUD class SGHUDDrawable : public osg::Drawable { public: @@ -194,6 +197,8 @@ public: private: }; +#endif + class FGLightSourceUpdateCallback : public osg::NodeCallback { public: @@ -726,9 +731,11 @@ FGRenderer::setupView( void ) osg::Camera* guiCamera = getGUICamera(CameraGroup::getDefault()); if (guiCamera) { +#ifdef ENABLE_HUD osg::Geode* hudGeode = new osg::Geode; hudGeode->addDrawable(new SGHUDDrawable); guiCamera->addChild(hudGeode); +#endif #if defined(HAVE_PUI) _puiCamera = new flightgear::PUICamera;