summaryrefslogtreecommitdiff
path: root/chromium/third_party/shaderc/src/libshaderc_util/CMakeLists.txt
blob: 48f99912ff3ab4ad7f596fdc788be66eabc74047 (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Copyright 2020 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project(libshaderc_util)

add_library(shaderc_util STATIC
  include/libshaderc_util/counting_includer.h
  include/libshaderc_util/file_finder.h
  include/libshaderc_util/format.h
  include/libshaderc_util/io.h
  include/libshaderc_util/mutex.h
  include/libshaderc_util/message.h
  include/libshaderc_util/resources.h
  include/libshaderc_util/spirv_tools_wrapper.h
  include/libshaderc_util/string_piece.h
  include/libshaderc_util/universal_unistd.h
  include/libshaderc_util/version_profile.h
  src/args.cc
  src/compiler.cc
  src/file_finder.cc
  src/io.cc
  src/message.cc
  src/resources.cc
  src/shader_stage.cc
  src/spirv_tools_wrapper.cc
  src/version_profile.cc
)

shaderc_default_compile_options(shaderc_util)
target_include_directories(shaderc_util
  PUBLIC include PRIVATE ${glslang_SOURCE_DIR})
# We use parts of Glslang's HLSL compilation interface, which
# now requires this preprocessor definition.
add_definitions(-DENABLE_HLSL)

find_package(Threads)
target_link_libraries(shaderc_util PRIVATE
  glslang OSDependent OGLCompiler HLSL glslang SPIRV
  SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT})

shaderc_add_tests(
  TEST_PREFIX shaderc_util
  LINK_LIBS shaderc_util
  TEST_NAMES
    counting_includer
    string_piece
    format
    file_finder
    io
    message
    mutex
    version_profile)

if(${SHADERC_ENABLE_TESTS})
  target_include_directories(shaderc_util_counting_includer_test
    PRIVATE ${glslang_SOURCE_DIR})
  target_include_directories(shaderc_util_version_profile_test
    PRIVATE ${glslang_SOURCE_DIR})
endif()

shaderc_add_tests(
  TEST_PREFIX shaderc_util
  LINK_LIBS shaderc_util
  INCLUDE_DIRS
    ${glslang_SOURCE_DIR}
    ${spirv-tools_SOURCE_DIR}/include
  TEST_NAMES
    compiler)

# This target copies content of testdata into the build directory.
add_custom_target(testdata COMMAND
  ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake
  COMMENT "Copy testdata into build directory")

if(${SHADERC_ENABLE_TESTS})
  add_dependencies(shaderc_util_file_finder_test testdata)
  add_dependencies(shaderc_util_io_test testdata)
endif()