-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
156 lines (138 loc) · 3.71 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.5)
project(ENGINE)
find_package(OpenGL REQUIRED)
set(JSON_BuildTests
OFF
CACHE INTERNAL "")
option(YAML_CPP_BUILD_TOOLS "Enable testing and parse tools" OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(BUILD_TESTING OFF)
set(BUILD_OPENGL3_DEMOS
OFF
CACHE BOOL "Set when you want to build the OpenGL3+ demos")
set(BUILD_CPU_DEMOS
OFF
CACHE BOOL "Set when you want to build the OpenGL3+ demos")
set(BUILD_EXAMPLES
OFF
CACHE BOOL " libsonly")
set(GLFW_BUILD_EXAMPLES
OFF
CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_TESTS
OFF
CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_DOCS
OFF
CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_INSTALL
OFF
CACHE BOOL "GLFW lib only")
set(ASSIMP_BUILD_ASSIMP_TOOLS
OFF
CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_TESTS
OFF
CACHE BOOL "" FORCE)
set(ASSIMP_NO_EXPORT
ON
CACHE BOOL "" FORCE)
# If you won't be accessing Assimp outside of the plugin, build it as static to
# have the plugin binary self-contained
set(BUILD_SHARED_LIBS
OFF
CACHE BOOL "" FORCE)
option(ASSIMP_BUILD_TESTS
"If the test suite for Assimp is built in addition to the library." OFF)
option(BUILD_UNIT_TESTS "Build Unit Tests" OFF)
option(BUILD_OPENGL3_DEMOS "Set when you want to build the OpenGL3+ demos" OFF)
include_directories(
"src"
"libs/imgui"
"libs/imgui/backends"
${OPENGL_INCLUDE_DIRS}
"libs/entt"
"libs/entt/single_include"
"libs/json/include"
"libs/soloud"
"libs/soloud/include"
"libs/Catch2/src"
"libs/glm"
"libs/glfw/include"
"libs/glew/include"
"libs/assimp/include"
"libs/stb-cmake"
"libs/glad/include"
"libs/glad/src")
set(GLFW_BUILD_EXAMPLES
OFF
CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_TESTS
OFF
CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_DOCS
OFF
CACHE BOOL "GLFW lib only")
set(GLFW_BUILD_INSTALL
OFF
CACHE BOOL "GLFW lib only")
set(BUILD_EXAMPLES
OFF
CACHE BOOL " libsonly")
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++")
endif()
if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
endif()
add_subdirectory(libs/glfw)
add_subdirectory(libs/entt)
add_subdirectory(libs/json)
add_subdirectory(libs/soloud/contrib)
add_subdirectory(libs/Catch2)
add_subdirectory(libs/glm)
add_subdirectory(libs/glew/build/cmake)
add_subdirectory(libs/assimp)
add_subdirectory(libs/abseil-cpp)
add_subdirectory(libs/folly)
file(
GLOB
ENGINE-LIBS
libs/imgui/imgui.h
libs/imgui/misc/cpp/imgui_stdlib.h
libs/imgui/misc/cpp/imgui_stdlib.cpp
libs/imgui/imgui.cpp
libs/imgui/imgui_internal.h
libs/imgui/imgui_tables.cpp
libs/imgui/imgui_draw.cpp
libs/imgui/imgui_widgets.cpp
libs/imgui/imconfig.h
libs/imgui/backends/imgui_impl_glfw.h
libs/imgui/backends/imgui_impl_glfw.cpp
libs/imgui/backends/imgui_impl_opengl2.h
libs/imgui/backends/imgui_impl_opengl2.cpp
libs/imgui/backends/imgui_impl_opengl3.h
libs/imgui/backends/imgui_impl_opengl3.cpp
libs/glad/src/glad.c)
file(GLOB ENGINE-SRC src/core/* src/core/shaders/* src/core/editor/* src/core/serialization/* src/core/utils/*)
link_libraries(
glew_s
${OPENGL_LIBRARIES}
Catch2
soloud
glfw
assimp
absl
folly
${GLFW_LIBRARIES}
${GLEW_LIBRARIES})
add_executable(ENGINE ${ENGINE-LIBS} ${ENGINE-SRC} src/main.cpp)
add_executable(GAME ${ENGINE-LIBS} ${ENGINE-SRC} src/game.cpp)
target_compile_features(ENGINE PRIVATE cxx_std_17)
file(GLOB ENGINE-TESTS-SRC tests/*.h tests/*.cpp)
add_executable(tests ${ENGINE-LIBS} ${ENGINE-SRC} ${ENGINE-TESTS-SRC})
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)