Issue #643 - Rewrite CLI vs GUI strategy (this matches DefleMask)

This commit is contained in:
James Alan Nguyen 2023-02-25 19:20:51 +11:00
parent 9c4016b86c
commit f9cbf17a07
2 changed files with 10 additions and 6 deletions

View File

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

View File

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