Skip to content

Commit

Permalink
Fix cmake exe unicode bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eric15342335 committed Jun 17, 2024
1 parent 7e261ac commit c2b12cc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ else()
set(OUTPUT_NAME "stocksim")
endif()

add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:-utf-8>")

add_executable(${OUTPUT_NAME}
src/main.cpp
src/random_price.cpp
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ OUTPUT = stocksim-msvc.exe
endif
endif

# -GL can further reduce size, but more likely to flag as malicious
msvc: src/*.cpp include/*.h clean
cl -std:c++17 -EHsc -utf-8 -Iinclude -W1 -WX -O1 -guard:cf -MP \
src/*.cpp -Fe:$(OUTPUT)
Expand Down
4 changes: 1 addition & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ void enableWindowsVTProcessing(void) {
// Enable virtual terminal processing
consoleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), consoleMode);
std::cout << "Experimental Windows VT processing enabled." << std::endl;
// Enable Data Execution Prevention (DEP) for the process
SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
std::cout << "Experimental Windows VT processing enabled.\n";
}
#else
#define enableWindowsVTProcessing() // Do nothing
Expand Down

0 comments on commit c2b12cc

Please sign in to comment.