-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
136 lines (99 loc) · 3.68 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
cmake_minimum_required(VERSION 3.0)
project(CGFire)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
include_directories(include/)
#ASSIMP laden
#umfangreiche Asset Importer Bibliothek
option(ASSIMP_BUILD_ASSIMP_TOOLS OFF)
option(ASSIMP_BUILD_SAMPLES OFF)
option(ASSIMP_BUILD_TESTS OFF)
option(BUILD_SHARED_LIBS OFF)
add_subdirectory(vendor/assimp)
include_directories(vendor/assimp/include/)
#glad laden
#ein OpenGl loader, Header-only
include_directories(vendor/glad/include/)
add_library(gladLibrary STATIC vendor/glad/src/glad.c)
#GLFW laden
#zur Window-Erzeugung
option(GLFW_BUILD_DOCS OFF)
option(GLFW_BUILD_EXAMPLES OFF)
option(GLFW_BUILD_TESTS OFF)
add_subdirectory(vendor/glfw)
include_directories(vendor/glfw/include/)
#GLM laden
#ist eine OpenGL-konforme Mathe Bibliothek, Header Only
include_directories(vendor/glm)
#ImGui laden
#ist eine GUI die auch header only ist
file(GLOB imguiSOURCES vendor/imgui/*.cpp)
add_library(imGUILibrary STATIC
${imguiSOURCES})
include_directories(vendor/imgui/)
#STB laden
#stb ist eine Header-only Library, d.h. man muss sie nur inkludieren
#https://github.com/nothings/stb#stb
#u.a. für image loading/writing/resizing nützlich
include_directories(vendor/stb/)
#Sound library "AudioFile" - header only and .wav, .aiff only
include_directories(vendor/AudioFile)
#SFML for sound
set(BUILD_SHARED_LIBS TRUE)
set(SFML_BUILD_AUDIO TRUE)
set(SFML_BUILD_GRAPHICS FALSE)
set(SFML_BUILD_WINDOW FALSE)
set(SFML_BUILD_NETWORK FALSE)
add_subdirectory(vendor/SFML)
include_directories(vendor/SFML/include)
#in dieser Variable befinden sich alle zu linkenden Vendor Bibliotheken
set(VENDOR_LIBRARIES
assimp
gladLibrary
glfw
${GLFW_LIBRARIES}
imGUILibrary
sfml-audio)
# frameworkLibrary
# diese ist erstmal nur das gegebene framework
# und wird mit allen vendor libraries verlinkt
file(GLOB_RECURSE frameworkSOURCES src/framework/*.cpp)
add_library(frameworkLibrary STATIC ${frameworkSOURCES})
target_link_libraries(frameworkLibrary ${VENDOR_LIBRARIES})
# alles was zu unserer engine gehört
file(GLOB_RECURSE engineSOURCES
src/engine/*.cpp
src/particle/*.cpp
src/util/*.cpp
src/RiggingAndBlending/*.cpp
src/MotionBlur/*.cpp
src/ssao/*.cpp
src/sound/*.cpp
src/project/*.cpp)
get_filename_component(main_cpp_path ${CMAKE_CURRENT_SOURCE_DIR}/src/project/main.cpp ABSOLUTE)
list(REMOVE_ITEM engineSOURCES "${main_cpp_path}")
add_library(engineLibrary STATIC ${engineSOURCES})
target_link_libraries(engineLibrary frameworkLibrary)
#die Project-Main
file(GLOB_RECURSE projectSOURCES src/project/*.cpp)
add_executable(project ${projectSOURCES})
target_link_libraries(project engineLibrary)
file(GLOB TESTS_EXECUTABLES
src/Tests/*.cpp)
#folgendes fügt für jede Datei aus TESTS_EXECUTABLES eine Executable hinzu
# und linkt alle Executables mit der engineLibrary
foreach(PROJECT_SOURCE_FILE ${TESTS_EXECUTABLES})
get_filename_component(SRC_NAME ${PROJECT_SOURCE_FILE} NAME_WE)
add_executable(${SRC_NAME} ${PROJECT_SOURCE_FILE} )
target_link_libraries(${SRC_NAME} engineLibrary)
endforeach(PROJECT_SOURCE_FILE)
file(GLOB AUFGABEN_EXECUTABLES
src/Aufgaben/*.cpp)
#folgendes fügt für jede Datei aus AUFGABEN_EXECUTABLES eine Executable hinzu
# und linkt alle Executables mit der frameworkLibrary
foreach(PROJECT_SOURCE_FILE ${AUFGABEN_EXECUTABLES})
get_filename_component(SRC_NAME ${PROJECT_SOURCE_FILE} NAME_WE)
add_executable(${SRC_NAME} ${PROJECT_SOURCE_FILE})
target_link_libraries(${SRC_NAME} frameworkLibrary)
endforeach(PROJECT_SOURCE_FILE)