Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2010 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
Bob Badour | b2b9dfd | 2021-02-12 18:38:58 -0800 | [diff] [blame] | 17 | package { |
| 18 | default_applicable_licenses: ["frameworks_compile_slang_license"], |
| 19 | } |
| 20 | |
| 21 | // Added automatically by a large-scale-change that took the approach of |
| 22 | // 'apply every license found to every target'. While this makes sure we respect |
| 23 | // every license restriction, it may not be entirely correct. |
| 24 | // |
| 25 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 26 | // |
| 27 | // Please consider splitting the single license below into multiple licenses, |
| 28 | // taking care not to lose any license_kind information, and overriding the |
| 29 | // default license using the 'licenses: [...]' property on targets as needed. |
| 30 | // |
| 31 | // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| 32 | // to attach the license to, and including a comment whether the files may be |
| 33 | // used in the current project. |
| 34 | // See: http://go/android-license-faq |
| 35 | license { |
| 36 | name: "frameworks_compile_slang_license", |
| 37 | visibility: [":__subpackages__"], |
| 38 | license_kinds: [ |
| 39 | "SPDX-license-identifier-Apache-2.0", |
| 40 | "SPDX-license-identifier-BSD", |
| 41 | "SPDX-license-identifier-MIT", |
| 42 | "SPDX-license-identifier-NCSA", |
| 43 | "legacy_unencumbered", |
| 44 | ], |
| 45 | license_text: [ |
| 46 | "NOTICE", |
| 47 | ], |
| 48 | } |
| 49 | |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 50 | cc_defaults { |
| 51 | name: "rs-version", |
| 52 | cflags: [ |
| 53 | "-DRS_VERSION=24", |
| 54 | ], |
| 55 | } |
| 56 | |
| 57 | cc_defaults { |
| 58 | name: "slang-defaults", |
| 59 | defaults: [ |
| 60 | "clang-defaults", |
| 61 | "rs-version", |
| 62 | ], |
| 63 | |
| 64 | cflags: [ |
| 65 | "-Wall", |
| 66 | "-Werror", |
| 67 | "-std=c++11", |
| 68 | |
| 69 | "-D__DISABLE_ASSERTS", |
| 70 | |
| 71 | "-DTARGET_BUILD_VARIANT=user", |
| 72 | ], |
| 73 | |
| 74 | product_variables: { |
| 75 | debuggable: { |
| 76 | cflags: [ |
| 77 | "-U__DISABLE_ASSERTS", |
| 78 | |
| 79 | "-UTARGET_BUILD_VARIANT", |
| 80 | "-DTARGET_BUILD_VARIANT=userdebug", |
| 81 | ], |
| 82 | }, |
| 83 | eng: { |
| 84 | cflags: [ |
| 85 | "-O0", |
| 86 | "-D__ENABLE_INTERNAL_OPTIONS", |
| 87 | |
| 88 | "-UTARGET_BUILD_VARIANT", |
| 89 | "-DTARGET_BUILD_VARIANT=eng", |
| 90 | ], |
| 91 | }, |
| 92 | }, |
| 93 | } |
| 94 | |
| 95 | static_libraries_needed_by_slang = [ |
| 96 | "libLLVMBitWriter_2_9", |
| 97 | "libLLVMBitWriter_2_9_func", |
| 98 | "libLLVMBitWriter_3_2", |
David Gross | 97ac1a5 | 2017-05-16 15:27:52 -0700 | [diff] [blame] | 99 | "libStripUnkAttr", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 100 | ] |
| 101 | |
David Gross | 37dbf5c | 2017-03-29 20:54:15 +0000 | [diff] [blame] | 102 | // Exported header files |
| 103 | cc_library_headers { |
| 104 | name: "slang_headers", |
Tim Klein | a0de4c5 | 2019-05-14 00:22:22 +0100 | [diff] [blame] | 105 | vendor_available: true, |
David Gross | 37dbf5c | 2017-03-29 20:54:15 +0000 | [diff] [blame] | 106 | export_include_dirs: ["."], |
| 107 | host_supported: true, |
Victor Khimenko | 3d69acd | 2020-07-02 01:22:42 +0200 | [diff] [blame] | 108 | // TODO(b/153609531): remove when no longer needed. |
| 109 | native_bridge_supported: true, |
David Gross | 37dbf5c | 2017-03-29 20:54:15 +0000 | [diff] [blame] | 110 | target: { |
| 111 | windows: { |
| 112 | enabled: true, |
| 113 | }, |
| 114 | }, |
| 115 | } |
| 116 | |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 117 | // Static library libslang for host |
| 118 | // ======================================================== |
| 119 | cc_library_host_static { |
| 120 | name: "libslang", |
| 121 | defaults: ["slang-defaults"], |
Colin Cross | 925085e | 2016-12-17 12:13:43 -0800 | [diff] [blame] | 122 | compile_multilib: "first", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 123 | |
| 124 | target: { |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 125 | windows: { |
| 126 | // Skip missing-field-initializer warnings for mingw. |
| 127 | cflags: ["-Wno-error=missing-field-initializers"], |
| 128 | }, |
| 129 | }, |
| 130 | |
| 131 | srcs: [ |
| 132 | "slang.cpp", |
| 133 | "slang_bitcode_gen.cpp", |
| 134 | "slang_backend.cpp", |
| 135 | "slang_diagnostic_buffer.cpp", |
| 136 | ], |
| 137 | |
Colin Cross | 925085e | 2016-12-17 12:13:43 -0800 | [diff] [blame] | 138 | shared_libs: ["libbcinfo"], |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | // ======================================================== |
| 142 | |
| 143 | cc_binary_host { |
| 144 | name: "llvm-rs-as", |
| 145 | defaults: ["slang-defaults"], |
| 146 | |
| 147 | srcs: ["llvm-rs-as.cpp"], |
| 148 | |
| 149 | static_libs: ["libslang"] + static_libraries_needed_by_slang, |
Pirama Arumuga Nainar | 24bfa42 | 2017-08-03 11:41:05 -0700 | [diff] [blame] | 150 | shared_libs: ["libLLVM_android"], |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 151 | |
| 152 | product_variables: { |
| 153 | unbundled_build: { |
| 154 | enabled: false, |
| 155 | }, |
| 156 | }, |
| 157 | } |
| 158 | |
| 159 | // Executable llvm-rs-cc for host |
| 160 | // ======================================================== |
| 161 | |
| 162 | // For build RSCCOptions.inc from RSCCOptions.td |
| 163 | llvm_tblgen { |
| 164 | name: "slang-gen-options", |
| 165 | in: "RSCCOptions.td", |
| 166 | outs: ["RSCCOptions.inc"], |
| 167 | } |
| 168 | |
| 169 | cc_binary_host { |
| 170 | name: "llvm-rs-cc", |
| 171 | defaults: ["slang-defaults"], |
| 172 | |
| 173 | generated_headers: ["slang-gen-options"], |
| 174 | srcs: [ |
| 175 | "llvm-rs-cc.cpp", |
| 176 | "rs_cc_options.cpp", |
| 177 | "slang_rs_foreach_lowering.cpp", |
| 178 | "slang_rs_ast_replace.cpp", |
| 179 | "slang_rs_check_ast.cpp", |
| 180 | "slang_rs_context.cpp", |
| 181 | "slang_rs_pragma_handler.cpp", |
| 182 | "slang_rs_exportable.cpp", |
| 183 | "slang_rs_export_type.cpp", |
| 184 | "slang_rs_export_element.cpp", |
| 185 | "slang_rs_export_var.cpp", |
| 186 | "slang_rs_export_func.cpp", |
| 187 | "slang_rs_export_foreach.cpp", |
| 188 | "slang_rs_export_reduce.cpp", |
| 189 | "slang_rs_object_ref_count.cpp", |
| 190 | "slang_rs_reflection.cpp", |
| 191 | "slang_rs_reflection_cpp.cpp", |
David Gross | d80e58b | 2017-07-24 11:41:12 -0700 | [diff] [blame] | 192 | "slang_rs_reflection_state.cpp", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 193 | "slang_rs_reflect_utils.cpp", |
| 194 | "slang_rs_special_func.cpp", |
| 195 | "slang_rs_special_kernel_param.cpp", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 196 | ], |
| 197 | |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 198 | static_libs: ["libslang"] + static_libraries_needed_by_slang, |
| 199 | |
| 200 | shared_libs: [ |
Colin Cross | 925085e | 2016-12-17 12:13:43 -0800 | [diff] [blame] | 201 | "libbcinfo", |
Pirama Arumuga Nainar | 24bfa42 | 2017-08-03 11:41:05 -0700 | [diff] [blame] | 202 | "libclang_android", |
| 203 | "libLLVM_android", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 204 | ], |
| 205 | |
| 206 | target: { |
| 207 | windows: { |
| 208 | host_ldlibs: [ |
| 209 | "-limagehlp", |
| 210 | "-lpsapi", |
| 211 | ], |
| 212 | cflags: [ |
| 213 | // Skip missing-field-initializer warnings for mingw. |
| 214 | "-Wno-error=missing-field-initializers", |
| 215 | ], |
| 216 | }, |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 217 | }, |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 218 | } |
| 219 | |
Stephen Hines | a4f47d3 | 2020-03-02 15:22:11 -0800 | [diff] [blame] | 220 | cc_binary_host { |
| 221 | name: "lld", |
| 222 | srcs: ["lld_main.cpp"], |
| 223 | ldflags: ["-static"], |
| 224 | stl: "libc++_static", |
| 225 | target: { |
| 226 | darwin: { |
| 227 | enabled: false, |
| 228 | }, |
| 229 | linux: { |
| 230 | enabled: false, |
| 231 | }, |
| 232 | windows: { |
| 233 | enabled: true, |
| 234 | }, |
| 235 | }, |
| 236 | } |
| 237 | |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 238 | subdirs = [ |
| 239 | "BitWriter_2_9", |
| 240 | "BitWriter_2_9_func", |
| 241 | "BitWriter_3_2", |
David Gross | 97ac1a5 | 2017-05-16 15:27:52 -0700 | [diff] [blame] | 242 | "StripUnkAttr", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 243 | ] |