From f5fceb32fbe715aae6efaee4163d669883d72df2 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 29 Aug 2021 12:14:27 +0200 Subject: [PATCH] Bunch of fixes for Windows. --- CMakeLists.txt | 12 ++++++++++++ src/main.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33efbce..5cd2b59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,3 +17,15 @@ add_definitions(-DLEVEL_U8) SET(_LINKS Arbutils CreatureLib pkmnLib -lpthread) target_link_libraries(PokemonScriptTester PUBLIC ${_LINKS}) target_compile_options(PokemonScriptTester PRIVATE -Wall -Wextra -Werror) + +if (WINDOWS) + MESSAGE(WARNING, "Using Windows Build.") + # Add a definition for the compiler, so we can use it in C++ as well. + ADD_DEFINITIONS(-D WINDOWS=1) + # -m64: Build a 64 bit library + add_compile_options(-m64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition") + if (SHARED) + set_target_properties(PokemonScriptTester PROPERTIES SUFFIX ".dll") + endif(SHARED) +endif (WINDOWS) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 133807c..9ef758e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) { workingDirectory = args::get(workingDirFlag); } if (!workingDirectory.empty()) { - chdir(std::filesystem::path(workingDirectory).c_str()); + chdir((const char*)std::filesystem::path(workingDirectory).c_str()); } std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();