-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
122 lines (72 loc) · 2.49 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
cmake_minimum_required(VERSION 3.10)
# This is just to make friends with vscode include and error squiggly lines
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# set the project name
project(Simulation)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# add the executable
add_executable(
Simulation
main.cpp
learnOpenGL/shader.cpp
sandbox.cpp
tiles.cpp
stb/stb_image.cpp
learnOpenGL/mesh.cpp
learnOpenGL/model.cpp
object.cpp
framebuffer.cpp
voxelhandler.cpp
)
# --- Link GLAD lib ---
add_subdirectory(glad/)
# -------------------
# Find glm lib
set(glm_DIR /usr/local/Cellar/glm/0.9.9.8/lib/cmake/glm)
find_package(glm REQUIRED)
# --- Add include paths ---------
target_include_directories(Simulation PUBLIC
"${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}"
/usr/local/Cellar/glm/0.9.9.8/include
/usr/local/Cellar/assimp/5.0.1/include
)
# --- Using GLFW binaries link library like this --
find_package(glfw3 3.3 REQUIRED)
set(assimp_DIR /usr/local/Cellar/assimp/5.0.1/lib/cmake/assimp-5.0)
find_package(assimp 5.0 REQUIRED)
target_link_libraries(
Simulation
glfw
glad
glm::glm
)
find_package(OpenGL REQUIRED)
target_link_libraries(
Simulation
OpenGL::GL
)
# -------------------------------------------
find_library(COCOA_LIBRARY Cocoa)
find_library(IOKIT_LIBRARY IOKit)
find_library(COREVID_LIBRARY CoreVideo)
message(${COCOA_LIBRARY})
message(${IOKIT_LIBRARY})
message(${COREVID_LIBRARY})
target_link_libraries(Simulation ${COCOA_LIBRARY} ${COREVID_LIBRARY} ${IOKIT_LIBRARY})
IF(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa -framework OpenGL -framework IOKit /usr/local/lib/libassimp.dylib")
ENDIF(APPLE)
message(${CMAKE_EXE_LINKER_FLAGS})
# --- Using source GLFW link like this ------
#set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
#set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
#set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
#add_subdirectory(path/to/glfw)
#target_link_libraries(Simulation glfw)
#find_package(OpenGL REQUIRED)
#target_link_libraries(Simulation OpenGL::GL)
# ----------------------------------------------