Skip to content

Commit 0c00d55

Browse files
Merge pull request #209
fix cmake <3.5 dependency
2 parents 9792a4d + d3dc6c1 commit 0c00d55

File tree

2 files changed

+49
-49
lines changed

2 files changed

+49
-49
lines changed

cmake/Dependencies.cmake

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@ set(FETCH_CONTENT_QUIET FALSE)
88
FetchContent_Declare(
99
glew
1010

11-
URL https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.zip
12-
URL_HASH MD5=970535b75b1b69ebd018a0fa05af63d1
13-
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/glew
11+
# URL https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.zip
12+
# URL_HASH MD5=970535b75b1b69ebd018a0fa05af63d1
13+
GIT_REPOSITORY https://github.com/Perlmint/glew-cmake.git
14+
GIT_TAG 918ece3da858c2e28e10f6507378af01647cb139
15+
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/glew
1416
)
1517

1618
FetchContent_Declare(
1719
sdl2
1820

19-
URL https://github.com/libsdl-org/SDL/releases/download/release-2.26.5/SDL2-2.26.5.zip
20-
URL_HASH MD5=0664f3980570c4641128866e6c9f2e29
21+
URL https://github.com/libsdl-org/SDL/releases/download/release-2.32.4/SDL2-2.32.4.zip
22+
# URL_HASH MD5=ccda8e75aa61112bc541eeb78d13784d
23+
# GIT_REPOSITORY https://github.com/lidsdl-org/SDL.git
24+
# GIT_TAG 2359383fc187386204c3bb22de89655a494cd128
2125
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2
2226
)
2327

@@ -26,22 +30,26 @@ FetchContent_Declare(
2630

2731
URL https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.3/SDL2_image-2.6.3.zip
2832
URL_HASH MD5=ecedb5078bbd31e7d1552e2b1443d2f6
33+
# GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git
34+
# GIT_TAG c1bf2245b0ba63a25afe2f8574d305feca25af77
2935
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_image
3036
)
3137

3238
FetchContent_Declare(
3339
sdl2_ttf
3440

35-
URL https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.2/SDL2_ttf-2.20.2.zip
36-
URL_HASH MD5=7258258fdb2a4adb0072d337f94305f9
41+
# URL https://github.com/libsdl-org/SDL_ttf/releases/download/release-3.2.2/SDL3_ttf-3.2.2.zip
42+
# URL_HASH MD5=e4ddd51fa4825f26b5c9bc8f4b010ed1
43+
GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf.git
44+
GIT_TAG db1e6d14494bfffe464c50667a26941cc3a36324
3745
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_ttf
3846
)
3947
FetchContent_Declare(
40-
sdl2_mixer
48+
sdl2_mixer
4149

42-
URL https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.3/SDL2_mixer-2.6.3.zip
43-
URL_HASH MD5=fb3e71ef072ff8dd793cec3ed384f9a0
44-
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer
50+
URL https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.3/SDL2_mixer-2.6.3.zip
51+
URL_HASH MD5=fb3e71ef072ff8dd793cec3ed384f9a0
52+
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer
4553
)
4654

4755
FetchContent_Declare( # At this time 1.11.0 has some issues formatting `const unsigned char *`
@@ -55,8 +63,8 @@ FetchContent_Declare( # At this time 1.11.0 has some issues formatting `const un
5563
FetchContent_Declare(
5664
glm
5765

58-
URL https://github.com/g-truc/glm/releases/download/0.9.9.8/glm-0.9.9.8.zip
59-
URL_HASH MD5=69895110052f0d711c9c54fbf385f6f5
66+
URL https://github.com/g-truc/glm/releases/download/1.0.1/glm-1.0.1-light.7z
67+
# URL_HASH MD5=7d235d4813a2e7b1e10cc711b8e25213
6068
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/glm
6169
)
6270

@@ -107,47 +115,37 @@ set(JSON_ImplicitConversions OFF)
107115
# For Windows: Prevent overriding the parent project's compiler/linker settings
108116
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
109117

110-
FetchContent_MakeAvailable(sdl2 sdl2_image sdl2_ttf sdl2_mixer spdlog glm googletest nlohmann_json)
111-
112118
add_compile_definitions(GLEW_NO_GLU)
113119

114-
FetchContent_GetProperties(glew)
115-
if (NOT ${glew_POPULATED})
116-
FetchContent_Populate(glew)
117-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/build/cmake)
118-
endif()
119-
120-
FetchContent_GetProperties(imgui)
121-
if (NOT ${imgui_POPULATED})
122-
FetchContent_Populate(imgui)
123-
set(IMGUI_SOURCE
124-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/backends/imgui_impl_sdl2.cpp
125-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/backends/imgui_impl_opengl3.cpp
126-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui.cpp
127-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_demo.cpp
128-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_draw.cpp
129-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_tables.cpp
130-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_widgets.cpp
131-
)
132-
133-
set(IMGUI_INCLUDE_DIR
134-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/
135-
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/backends/
136-
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/include/
137-
)
138-
139-
add_library(ImGui STATIC
140-
${IMGUI_SOURCE}
141-
)
142-
target_include_directories(ImGui PUBLIC
143-
${IMGUI_INCLUDE_DIR}
144-
)
145-
endif()
120+
FetchContent_MakeAvailable(glew sdl2 sdl2_image sdl2_ttf sdl2_mixer spdlog glm googletest imgui nlohmann_json)
121+
122+
set(IMGUI_SOURCE
123+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/backends/imgui_impl_sdl2.cpp
124+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/backends/imgui_impl_opengl3.cpp
125+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui.cpp
126+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_demo.cpp
127+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_draw.cpp
128+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_tables.cpp
129+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/imgui_widgets.cpp
130+
)
131+
132+
set(IMGUI_INCLUDE_DIR
133+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/
134+
${CMAKE_CURRENT_SOURCE_DIR}/lib/imgui/backends/
135+
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/include/
136+
)
137+
138+
add_library(ImGui STATIC
139+
${IMGUI_SOURCE}
140+
)
141+
target_include_directories(ImGui PUBLIC
142+
${IMGUI_INCLUDE_DIR}
143+
)
146144

147145

148146
set(DEPENDENCY_LINK_LIBRARIES
149147
${OPENGL_LIBRARY}
150-
glew_s
148+
libglew_static
151149

152150
SDL2::SDL2-static
153151
SDL2_image::SDL2_image-static
@@ -165,7 +163,7 @@ set(DEPENDENCY_INCLUDE_DIRS
165163
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/include/
166164
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/include/
167165
${CMAKE_CURRENT_SOURCE_DIR}/lib/spdlog/include/
168-
${CMAKE_CURRENT_SOURCE_DIR}/lib/glm/
166+
${CMAKE_CURRENT_SOURCE_DIR}/lib/
169167
${IMGUI_INCLUDE_DIR}
170168
${CMAKE_CURRENT_SOURCE_DIR}/lib/nlohmann_json/include/
171169
)

include/pch.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
#include <SDL.h>
1414
#include <SDL_events.h>
1515
#include <SDL_image.h>
16+
1617
#include <SDL_mixer.h>
1718
#include <SDL_ttf.h>
1819

1920
#include <GL/glew.h>
2021

22+
#define GLM_ENABLE_EXPERIMENTAL
2123
#include <glm/glm.hpp>
2224
#include <glm/gtx/matrix_transform_2d.hpp>
2325
#include <glm/gtx/string_cast.hpp>

0 commit comments

Comments
 (0)