-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (52 loc) · 1.6 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
cmake_minimum_required(VERSION 3.6)
project(MathsOpenGL)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# GLFW
find_package(glfw3 REQUIRED)
include_directories(${GLFW_INCLUDE_DIRS})
# OpenGL
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS})
if (APPLE)
find_library(COCOA_LIBRARY Cocoa)
find_library(OpenGL_LIBRARY OpenGL)
find_library(IOKIT_LIBRARY IOKit)
find_library(COREVIDEO_LIBRARY CoreVideo)
set(EXTRA_LIBS ${COCOA_LIBRARY} ${OpenGL_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY})
endif (APPLE)
add_subdirectory(imgui)
include_directories(include .)
add_executable(
mathsopengl
"src/main.cpp"
"src/glad.c"
"src/shader.cpp"
"src/orbit_camera.cpp"
"src/point.cpp"
"src/casteljau.cpp"
"src/de_boor.cpp"
"src/application.cpp"
"src/scene.cpp"
"src/phong_material.cpp"
"src/object.cpp"
"src/light.cpp"
"src/point_light.cpp"
"src/directional_light.cpp"
"src/shape.cpp"
"src/cube.cpp"
"src/extruded.cpp"
)
target_link_libraries(mathsopengl imgui ${OPENGL_LIBRARIES} ${GLFW_LIBRARY_DIRS} ${EXTRA_LIBS} dl glfw)
# Find shader files
set(shaders_dir ${CMAKE_CURRENT_SOURCE_DIR}/shaders)
file(GLOB_RECURSE shaders "${shaders_dir}/*")
# Copy shaders to target location
foreach (file ${shaders})
if (NOT IS_DIRECTORY ${file})
STRING(REGEX REPLACE "^${shaders_dir}/" "" file_dest_name ${file})
configure_file(${file} ${CMAKE_CURRENT_BINARY_DIR}/shaders/${file_dest_name} COPYONLY)
endif ()
endforeach ()