-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
49 lines (42 loc) · 1.28 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
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)
project ("CSE167_FA22_HW3")
# Add sources
file(
GLOB SOURCES_SCENE_VIEWER
src/*.cpp
)
# Add executables
add_executable(ModelViewer ${SOURCES_SCENE_VIEWER})
# Include headers
set(
INCLUDE_DIRECTORIES
${PROJECT_SOURCE_DIR}/include
)
target_include_directories(ModelViewer PRIVATE ${INCLUDE_DIRECTORIES})
# Link libraries
set(
LINK_DIRECTORIES
${PROJECT_SOURCE_DIR}/lib
)
target_link_directories(ModelViewer PRIVATE ${LINK_DIRECTORIES})
target_link_libraries(ModelViewer glew32 freeglut FreeImage)
# Ensure .dll is with .exe
file(COPY "${LINK_DIRECTORIES}/glew32.dll" DESTINATION "${CMAKE_BINARY_DIR}")
file(COPY "${LINK_DIRECTORIES}/freeglut.dll" DESTINATION "${CMAKE_BINARY_DIR}")
file(COPY "${LINK_DIRECTORIES}/FreeImage.dll" DESTINATION "${CMAKE_BINARY_DIR}")
# Move assets to .exe
add_custom_target(CopyShaders ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/shaders"
"${CMAKE_BINARY_DIR}/shaders"
)
add_custom_target(CopyModels ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/models"
"${CMAKE_BINARY_DIR}/models"
)
add_dependencies(ModelViewer CopyShaders)
add_dependencies(ModelViewer CopyModels)