Skip to content

Commit

Permalink
Option to compile Windows build in console subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
skejeton committed Mar 14, 2024
1 parent 6a3fe28 commit 9f19d64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project(tophat)
if(MSVC)
set(umka_dir ${CMAKE_CURRENT_SOURCE_DIR}/lib/umka/umka_windows_msvc)
set(umka_lib_path ${umka_dir}/libumka_static.lib)

execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmd/win-buildmodules.bat WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE ret)
if (NOT ret EQUAL "0")
message(FATAL_ERROR "Failed to generate staembed.c")
Expand All @@ -15,11 +15,11 @@ if(MSVC)
"src/*.c"
)

add_executable(tophat WIN32 ${th_sources})
add_executable(tophat ${th_sources})

# NOTE(skejeton): _USE_MATH_DEFINES flag for M_PI and so on.
# NOTE(skejeton): UMKA_STATIC flag for we are linking umka statically not as a DLL.
target_compile_definitions(tophat PUBLIC UMKA_STATIC _USE_MATH_DEFINES)
# NOTE(skejeton): UMKA_STATIC flag for we are linking umka statically not as a DLL.
target_compile_definitions(tophat PUBLIC UMKA_STATIC _USE_MATH_DEFINES _CONSOLE)
# target_compile_options(tophat PRIVATE /fsanitize=address)

target_include_directories(tophat PUBLIC
Expand Down
4 changes: 2 additions & 2 deletions src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ th_error(char *text, ...)

va_list args;
va_start(args, text);
#ifdef _WIN32
#if defined(_WIN32) && !defined(_CONSOLE)
#include <winuser.h>
char buf[4096];
vsnprintf(buf, 4096, text, args);
Expand All @@ -62,7 +62,7 @@ th_info(char *text, ...)
{
va_list args;
va_start(args, text);
#ifdef _WIN32
#if defined(_WIN32) && !defined(_CONSOLE)
#include <winuser.h>
char buf[4096];
vsnprintf(buf, 4096, text, args);
Expand Down

0 comments on commit 9f19d64

Please sign in to comment.