Skip to content

Commit 9f19d64

Browse files
committed
Option to compile Windows build in console subsystem
1 parent 6a3fe28 commit 9f19d64

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(tophat)
55
if(MSVC)
66
set(umka_dir ${CMAKE_CURRENT_SOURCE_DIR}/lib/umka/umka_windows_msvc)
77
set(umka_lib_path ${umka_dir}/libumka_static.lib)
8-
8+
99
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmd/win-buildmodules.bat WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE ret)
1010
if (NOT ret EQUAL "0")
1111
message(FATAL_ERROR "Failed to generate staembed.c")
@@ -15,11 +15,11 @@ if(MSVC)
1515
"src/*.c"
1616
)
1717

18-
add_executable(tophat WIN32 ${th_sources})
19-
18+
add_executable(tophat ${th_sources})
19+
2020
# NOTE(skejeton): _USE_MATH_DEFINES flag for M_PI and so on.
21-
# NOTE(skejeton): UMKA_STATIC flag for we are linking umka statically not as a DLL.
22-
target_compile_definitions(tophat PUBLIC UMKA_STATIC _USE_MATH_DEFINES)
21+
# NOTE(skejeton): UMKA_STATIC flag for we are linking umka statically not as a DLL.
22+
target_compile_definitions(tophat PUBLIC UMKA_STATIC _USE_MATH_DEFINES _CONSOLE)
2323
# target_compile_options(tophat PRIVATE /fsanitize=address)
2424

2525
target_include_directories(tophat PUBLIC

src/misc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ th_error(char *text, ...)
4646

4747
va_list args;
4848
va_start(args, text);
49-
#ifdef _WIN32
49+
#if defined(_WIN32) && !defined(_CONSOLE)
5050
#include <winuser.h>
5151
char buf[4096];
5252
vsnprintf(buf, 4096, text, args);
@@ -62,7 +62,7 @@ th_info(char *text, ...)
6262
{
6363
va_list args;
6464
va_start(args, text);
65-
#ifdef _WIN32
65+
#if defined(_WIN32) && !defined(_CONSOLE)
6666
#include <winuser.h>
6767
char buf[4096];
6868
vsnprintf(buf, 4096, text, args);

0 commit comments

Comments
 (0)