Window console changes
- default to SUBSYSTEM:WINDOWS (we can still AllocConsole if needed) - add --console option to get a console on Windows - ensure --show-aircraft and --help modes show the console automatically.
This commit is contained in:
parent
cc23e29ef0
commit
6bd2acab78
3 changed files with 14 additions and 4 deletions
|
@ -67,7 +67,11 @@ endforeach()
|
||||||
|
|
||||||
source_group("Main\\Headers" FILES ${HEADERS})
|
source_group("Main\\Headers" FILES ${HEADERS})
|
||||||
source_group("Main\\Sources" FILES ${SOURCES})
|
source_group("Main\\Sources" FILES ${SOURCES})
|
||||||
add_executable(fgfs ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
|
|
||||||
|
# important we pass WIN32 here so the console is optional. Other
|
||||||
|
# platforms ignore this option. If a console is needed we allocate
|
||||||
|
# it manually via AllocConsole()
|
||||||
|
add_executable(fgfs WIN32 ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
|
||||||
|
|
||||||
get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
|
get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
|
||||||
#message(STATUS "fg libs ${FG_LIBS}")
|
#message(STATUS "fg libs ${FG_LIBS}")
|
||||||
|
|
|
@ -919,8 +919,9 @@ public:
|
||||||
{
|
{
|
||||||
fgFindAircraftInDir(path, this, &ShowAircraft::processAircraft);
|
fgFindAircraftInDir(path, this, &ShowAircraft::processAircraft);
|
||||||
|
|
||||||
|
simgear::requestConsole(); // ensure console is shown on Windows
|
||||||
|
|
||||||
std::sort(_aircraft.begin(), _aircraft.end(), ciLessLibC());
|
std::sort(_aircraft.begin(), _aircraft.end(), ciLessLibC());
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on Windows
|
|
||||||
cout << "Available aircraft:" << endl;
|
cout << "Available aircraft:" << endl;
|
||||||
for ( unsigned int i = 0; i < _aircraft.size(); i++ ) {
|
for ( unsigned int i = 0; i < _aircraft.size(); i++ ) {
|
||||||
cout << _aircraft[i] << endl;
|
cout << _aircraft[i] << endl;
|
||||||
|
|
|
@ -1305,6 +1305,7 @@ struct OptionDesc {
|
||||||
} fgOptionArray[] = {
|
} fgOptionArray[] = {
|
||||||
|
|
||||||
{"language", true, OPTION_IGNORE, "", false, "", 0 },
|
{"language", true, OPTION_IGNORE, "", false, "", 0 },
|
||||||
|
{"console", false, OPTION_IGNORE, "", false, "", 0 },
|
||||||
{"disable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", false, "", 0 },
|
{"disable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", false, "", 0 },
|
||||||
{"enable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", true, "", 0 },
|
{"enable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", true, "", 0 },
|
||||||
{"renderer", true, OPTION_STRING, "/sim/rendering/rembrandt/renderer", false, "", 0 },
|
{"renderer", true, OPTION_STRING, "/sim/rendering/rembrandt/renderer", false, "", 0 },
|
||||||
|
@ -1896,6 +1897,9 @@ int Options::parseOption(const string& s)
|
||||||
} else if ( (s == "--verbose") || (s == "-v") ) {
|
} else if ( (s == "--verbose") || (s == "-v") ) {
|
||||||
// verbose help/usage request
|
// verbose help/usage request
|
||||||
return FG_OPTIONS_VERBOSE_HELP;
|
return FG_OPTIONS_VERBOSE_HELP;
|
||||||
|
} else if ((s == "--console") || (s == "-c")) {
|
||||||
|
simgear::requestConsole();
|
||||||
|
return FG_OPTIONS_OK;
|
||||||
} else if (s.find("-psn") == 0) {
|
} else if (s.find("-psn") == 0) {
|
||||||
// on Mac, when launched from the GUI, we are passed the ProcessSerialNumber
|
// on Mac, when launched from the GUI, we are passed the ProcessSerialNumber
|
||||||
// as an argument (and no others). Silently ignore the argument here.
|
// as an argument (and no others). Silently ignore the argument here.
|
||||||
|
@ -2096,7 +2100,7 @@ void Options::showUsage() const
|
||||||
FGLocale *locale = globals->get_locale();
|
FGLocale *locale = globals->get_locale();
|
||||||
SGPropertyNode options_root;
|
SGPropertyNode options_root;
|
||||||
|
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on Windows
|
simgear::requestConsole(); // ensure console is shown on Windows
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -2288,7 +2292,8 @@ void Options::setupRoot()
|
||||||
if ( !(base_version == required_version) ) {
|
if ( !(base_version == required_version) ) {
|
||||||
// tell the operator how to use this application
|
// tell the operator how to use this application
|
||||||
|
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on windows
|
simgear::requestConsole(); // ensure console is shown on Windows
|
||||||
|
|
||||||
cerr << endl << "Base package check failed:" << endl \
|
cerr << endl << "Base package check failed:" << endl \
|
||||||
<< " Version " << base_version << " found at: " \
|
<< " Version " << base_version << " found at: " \
|
||||||
<< globals->get_fg_root() << endl \
|
<< globals->get_fg_root() << endl \
|
||||||
|
|
Loading…
Add table
Reference in a new issue