-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
144 lines (117 loc) · 3.17 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
cmake_minimum_required(VERSION 3.11)
project(assignments)
find_package(OpenGL REQUIRED)
find_package(glfw3 REQUIRED)
find_package(assimp REQUIRED)
find_package(GLEW REQUIRED)
# glm config module is broken on archlinux atm
find_path(GLM_INCLUDE_DIR glm)
find_path(GSL_INCLUDE_DIR gsl)
if(GLM_INCLUDE_DIR STREQUAL "GLM_INCLUDE_DIR-NOTFOUND")
message(FATAL_ERROR "Could not find OpenGL Mathematics library.")
endif()
if(GSL_INCLUDE_DIR STREQUAL "GSL_INCLUDE_DIR-NOTFOUND")
message(FATAL_ERROR "Could not find Guidelines Support Library.")
endif()
# Assignment 1
add_executable(assignment1
assignment1.cpp
application.cpp
inputmanager.cpp
soup_mesh.cpp
half_edge_mesh.cpp
regular_mesh.cpp
glutil.cpp)
target_include_directories(assignment1
PUBLIC ${OPENGL_INCLUDE_DIR}
PUBLIC ${GLEW_INCLUDE_DIRS}
PUBLIC ${ASSIMP_INCLUDE_DIRS}
PUBLIC ${GLM_INCLUDE_DIR}
PUBLIC ${GSL_INCLUDE_DIR})
target_link_libraries(assignment1
OpenGL::OpenGL
GLEW::GLEW
glfw
assimp)
target_compile_features(assignment1 PUBLIC cxx_std_17)
target_compile_options(assignment1 PRIVATE -Wall -Wextra)
# Assignment 2
add_executable(assignment2
assignment2.cpp
application.cpp
inputmanager.cpp
soup_mesh.cpp
half_edge_mesh.cpp
regular_mesh.cpp
glutil.cpp)
target_include_directories(assignment2
PUBLIC ${OPENGL_INCLUDE_DIR}
PUBLIC ${GLEW_INCLUDE_DIRS}
PUBLIC ${ASSIMP_INCLUDE_DIRS}
PUBLIC ${GLM_INCLUDE_DIR}
PUBLIC ${GSL_INCLUDE_DIR})
target_link_libraries(assignment2
OpenGL::OpenGL
GLEW::GLEW
glfw
assimp)
target_compile_features(assignment2 PUBLIC cxx_std_17)
target_compile_options(assignment2 PRIVATE -Wall -Wextra)
# Assignment 3
add_executable(assignment3
assignment3.cpp
application.cpp
inputmanager.cpp
soup_mesh.cpp
half_edge_mesh.cpp
regular_mesh.cpp
glutil.cpp)
target_include_directories(assignment3
PUBLIC ${OPENGL_INCLUDE_DIR}
PUBLIC ${GLEW_INCLUDE_DIRS}
PUBLIC ${ASSIMP_INCLUDE_DIRS}
PUBLIC ${GLM_INCLUDE_DIR}
PUBLIC ${GSL_INCLUDE_DIR})
target_link_libraries(assignment3
OpenGL::OpenGL
GLEW::GLEW
glfw
assimp)
target_compile_features(assignment3 PUBLIC cxx_std_17)
target_compile_options(assignment3 PRIVATE -Wall -Wextra)
# Assignment 4
add_executable(assignment4
assignment4.cpp
application.cpp
inputmanager.cpp
soup_mesh.cpp
half_edge_mesh.cpp
regular_mesh.cpp
glutil.cpp)
target_include_directories(assignment4
PUBLIC ${OPENGL_INCLUDE_DIR}
PUBLIC ${GLEW_INCLUDE_DIRS}
PUBLIC ${ASSIMP_INCLUDE_DIRS}
PUBLIC ${GLM_INCLUDE_DIR}
PUBLIC ${GSL_INCLUDE_DIR})
target_link_libraries(assignment4
OpenGL::OpenGL
GLEW::GLEW
glfw
assimp)
target_compile_features(assignment4 PUBLIC cxx_std_17)
target_compile_options(assignment4 PRIVATE -Wall -Wextra)
# Assets and shaders
add_custom_target(assignments)
add_dependencies(assignment1 assignments)
add_dependencies(assignment2 assignments)
add_dependencies(assignment3 assignments)
add_dependencies(assignment4 assignments)
add_custom_command(TARGET assignments POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_SOURCE_DIR}/shaders
${CMAKE_CURRENT_BINARY_DIR}/shaders)
add_custom_command(TARGET assignments POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_SOURCE_DIR}/assets
${CMAKE_CURRENT_BINARY_DIR}/assets)