-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
116 lines (96 loc) · 4.32 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
############################### Project-Setup ###############################
cmake_minimum_required(VERSION 3.20)
set(SALINITYGL_ENGINE_VERSION "0.2.0")
set(SALINITYGL_ENGINE_VERSION_SUFFIX "release")
add_compile_definitions(SALINITYGL_ENGINE_VERSION="${SALINITYGL_ENGINE_VERSION}")
add_compile_definitions(SALINITYGL_ENGINE_VERSION_SUFFIX="${SALINITYGL_ENGINE_VERSION_SUFFIX}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(SalinityGL
VERSION "${SALINITYGL_ENGINE_VERSION}"
LANGUAGES CXX
DESCRIPTION "OpenGL baselayer library in C++"
)
add_compile_options(
-Waddress
-Wformat-nonliteral
-Wformat-security
-Wformat
-Winit-self
-Wmissing-include-dirs
-Wno-multichar
-Wno-parentheses
-Wno-type-limits
-Wno-unused-parameter
-Wno-unused-variable
-Wunreachable-code
-Wwrite-strings
-Wpointer-arith
-Werror
-Wall
-Wextra
-Wpedantic
)
############################### Settings ####################################
set(GLFW_PATH "${CMAKE_SOURCE_DIR}/Vendor/GLFW/libglfw.so")
set(ENGINE_LINKER_FLAGS "-lX11")
set(APPLICATION_LINKER_FLAGS "-ldl -lpthread")
############################### Engine-Core #################################
### Source files ###
file(GLOB_RECURSE SRC_ENGINE Engine/*.cpp)
file(GLOB_RECURSE SRC_VENDOR Vendor/*.cpp)
### Compile to a static library ###
add_library(SalinityGL STATIC ${SRC_ENGINE} ${SRC_VENDOR})
### Include directories ###
target_include_directories(SalinityGL PUBLIC Engine/Application)
target_include_directories(SalinityGL PUBLIC Engine/Core)
target_include_directories(SalinityGL PUBLIC Engine/Debug)
target_include_directories(SalinityGL PUBLIC Engine/Physics/CellularAutomata)
target_include_directories(SalinityGL PUBLIC Engine/Physics/FluidSimulation)
target_include_directories(SalinityGL PUBLIC Engine/Rendering/Buffers)
target_include_directories(SalinityGL PUBLIC Engine/Rendering/Camera)
target_include_directories(SalinityGL PUBLIC Engine/Rendering/Renderables)
target_include_directories(SalinityGL PUBLIC Engine/Rendering/Renderer)
target_include_directories(SalinityGL PUBLIC Engine/Rendering/Resources)
target_include_directories(SalinityGL PUBLIC Vendor/Glad/include)
target_include_directories(SalinityGL PUBLIC Vendor/GLFW/include)
target_include_directories(SalinityGL PUBLIC Vendor/Imgui/include)
target_include_directories(SalinityGL PUBLIC Vendor/GLM/include)
target_include_directories(SalinityGL PUBLIC Vendor/Miniaudio)
target_include_directories(SalinityGL PUBLIC Vendor/Other/include)
### Engine linker flags ###
target_link_libraries(SalinityGL PUBLIC ${ENGINE_LINKER_FLAGS})
############################# Demo-Applications #############################
### Packages ###
find_package(OpenGL REQUIRED)
### Source files ###
file(GLOB_RECURSE SRC_GREENWORLD Apps/GreenWorld/*.cpp)
file(GLOB_RECURSE SRC_CELLSIM Apps/CellSim/*.cpp)
file(GLOB_RECURSE SRC_LIQUEFIED Apps/Liquefied/*.cpp)
### Compile to an executable ###
add_executable(GreenWorld ${SRC_GREENWORLD})
add_executable(CellSim ${SRC_CELLSIM})
add_executable(Liquefied ${SRC_LIQUEFIED})
### Include directories ###
target_include_directories(GreenWorld PUBLIC Apps/GreenWorld)
target_include_directories(GreenWorld PUBLIC Engine)
target_include_directories(CellSim PUBLIC Apps/CellSim)
target_include_directories(CellSim PUBLIC Engine)
target_include_directories(Liquefied PUBLIC Apps/Liquefied)
target_include_directories(Liquefied PUBLIC Engine)
### Link against engine ###
target_link_libraries(GreenWorld PUBLIC SalinityGL)
target_link_libraries(CellSim PUBLIC SalinityGL)
target_link_libraries(Liquefied PUBLIC SalinityGL)
### Link against GLFW and OpenGL ###
target_link_libraries(GreenWorld PUBLIC ${GLFW_PATH})
target_link_libraries(GreenWorld PUBLIC OpenGL::GL)
target_link_libraries(CellSim PUBLIC ${GLFW_PATH})
target_link_libraries(CellSim PUBLIC OpenGL::GL)
target_link_libraries(Liquefied PUBLIC ${GLFW_PATH})
target_link_libraries(Liquefied PUBLIC OpenGL::GL)
### Application linker flags ###
target_link_libraries(GreenWorld PUBLIC ${APPLICATION_LINKER_FLAGS})
target_link_libraries(CellSim PUBLIC ${APPLICATION_LINKER_FLAGS})
target_link_libraries(Liquefied PUBLIC ${APPLICATION_LINKER_FLAGS})