-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
172 lines (143 loc) · 4.77 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
################################################################
### PROJECT
cmake_minimum_required(VERSION 3.16)
project(Light)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Build/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Build/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Build/bin)
include_directories(
${CMAKE_SOURCE_DIR}/Modules/
# Vendor
${CMAKE_SOURCE_DIR}/Vendor/spdlog/include/
${CMAKE_SOURCE_DIR}/Vendor/glfw/include/
${CMAKE_SOURCE_DIR}/Vendor/entt/src/
${CMAKE_SOURCE_DIR}/Vendor/imgui/
${CMAKE_SOURCE_DIR}/Vendor/glm/
)
################################################################
### PLATFORM
add_compile_definitions(LIGHT_PLATFORM_NAME ${CMAKE_SYSTEM_NAME})
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_compile_definitions(LIGHT_PLATFORM_LINUX)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_compile_definitions(LIGHT_PLATFORM_MAC)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_compile_definitions(LIGHT_PLATFORM_WINDOWS)
endif ()
################################################################
### BUILD TYPE
#TODO:
add_compile_definitions(LIGHT_BUILD_TYPE_DEBUG)
################################################################
### Vendor
add_subdirectory(${CMAKE_SOURCE_DIR}/Vendor/spdlog)
add_subdirectory(${CMAKE_SOURCE_DIR}/Vendor/glfw)
################################################################
### LIGHT
file(GLOB_RECURSE LIGHT_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Light/*)
add_executable(Light ${LIGHT_FILES})
target_include_directories(
Light
PRIVATE ${CMAKE_SOURCE_DIR}/Modules
PRIVATE ${CMAKE_SOURCE_DIR}/Light/Source
)
target_link_libraries(
Light
PRIVATE Exception
PRIVATE Mojula
PRIVATE Logger
PRIVATE Window
PRIVATE Time
PRIVATE Profiler
PRIVATE Events
PRIVATE ECS
)
################################################################
### Mojula
file(GLOB_RECURSE MOJULA_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/Mojula/*)
add_library(Mojula STATIC ${MOJULA_FILES})
target_include_directories(
Mojula
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/Mojula/Source
)
################################################################
### EXCEPTION
file(GLOB_RECURSE EXCEPTION_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/Exception/*.cpp) # ye wtf?
add_library(Exception STATIC ${EXCEPTION_FILES})
target_include_directories(
Exception
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/Exception/Source
)
################################################################
### EVENTS
file(GLOB_RECURSE EVENTS_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/Events/*)
add_library(Events STATIC ${EVENTS_FILES})
target_include_directories(
Events
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/Events/Source
)
################################################################
### TIME
file(GLOB_RECURSE TIME_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/Time/*.cpp)
add_library(Time STATIC ${TIME_FILES})
target_include_directories(
Time
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/Time/Source
)
################################################################
### FILEMANAGER
file(GLOB_RECURSE FILEMANAGER_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/FileManager/*)
add_library(FileManager STATIC ${FILEMANAGER_FILES})
target_include_directories(
FileManager
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/FileManager/Source
)
################################################################
### FILEMANAGER
file(GLOB_RECURSE ECS_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/ECS/*)
add_library(ECS STATIC ${ECS_FILES})
target_include_directories(
ECS
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/ECS/Source
)
################################################################
### PROFILER
file(GLOB_RECURSE PROFILER_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/Profiler/*)
add_library(Profiler STATIC ${PROFILER_FILES})
target_include_directories(
Profiler
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/Profiler/Source
)
target_link_libraries(
Profiler
PRIVATE FileManager
PRIVATE Logger
)
################################################################
### LOGGER
file(GLOB_RECURSE LOGGER_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/Logger/*)
add_library(Logger STATIC ${LOGGER_FILES})
target_include_directories(
Logger
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/Logger/Source
)
target_link_libraries(
Logger
PRIVATE Mojula
PRIVATE spdlog
)
################################################################
### Window
file(GLOB_RECURSE WINDOW_FILES true ABSOLUTE ${CMAKE_SOURCE_DIR}/Modules/Window/*)
add_library(Window STATIC ${WINDOW_FILES})
target_include_directories(
Window
PRIVATE ${CMAKE_SOURCE_DIR}/Modules/Window/Source
)
target_link_libraries(
Window
PRIVATE Logger
PRIVATE Events
PRIVATE glfw
)