-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (55 loc) · 2.44 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
cmake_minimum_required(VERSION 3.10)
project(opengl_test)
set(CMAKE_CXX_STANDARD 20)
add_compile_options(-Ofast -march=native -std=c++2a)
include_directories("${PROJECT_SOURCE_DIR}/include")
file(GLOB_RECURSE proj_srcs "src/*.cpp" "src/*.cc")
message(STATUS ${proj_srcs})
add_library(gl_proj SHARED ${proj_srcs})
if(WIN32)
target_link_libraries(gl_proj PUBLIC glu32 glfw3)
else()
target_link_libraries(gl_proj PUBLIC glfw GLU)
endif()
add_executable(main examples/main.cpp examples/test_shader_handler.cpp)
target_link_libraries(main PUBLIC gl_proj)
add_executable(oth examples/other.cpp)
target_link_libraries(oth PUBLIC gl_proj)
add_executable(test_handle examples/test_shader_handler.cpp)
target_link_libraries(test_handle PUBLIC gl_proj)
add_executable(test_glm examples/test_glm.cpp)
target_link_libraries(test_glm PUBLIC gl_proj)
add_executable(test_encaps_glapp examples/test_encaps_glapp.cpp)
target_link_libraries(test_encaps_glapp PUBLIC gl_proj)
add_executable(random_cubes examples/randomCubes.cpp)
target_link_libraries(random_cubes PUBLIC gl_proj)
add_executable(lighting examples/lighting.cpp)
target_link_libraries(lighting PUBLIC gl_proj)
add_executable(lighting2 examples/lighting2.cpp)
target_link_libraries(lighting2 PUBLIC gl_proj)
add_executable(multiLighting examples/multiLighting.cpp)
target_link_libraries(multiLighting PUBLIC gl_proj)
add_executable(shadowMultiLighting examples/shadowMultiLighting.cpp)
target_link_libraries(shadowMultiLighting PUBLIC gl_proj)
add_executable(sceneTest examples/jsonSceneTest.cpp)
target_link_libraries(sceneTest PUBLIC gl_proj)
add_executable(debug_static examples/jsonSceneTest.cpp ${proj_srcs})
target_link_libraries(debug_static PUBLIC glu32 glfw3 -static)
target_compile_options(debug_static PUBLIC -static-libgcc -static-libstdc++ )
target_link_libraries(debug_static PUBLIC -static-libgcc -static-libstdc++ -static)
file(GLOB_RECURSE shaders "shaders/*.vert" "shaders/*.frag" "shaders/*.geom")
foreach(GLSL ${shaders})
get_filename_component(FILE_NAME ${GLSL} NAME)
set(SPIRV "${PROJECT_BINARY_DIR}/shaders/${FILE_NAME}.spv")
add_custom_command(
OUTPUT ${SPIRV}
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/shaders/"
COMMAND ${CMAKE_COMMAND} -E copy ${GLSL} ${SPIRV}
DEPENDS ${GLSL})
list(APPEND SPIRV_BINARY_FILES ${SPIRV})
endforeach(GLSL)
add_custom_target(
Shaders
DEPENDS ${SPIRV_BINARY_FILES}
)
# TESTd