From 5954369744dcf8d1e52efc5613c81ead199e9957 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 24 Oct 2023 09:56:56 +0300 Subject: [PATCH] Windows compile fixes --- CMakeLists.txt | 4 +--- src/voxels/ChunksController.cpp | 2 +- src/voxels/ChunksLoader.h | 4 ++-- src/window/Window.cpp | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de5f1f0e..36b489df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,6 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /W4) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/glfw) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/glm) else() target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra) endif() @@ -21,13 +19,13 @@ find_package(OpenAL REQUIRED) if (WIN32) set(PNGLIB spng) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/glfw) else() find_package(PNG REQUIRED) set(PNGLIB PNG::PNG) endif(WIN32) set(LIBS "") -set(LIBS glm) if(UNIX) find_package(Threads REQUIRED) diff --git a/src/voxels/ChunksController.cpp b/src/voxels/ChunksController.cpp index b943e260..e3fc3a71 100644 --- a/src/voxels/ChunksController.cpp +++ b/src/voxels/ChunksController.cpp @@ -10,7 +10,7 @@ #include #include -#ifdef _WIN32 +#if defined(_WIN32) && defined(__MINGW32__) #define _WIN32_WINNT 0x0501 #include #else diff --git a/src/voxels/ChunksLoader.h b/src/voxels/ChunksLoader.h index 876b0c8c..27a656e9 100644 --- a/src/voxels/ChunksLoader.h +++ b/src/voxels/ChunksLoader.h @@ -1,12 +1,12 @@ #ifndef VOXELS_CHUNKSLOADER_H_ #define VOXELS_CHUNKSLOADER_H_ -#ifdef _WIN32 +#if defined(_WIN32) && defined(__MINGW32__) #define _WIN32_WINNT 0x0501 #include #else #include -#endif +#endif // _WIN32 && __MINGW32__ #include diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 05e24727..9a11b210 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -1,9 +1,9 @@ #include +#include "Window.h" #include #include -#include "Window.h" -GLFWwindow* Window::window; +GLFWwindow* Window::window = nullptr; uint Window::width = 0; uint Window::height = 0;