Disable automatically opening the console on windows yuzu-cmd builds (#9485)

* don't automatically open the console on windows build of yuzu-cmd

* fix formatting
This commit is contained in:
Chris Oboe 2022-12-24 03:39:59 +01:00 committed by GitHub
parent db15142ac9
commit 201733d1b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -49,6 +49,15 @@ if(UNIX AND NOT APPLE)
install(TARGETS yuzu-cmd) install(TARGETS yuzu-cmd)
endif() endif()
if(WIN32)
# compile as a win32 gui application instead of a console application
if(MSVC)
set_target_properties(yuzu-cmd PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
elseif(MINGW)
set_target_properties(yuzu-cmd PROPERTIES LINK_FLAGS_RELEASE "-Wl,--subsystem,windows")
endif()
endif()
if (MSVC) if (MSVC)
include(CopyYuzuSDLDeps) include(CopyYuzuSDLDeps)
copy_yuzu_SDL_deps(yuzu-cmd) copy_yuzu_SDL_deps(yuzu-cmd)

View file

@ -174,6 +174,13 @@ static void OnStatusMessageReceived(const Network::StatusMessageEntry& msg) {
/// Application entry point /// Application entry point
int main(int argc, char** argv) { int main(int argc, char** argv) {
#ifdef _WIN32
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "wb", stdout);
freopen("CONOUT$", "wb", stderr);
}
#endif
Common::Log::Initialize(); Common::Log::Initialize();
Common::Log::SetColorConsoleBackendEnabled(true); Common::Log::SetColorConsoleBackendEnabled(true);
Common::Log::Start(); Common::Log::Start();