diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index f2e95c1aa..83f58967a 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -101,9 +101,6 @@ if (WIN32) # Set Windows application icon target_sources(olive-editor PRIVATE packaging/windows/resources.rc) - set_target_properties(olive-editor PROPERTIES - WIN32_EXECUTABLE TRUE - ) elseif(APPLE) # Set Mac application icon set(OLIVE_ICON packaging/macos/olive.icns) diff --git a/app/main.cpp b/app/main.cpp index 14dd9bbf1..f177be0de 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -42,6 +42,10 @@ extern "C" { #include "common/debug.h" #include "version.h" +#ifdef _WIN32 +#include +#endif + #ifdef USE_CRASHPAD #include "common/crashpadinterface.h" #endif // USE_CRASHPAD @@ -100,10 +104,17 @@ int main(int argc, char *argv[]) true, QCoreApplication::translate("main", "qm-file")); +#ifdef _WIN32 + auto console_option = + parser.AddOption({QStringLiteral("c"), QStringLiteral("-console")}, + QCoreApplication::translate("main", "Launch with debug console")); +#endif // _WIN32 + auto project_argument = parser.AddPositionalArgument(QStringLiteral("project"), QCoreApplication::translate("main", "Project to open on startup")); + // Qt options re-implemented (add to this as necessary) // // Because we don't use QCommandLineParser, we must filter out Qt's arguments ourselves. Here, @@ -178,6 +189,14 @@ int main(int argc, char *argv[]) std::unique_ptr a; if (startup_params.run_mode() == olive::Core::CoreParams::kRunNormal) { +#ifdef _WIN32 + // Since Olive is linked with the console subsystem (for better POSIX compatibility), a console + // is created by default. If the user didn't request one, we free it here. + if (!console_option->IsSet()) { + FreeConsole(); + } +#endif // _WIN32 + a.reset(new QApplication(argc, argv)); } else { a.reset(new QCoreApplication(argc, argv));