diff --git a/CMakeLists.txt b/CMakeLists.txt index f994cfd55..5eddbf1bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -780,13 +780,15 @@ endif() if(ANDROID AND NOT TERMUX) add_library(furnace SHARED ${USED_SOURCES}) +elseif(WIN32) + add_executable(furnace WIN32 ${USED_SOURCES}) else() add_executable(furnace ${USED_SOURCES}) endif() target_include_directories(furnace SYSTEM PRIVATE ${DEPENDENCIES_INCLUDE_DIRS}) target_compile_definitions(furnace PRIVATE ${DEPENDENCIES_DEFINES} IMGUI_USER_CONFIG="imconfig_fur.h") -target_compile_options(furnace PRIVATE ${DEPENDENCIES_COMPILE_OPTIONS}) +target_compile_options(furnace PRIVATE ${DEPENDENCIES_COMPILE_OPfTIONS}) target_link_libraries(furnace PRIVATE ${DEPENDENCIES_LIBRARIES}) if (PKG_CONFIG_FOUND AND (SYSTEM_FMT OR SYSTEM_LIBSNDFILE OR SYSTEM_ZLIB OR SYSTEM_SDL2 OR SYSTEM_RTMIDI OR WITH_JACK)) if ("${CMAKE_VERSION}" VERSION_LESS "3.13") diff --git a/src/main.cpp b/src/main.cpp index d8cc440b6..6ebedae31 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -342,12 +342,14 @@ void reportError(String what) { // TODO: CoInitializeEx on Windows? // TODO: add crash log int main(int argc, char** argv) { - // Windows console thing - thanks MarioKart7z! + // Windows console thing - thanks dj.tuBIG/MaliceX #ifdef _WIN32 - DWORD winPID; - HWND winConsole=GetConsoleWindow(); - GetWindowThreadProcessId(winConsole,&winPID); - if (GetCurrentProcessId()==winPID) FreeConsole(); + + if (AttachConsole(ATTACH_PARENT_PROCESS)) { + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + freopen("CONIN$", "r", stdin); + } #endif initLog();