|
| 1 | +# Copyright 2018 The Shaderc Authors. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +import("//build_overrides/shaderc.gni") |
| 16 | + |
| 17 | +glslang_dir = shaderc_glslang_dir |
| 18 | +spirv_tools_dir = shaderc_spirv_tools_dir |
| 19 | + |
| 20 | +config("shaderc_util_public") { |
| 21 | + include_dirs = [ "libshaderc_util/include" ] |
| 22 | +} |
| 23 | + |
| 24 | +source_set("shaderc_util_sources") { |
| 25 | + sources = [ |
| 26 | + "libshaderc_util/include/libshaderc_util/counting_includer.h", |
| 27 | + "libshaderc_util/include/libshaderc_util/file_finder.h", |
| 28 | + "libshaderc_util/include/libshaderc_util/format.h", |
| 29 | + "libshaderc_util/include/libshaderc_util/io.h", |
| 30 | + "libshaderc_util/include/libshaderc_util/message.h", |
| 31 | + "libshaderc_util/include/libshaderc_util/mutex.h", |
| 32 | + "libshaderc_util/include/libshaderc_util/resources.h", |
| 33 | + "libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h", |
| 34 | + "libshaderc_util/include/libshaderc_util/string_piece.h", |
| 35 | + "libshaderc_util/include/libshaderc_util/universal_unistd.h", |
| 36 | + "libshaderc_util/include/libshaderc_util/version_profile.h", |
| 37 | + "libshaderc_util/src/compiler.cc", |
| 38 | + "libshaderc_util/src/file_finder.cc", |
| 39 | + "libshaderc_util/src/io.cc", |
| 40 | + "libshaderc_util/src/message.cc", |
| 41 | + "libshaderc_util/src/resources.cc", |
| 42 | + "libshaderc_util/src/shader_stage.cc", |
| 43 | + "libshaderc_util/src/spirv_tools_wrapper.cc", |
| 44 | + "libshaderc_util/src/version_profile.cc", |
| 45 | + ] |
| 46 | + |
| 47 | + public_configs = [ ":shaderc_util_public" ] |
| 48 | + |
| 49 | + deps = [ |
| 50 | + "${glslang_dir}:glslang_static", |
| 51 | + "${spirv_tools_dir}:spvtools", |
| 52 | + ] |
| 53 | +} |
| 54 | + |
| 55 | +static_library("shaderc_util") { |
| 56 | + public_configs = [ ":shaderc_util_public" ] |
| 57 | + |
| 58 | + deps = [ |
| 59 | + ":shaderc_util_sources", |
| 60 | + ] |
| 61 | +} |
| 62 | + |
| 63 | +config("shaderc_public") { |
| 64 | + include_dirs = [ "libshaderc/include" ] |
| 65 | + defines = [ "SHADERC_SHAREDLIB" ] |
| 66 | + |
| 67 | + # Executable needs an rpath to find our shared libraries on OSX |
| 68 | + if (is_mac) { |
| 69 | + ldflags = [ |
| 70 | + "-rpath", |
| 71 | + "@executable_path/", |
| 72 | + ] |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +source_set("libshaderc_sources") { |
| 77 | + defines = [ "SHADERC_IMPLEMENTATION" ] |
| 78 | + |
| 79 | + sources = [ |
| 80 | + "libshaderc/include/shaderc/shaderc.h", |
| 81 | + "libshaderc/include/shaderc/shaderc.hpp", |
| 82 | + "libshaderc/src/shaderc.cc", |
| 83 | + "libshaderc/src/shaderc_private.h", |
| 84 | + ] |
| 85 | + |
| 86 | + public_configs = [ ":shaderc_public" ] |
| 87 | + |
| 88 | + deps = [ |
| 89 | + ":shaderc_util", |
| 90 | + "${spirv_tools_dir}:spvtools", |
| 91 | + "${spirv_tools_dir}:spvtools_val", |
| 92 | + "${glslang_dir}:glslang_static", |
| 93 | + ] |
| 94 | +} |
| 95 | + |
| 96 | +shared_library("libshaderc") { |
| 97 | + public_configs = [ ":shaderc_public" ] |
| 98 | + |
| 99 | + deps = [ |
| 100 | + ":libshaderc_sources", |
| 101 | + ] |
| 102 | + |
| 103 | + # Tell dependents where to find this shared library |
| 104 | + if (is_mac) { |
| 105 | + ldflags = [ |
| 106 | + "-install_name", |
| 107 | + "@rpath/${target_name}.dylib", |
| 108 | + ] |
| 109 | + } |
| 110 | + |
| 111 | + configs -= [ "//build/config/compiler:chromium_code" ] |
| 112 | + configs += [ "//build/config/compiler:no_chromium_code" ] |
| 113 | +} |
| 114 | + |
0 commit comments