1
0
Fork 0

- Make Qt check guarded by a CMake option

- Only init QApplication if showing the launcher.
This commit is contained in:
James Turner 2015-01-10 14:05:23 +00:00
parent e94371ebfc
commit 7d9609116b
2 changed files with 15 additions and 15 deletions

View file

@ -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)

View file

@ -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 );
@ -465,6 +458,11 @@ int fgMainInit( int argc, char **argv )
showLauncher |= (::getenv("FG_LAUNCHER") != 0);
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);