This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
51 lines (40 loc) · 1.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
cmake_minimum_required(VERSION 3.8)
project(SE344)
set(CMAKE_CXX_STANDARD 14)
find_package(OpenGL REQUIRED)
add_subdirectory(deps)
file(GLOB SOURCE_FILES src/*.cpp src/*.h)
file(GLOB SHADER_FILES src/shader/*)
file(COPY resource DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
find_package(freetype)
if (FREETYPE_FOUND)
include_directories(${FREETYPE_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} freetype)
endif()
include_directories(${glfw_INCLUDE_DIRS} ${libsoundio_SOURCE_DIR} deps/glm deps/SOIL/src)
target_link_libraries(${PROJECT_NAME} gl3w glfw libsoundio_shared ${LIBSOUNDIO_LIBS} ${LIBM} ${OPENGL_LIBRARIES} SOIL_Static freetype)
find_package(OpenMP)
if (OPENMP_FOUND)
add_definitions(-DHAVE_OMP=1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif ()
#add_custom_target(copy_shader ALL
# COMMAND cmake -E copy_directory src/shader ${CMAKE_BINARY_DIR}/shader)
#add_dependencies(${PROJECT_NAME} copy_shader)
# Scan through resource folder for updated files and copy if none existing or changed
foreach (shader_file ${SHADER_FILES})
get_filename_component(filename ${shader_file} NAME)
set(output "${CMAKE_CURRENT_BINARY_DIR}/shader/${filename}")
add_custom_command(
COMMENT "Moving updated shader-file '${filename}'"
OUTPUT ${output}
DEPENDS ${shader_file}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${shader_file}
${output}
)
add_custom_target(${filename} ALL DEPENDS ${shader_file} ${output})
add_dependencies(${PROJECT_NAME} ${filename})
endforeach ()