From 7d9609116b07d2dd6fad38dfea0d9ebc8e1f4b56 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 10 Jan 2015 14:05:23 +0000 Subject: [PATCH] - Make Qt check guarded by a CMake option - Only init QApplication if showing the launcher. --- CMakeLists.txt | 16 +++++++++------- src/Main/main.cxx | 14 ++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92f9c7b67..5b161e646 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,7 @@ option(ENABLE_METAR "Set to ON to build the metar application (default)" ON option(ENABLE_TESTS "Set to ON to build test applications (default)" ON) option(ENABLE_FGCOM "Set to ON to build the FGCom application (default)" ON) option(ENABLE_FLITE "Set to ON to build the Flite text-to-speech module" ON) +option(ENABLE_QT "Set to ON to build the internal Qt launcher" ON) if(LOGGING) # nothing @@ -279,13 +280,14 @@ list(APPEND SQLITE3_LIBRARY ${CMAKE_THREAD_LIBS_INIT}) ############################################################################## ## Qt5 setup setup - -find_package(Qt5 5.1 COMPONENTS Widgets) -if (Qt5Widgets_FOUND) - message(STATUS "Will enable Qt launcher GUI") - set(HAVE_QT 1) -endif() - +if (ENABLE_QT) + message(STATUS "Qt launcher enabled, checking for Qt 5.1 / qmake") + find_package(Qt5 5.1 COMPONENTS Widgets) + if (Qt5Widgets_FOUND) + message(STATUS "Will enable Qt launcher GUI") + set(HAVE_QT 1) + endif() +endif (ENABLE_QT) ############################################################################## find_package(PLIB REQUIRED puaux pu js fnt) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index b578e464a..ebcb6bb7f 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -401,13 +401,6 @@ static void logToFile() // Main top level initialization int fgMainInit( int argc, char **argv ) { -#if defined(HAVE_QT) - QApplication app(argc, argv); - app.setOrganizationName("FlightGear"); - app.setApplicationName("FlightGear"); - app.setOrganizationDomain("flightgear.org"); -#endif - // set default log levels sglog().setLogLevels( SG_ALL, SG_ALERT ); @@ -464,7 +457,12 @@ int fgMainInit( int argc, char **argv ) // environment variables. This avoids needed a wrapper shell-script on OS-X. showLauncher |= (::getenv("FG_LAUNCHER") != 0); - if (showLauncher) { + if (showLauncher) { + QApplication app(argc, argv); + app.setOrganizationName("FlightGear"); + app.setApplicationName("FlightGear"); + app.setOrganizationDomain("flightgear.org"); + // avoid double Apple menu and other weirdness if both Qt and OSG // try to initialise various Cocoa structures. flightgear::WindowBuilder::setPoseAsStandaloneApp(false); -- 2.39.5