forked from google/shaderc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
74 lines (62 loc) · 2.39 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
73
74
project(libshaderc)
# Even though shaderc.hpp is a headers-only library, adding
# a dependency here will force clients of the library to rebuild
# when it changes.
add_library(shaderc STATIC
include/shaderc/shaderc.h
include/shaderc/shaderc.hpp
src/shaderc.cc
src/shaderc_private.h
)
shaderc_default_compile_options(shaderc)
target_include_directories(shaderc PUBLIC include PRIVATE ${glslang_SOURCE_DIR})
install(
FILES
include/shaderc/shaderc.h
include/shaderc/shaderc.hpp
DESTINATION
include/shaderc)
install(TARGETS shaderc
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
find_package(Threads)
target_link_libraries(shaderc PRIVATE
glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(shaderc PRIVATE shaderc_util)
target_link_libraries(shaderc PRIVATE SPIRV) # from glslang
target_link_libraries(shaderc PRIVATE SPIRV-Tools)
shaderc_add_tests(
TEST_PREFIX shaderc
LINK_LIBS shaderc
INCLUDE_DIRS include ${glslang_SOURCE_DIR} ${spirv-tools_SOURCE_DIR}/include
TEST_NAMES
shaderc
shaderc_cpp)
shaderc_combine_static_lib(shaderc_combined shaderc)
# Since shaderc_combined is defined as an imported library, we cannot use the
# install() directive to install it. Install it like a normal file.
get_target_property(generated_location shaderc_combined LOCATION)
string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}")
if (NOT "${vs_generator}" STREQUAL "")
# With Visual Studio generators, the LOCATION property is not properly
# expanded according to the current build configuration. We need to work
# around this problem by manually substitution.
string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}"
install_location "${generated_location}")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${install_location} DESTINATION lib)
else()
install(FILES ${generated_location} DESTINATION lib)
endif()
shaderc_add_tests(
TEST_PREFIX shaderc_combined
LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}
INCLUDE_DIRS include ${glslang_SOURCE_DIR} ${spirv-tools_SOURCE_DIR}/include
TEST_NAMES
shaderc
shaderc_cpp)
if(${SHADERC_ENABLE_TESTS})
add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c)
shaderc_default_c_compile_options(shaderc_c_smoke_test)
target_link_libraries(shaderc_c_smoke_test PRIVATE shaderc)
add_test(NAME shaderc_c_smoke_test COMMAND shaderc_c_smoke_test)
endif()