-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
55 lines (42 loc) · 1.3 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
cmake_minimum_required(VERSION 3.13)
project(buffpeep C)
set(CMAKE_C_STANDARD 99)
add_subdirectory(ext/glad)
add_subdirectory(ext/glfw)
include_directories(
"ext/glfw"
"ext/glad/include"
"ext/cglm/include"
"ext/bobtail"
)
set(BOBTAIL_OPENGL ON)
add_subdirectory(ext/bobtail)
# Internal build tool to generate headers for GLSL shaders
add_executable(txt2h "ext/txt2h.c")
set(GLSL_SOURCES
src/gl/fragment.glsl
src/gl/vertex.glsl
)
# Autogenerate string constant headers for each GLSL source file using txt2h.c
set(glsl_headers)
foreach(glsl_src ${GLSL_SOURCES})
# Replace the ".glsl" with ".h" and put the string in ${file_h}
get_filename_component(file_h ${glsl_src} NAME_WE)
set(file_h "${file_h}.h")
list(APPEND glsl_headers ${file_h}) # Add to list of generated headers
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${file_h}
COMMAND txt2h ${glsl_src}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endforeach()
add_executable(buffpeep
"src/main.c"
"src/camera.c"
"src/viewer.c"
"src/render_image.c"
# Adding the GLSL headers here auto-generates them during the build
${glsl_headers}
)
target_link_libraries(buffpeep PRIVATE glfw glad bobtail)
file(COPY "src/data/" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data)