From 6f927365ca675defd1013d17c03551b2f3872a49 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Sat, 1 Jun 2024 21:03:49 -0600 Subject: [PATCH] Fixed windows compilation --- .gitignore | 3 ++- CMakeLists.txt | 17 ++++++++++++++++- src/port/Engine.cpp | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 32ce0889..2b77ef12 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,5 @@ code/ !/assets/**/*custom*/**/*.bin # Torch hash torch.hash.yml -merge/ \ No newline at end of file +merge/ +.vs/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b2e72ca4..21cb9dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ if(NOT CMAKE_BUILD_TYPE ) endif() vcpkg_bootstrap() -vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3) +vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3 nlohmann-json tinyxml2 spdlog) endif() if (MSVC) @@ -47,6 +47,21 @@ else() set(CPP "${CMAKE_C_COMPILER}" "-E" "-P" "-Wno-trigraphs" "-x" "c") endif() +################################################################################ +# Set target arch type if empty. Visual studio solution generator provides it. +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(NOT CMAKE_VS_PLATFORM_NAME) + set(CMAKE_VS_PLATFORM_NAME "x64") + endif() + message("${CMAKE_VS_PLATFORM_NAME} architecture in use") + + if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64" + OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")) + message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!") + endif() +endif() + # Set game compilation version set(VERSION us) set(USE_NETWORKING OFF) diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 7b96a425..88ef9fbe 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -13,7 +13,10 @@ #include "port/Enhancements/mods.h" #include #include + +#ifdef USE_NETWORKING #include +#endif #include