blob: 0900da76ad21da62f36bc62cbef27da21088b8d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
cmake_minimum_required(VERSION 3.27)
cmake_policy(SET CMP0135 NEW)
project(pke VERSION 0.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread")
set(PKE_SOURCE_FILES
src/macros.hpp
src/arg-handler.hpp
src/arg-handler.cpp
src/array.hpp
src/camera.hpp
src/camera.cpp
src/components.hpp
src/components.cpp
src/ecs.hpp
src/ecs.cpp
src/entities.hpp
src/entities.cpp
src/event.hpp
src/event.cpp
src/game.hpp
src/game.cpp
src/game-settings.hpp
src/game-settings.cpp
src/game-type-defs.hpp
src/helpers.hpp
src/helpers.cpp
src/level-types.hpp
src/level-types.cpp
src/level.hpp
src/level.cpp
src/math-helpers.hpp
src/math-helpers.cpp
src/memory-type-defs.hpp
src/memory.hpp
src/memory.cpp
src/dynamic-array.hpp
src/dynamic-array.cpp
src/asset-manager.hpp
src/asset-manager.cpp
src/physics.hpp
src/physics.cpp
src/pkstr.hpp
src/pkstr.cpp
src/player-input.hpp
src/player-input.cpp
src/plugins.hpp
src/plugins.cpp
src/project.hpp
src/project.cpp
src/project-settings.hpp
src/project-settings.cpp
src/static/cube.hpp
src/static/cube.cpp
src/thread_pool.hpp
src/thread_pool.cpp
src/vendor/cgltf-include.hpp
src/vendor/cgltf-include.cpp
src/vendor/glm_include.hpp
src/vendor/stb_image_include.hpp
src/vendor/stb_image_include.cpp
src/vendor/tinyfiledialogs/tinyfiledialogs.h
src/vendor/tinyfiledialogs/tinyfiledialogs.c
src/window.hpp
src/window.cpp
src/window-types.hpp
)
include(FetchContent)
FetchContent_Declare(
imguidocked
URL https://github.com/ocornut/imgui/archive/762ec445e63a95c1545b18b28d528f8ce38a9afd.zip
)
FetchContent_GetProperties(imguidocked)
if(NOT imguidocked_POPULATED)
FetchContent_Populate(imguidocked)
endif()
set(ImGuiDockedFiles
${imguidocked_SOURCE_DIR}/imconfig.h
${imguidocked_SOURCE_DIR}/imgui.cpp
${imguidocked_SOURCE_DIR}/imgui.h
${imguidocked_SOURCE_DIR}/imgui_demo.cpp
${imguidocked_SOURCE_DIR}/imgui_draw.cpp
${imguidocked_SOURCE_DIR}/imgui_internal.h
${imguidocked_SOURCE_DIR}/imgui_tables.cpp
${imguidocked_SOURCE_DIR}/imgui_widgets.cpp
${imguidocked_SOURCE_DIR}/imstb_rectpack.h
${imguidocked_SOURCE_DIR}/imstb_textedit.h
${imguidocked_SOURCE_DIR}/imstb_truetype.h
${imguidocked_SOURCE_DIR}/backends/imgui_impl_glfw.cpp
${imguidocked_SOURCE_DIR}/backends/imgui_impl_glfw.h
${imguidocked_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp
${imguidocked_SOURCE_DIR}/backends/imgui_impl_vulkan.h
${imguidocked_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp
${imguidocked_SOURCE_DIR}/misc/cpp/imgui_stdlib.h
)
add_library(imguidocked ${ImGuiDockedFiles})
target_include_directories(imguidocked PUBLIC ${imguidocked_SOURCE_DIR})
find_package(Vulkan REQUIRED)
if (Vulkan_FOUND)
message(STATUS "Vulkan found: " ${Vulkan_INCLUDE_DIR})
endif (Vulkan_FOUND)
add_library(pke
${PKE_SOURCE_FILES}
)
if (Vulkan_FOUND)
target_link_libraries(pke PUBLIC ${Vulkan_LIBRARIES})
target_include_directories(pke PUBLIC ${Vulkan_INCLUDE_DIR})
endif (Vulkan_FOUND)
set(SHADER_OUTPUT_DIR ${PROJECT_BINARY_DIR}/assets/shaders)
set(SHADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/assets/shaders)
file(MAKE_DIRECTORY ${SHADER_OUTPUT_DIR})
set(SHADERS
${SHADER_DIR}/present.vert
${SHADER_DIR}/present.frag
${SHADER_DIR}/vert.vert
${SHADER_DIR}/texture.frag
)
foreach(SHADER IN LISTS SHADERS)
get_filename_component(FILENAME ${SHADER} NAME)
message(STATUS "Before Shader Compile: ${FILENAME}")
add_custom_command(OUTPUT ${SHADER_OUTPUT_DIR}/${FILENAME}.spv
COMMAND ${Vulkan_GLSLC_EXECUTABLE} ${SHADER} -o ${SHADER_OUTPUT_DIR}/${FILENAME}.spv
DEPENDS ${SHADER}
COMMENT "Compiling ${FILENAME}")
list(APPEND SPV_SHADERS ${SHADER_OUTPUT_DIR}/${FILENAME}.spv)
endforeach()
add_custom_target(shaders ALL DEPENDS ${SPV_SHADERS})
find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
if (GLFW_FOUND)
message(STATUS "GLFW found: " ${GLFW_INCLUDE_DIR})
target_link_libraries(pke PUBLIC ${GLFW_LIBRARIES})
target_include_directories(pke PUBLIC ${GLFW_INCLUDE_DIR})
endif (GLFW_FOUND)
find_package(glm REQUIRED)
if (glm_FOUND)
message(STATUS "glm found: " ${glm_INCLUDE_DIR})
target_link_libraries(pke PUBLIC ${glm_LIBRARIES})
target_include_directories(pke PUBLIC ${glm_INCLUDE_DIR})
endif (glm_FOUND)
FetchContent_Declare(stb URL https://github.com/nothings/stb/archive/5736b15f7ea0ffb08dd38af21067c314d6a3aae9.zip)
FetchContent_MakeAvailable(stb)
target_include_directories(pke PUBLIC "${PROJECT_BINARY_DIR}/_deps/stb-src")
FetchContent_Declare(cgltf URL https://github.com/jkuhlmann/cgltf/archive/271614ce5fa8bed6daf3bc824d12a3a652ebdb15.zip)
FetchContent_MakeAvailable(cgltf)
target_include_directories(pke PUBLIC "${PROJECT_BINARY_DIR}/_deps/cgltf-src")
FetchContent_Declare(bullet
GIT_REPOSITORY https://github.com/bulletphysics/bullet3.git
GIT_TAG 3.25
OVERRIDE_FIND_PACKAGE
)
FetchContent_GetProperties(bullet)
if(NOT bullet_POPULATED)
set(BUILD_BULLET2_DEMOS 0 CACHE STRING "" FORCE)
set(BUILD_CPU_DEMOS 0 CACHE STRING "" FORCE)
set(BUILD_UNIT_TESTS 0 CACHE STRING "" FORCE)
set(BUILD_OPENGL3_DEMOS 0 CACHE STRING "" FORCE)
set(BUILD_EXTRAS 0 CACHE STRING "" FORCE)
set(INSTALL_EXTRA_LIBS 0 CACHE STRING "" FORCE)
set(INSTALL_LIBS 0 CACHE STRING "" FORCE)
set(POSITION_INDEPENDENT_CODE O CACHE BOOL "" FORCE)
FetchContent_Populate(bullet)
add_subdirectory(${bullet_SOURCE_DIR} ${bullet_BINARY_DIR})
target_include_directories(pke PUBLIC BEFORE ${bullet_SOURCE_DIR}/src)
target_link_libraries(pke PUBLIC BulletDynamics BulletCollision LinearMath Bullet3Common)
message(STATUS "Bullet vars: " ${bullet_SOURCE_DIR} " - " ${bullet_BINARY_DIR})
endif()
find_package(Bullet REQUIRED
PATHS ${bullet_BINARY_DIR}
)
target_include_directories(pke PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_link_libraries(pke PUBLIC imguidocked)
add_dependencies(pke shaders)
add_subdirectory(editor)
add_subdirectory(runtime)
add_subdirectory(test)
add_subdirectory(example)
|