From fd1ea14de591ecabb3ade192a3ddb97e8fbe316b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Thu, 29 Sep 2022 13:04:25 +0200 Subject: [PATCH] win fixes --- cmake/utils.cmake | 4 ++ code/foundation/CMakeLists.txt | 1 - code/foundation/src/core/rules_default.c | 2 +- .../src/packets/pkt_send_librg_update.c | 2 +- code/games/minimal/CMakeLists.txt | 1 - code/games/sandbox/CMakeLists.txt | 1 - code/vendors/flecs/CMakeLists.txt | 5 ++- win/setup_cl_generic.bat | 40 +++++++++++++++++++ 8 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 win/setup_cl_generic.bat diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 9a446f1..f07ece8 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -8,6 +8,10 @@ function(link_system_libs target_name) elseif (UNIX) target_link_libraries(${target_name} pthread m dl atomic) endif() + + if (NOT WIN32) + target_compile_options(${target_name} PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter) + endif () endfunction() macro(use_cxx11) diff --git a/code/foundation/CMakeLists.txt b/code/foundation/CMakeLists.txt index 006dbad..65d9b13 100644 --- a/code/foundation/CMakeLists.txt +++ b/code/foundation/CMakeLists.txt @@ -44,6 +44,5 @@ add_library(eco2d-foundation STATIC target_compile_definitions(eco2d-foundation PRIVATE CLIENT) include_directories(src ../modules ../../art/gen) target_link_libraries(eco2d-foundation raylib cwpack flecs-bundle vendors-bundle) -target_compile_options(eco2d-foundation PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter) link_system_libs(eco2d-foundation) diff --git a/code/foundation/src/core/rules_default.c b/code/foundation/src/core/rules_default.c index 857c6bd..7a18a15 100644 --- a/code/foundation/src/core/rules_default.c +++ b/code/foundation/src/core/rules_default.c @@ -1,6 +1,6 @@ #include "core/rules.h" -game_rulesdef game_rules = (game_rulesdef){ +game_rulesdef game_rules = { .phy_walk_drag = 4.23f, .demo_npc_move_speed = 500, .demo_npc_steer_speed = 300, diff --git a/code/foundation/src/packets/pkt_send_librg_update.c b/code/foundation/src/packets/pkt_send_librg_update.c index d1f6db8..90add70 100644 --- a/code/foundation/src/packets/pkt_send_librg_update.c +++ b/code/foundation/src/packets/pkt_send_librg_update.c @@ -23,7 +23,7 @@ size_t pkt_send_librg_update_encode(void *data, int32_t data_length, uint8_t lay #define NUM_SAMPLES 128 static float smooth_time(float time) { - static float time_samples[NUM_SAMPLES] = {}; + static float time_samples[NUM_SAMPLES] = {0}; static int32_t curr_index = 0; time_samples[curr_index] = time; diff --git a/code/games/minimal/CMakeLists.txt b/code/games/minimal/CMakeLists.txt index 5026428..08a019d 100644 --- a/code/games/minimal/CMakeLists.txt +++ b/code/games/minimal/CMakeLists.txt @@ -9,6 +9,5 @@ add_executable(minimal target_compile_definitions(minimal PRIVATE CLIENT) include_directories(src ../../foundation/src ../../../art/gen) target_link_libraries(minimal eco2d-foundation) -target_compile_options(minimal PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter) link_system_libs(minimal) diff --git a/code/games/sandbox/CMakeLists.txt b/code/games/sandbox/CMakeLists.txt index 599c939..eda60c1 100644 --- a/code/games/sandbox/CMakeLists.txt +++ b/code/games/sandbox/CMakeLists.txt @@ -9,6 +9,5 @@ add_executable(eco2d target_compile_definitions(eco2d PRIVATE CLIENT) include_directories(src ../../foundation/src ../../../art/gen) target_link_libraries(eco2d eco2d-foundation) -target_compile_options(eco2d PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter) link_system_libs(eco2d) diff --git a/code/vendors/flecs/CMakeLists.txt b/code/vendors/flecs/CMakeLists.txt index 06e4794..97a0e76 100644 --- a/code/vendors/flecs/CMakeLists.txt +++ b/code/vendors/flecs/CMakeLists.txt @@ -7,4 +7,7 @@ file(GLOB SRCS *.h ) add_library(flecs-bundle STATIC ${SRCS}) -target_compile_options(flecs-bundle PRIVATE "-Wno-enum-constexpr-conversion") + +if (NOT WIN32) + target_compile_options(flecs-bundle PRIVATE "-Wno-enum-constexpr-conversion") +endif() diff --git a/win/setup_cl_generic.bat b/win/setup_cl_generic.bat new file mode 100644 index 0000000..47aa026 --- /dev/null +++ b/win/setup_cl_generic.bat @@ -0,0 +1,40 @@ +@echo off + +where /q cl +IF %ERRORLEVEL% == 0 (EXIT /b) + +SET "LIB=" + + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0 +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 13.0 +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0 +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0 +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0 +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files\Microsoft Visual Studio\2022\Community +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\Common7\Tools\VsDevCmd.bat")) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %1)) + +SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools +IF NOT DEFINED LIB (IF EXIST "%VC_PATH%" (call "%VC_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %1))