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 17package { 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 35license { 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 50cc_defaults { 51 name: "rs-version", 52 cflags: [ 53 "-DRS_VERSION=24", 54 ], 55} 56 57cc_defaults { 58 name: "slang-defaults", 59 defaults: [ 60 "clang-defaults", 61 "rs-version", 62 ], 63 64 cflags: [ 65 "-std=c++11", 66 "-D__DISABLE_ASSERTS", 67 "-DTARGET_BUILD_VARIANT=user", 68 "-Wno-cast-function-type-mismatch", 69 ], 70 71 product_variables: { 72 debuggable: { 73 cflags: [ 74 "-U__DISABLE_ASSERTS", 75 "-UTARGET_BUILD_VARIANT", 76 "-DTARGET_BUILD_VARIANT=userdebug", 77 ], 78 }, 79 eng: { 80 cflags: [ 81 "-O0", 82 "-D__ENABLE_INTERNAL_OPTIONS", 83 "-UTARGET_BUILD_VARIANT", 84 "-DTARGET_BUILD_VARIANT=eng", 85 ], 86 }, 87 }, 88} 89 90static_libraries_needed_by_slang = [ 91 "libLLVMBitWriter_2_9", 92 "libLLVMBitWriter_2_9_func", 93 "libLLVMBitWriter_3_2", 94 "libStripUnkAttr", 95] 96 97// Exported header files 98cc_library_headers { 99 name: "slang_headers", 100 vendor_available: true, 101 export_include_dirs: ["."], 102 host_supported: true, 103 // TODO(b/153609531): remove when no longer needed. 104 native_bridge_supported: true, 105 target: { 106 windows: { 107 enabled: true, 108 }, 109 }, 110} 111 112// Static library libslang for host 113// ======================================================== 114cc_library_host_static { 115 name: "libslang", 116 defaults: ["slang-defaults"], 117 compile_multilib: "first", 118 119 target: { 120 windows: { 121 // Skip missing-field-initializer warnings for mingw. 122 cflags: ["-Wno-error=missing-field-initializers"], 123 }, 124 }, 125 126 srcs: [ 127 "slang.cpp", 128 "slang_bitcode_gen.cpp", 129 "slang_backend.cpp", 130 "slang_diagnostic_buffer.cpp", 131 ], 132 133 shared_libs: ["libbcinfo"], 134} 135 136// ======================================================== 137 138cc_binary_host { 139 name: "llvm-rs-as", 140 defaults: ["slang-defaults"], 141 142 srcs: ["llvm-rs-as.cpp"], 143 144 static_libs: ["libslang"] + static_libraries_needed_by_slang, 145 shared_libs: ["libLLVM_android"], 146 147 product_variables: { 148 unbundled_build: { 149 enabled: false, 150 }, 151 }, 152} 153 154// Executable llvm-rs-cc for host 155// ======================================================== 156 157// For build RSCCOptions.inc from RSCCOptions.td 158llvm_tblgen { 159 name: "slang-gen-options", 160 in: "RSCCOptions.td", 161 outs: ["RSCCOptions.inc"], 162} 163 164cc_binary_host { 165 name: "llvm-rs-cc", 166 defaults: ["slang-defaults"], 167 168 generated_headers: ["slang-gen-options"], 169 srcs: [ 170 "llvm-rs-cc.cpp", 171 "rs_cc_options.cpp", 172 "slang_rs_foreach_lowering.cpp", 173 "slang_rs_ast_replace.cpp", 174 "slang_rs_check_ast.cpp", 175 "slang_rs_context.cpp", 176 "slang_rs_pragma_handler.cpp", 177 "slang_rs_exportable.cpp", 178 "slang_rs_export_type.cpp", 179 "slang_rs_export_element.cpp", 180 "slang_rs_export_var.cpp", 181 "slang_rs_export_func.cpp", 182 "slang_rs_export_foreach.cpp", 183 "slang_rs_export_reduce.cpp", 184 "slang_rs_object_ref_count.cpp", 185 "slang_rs_reflection.cpp", 186 "slang_rs_reflection_cpp.cpp", 187 "slang_rs_reflection_state.cpp", 188 "slang_rs_reflect_utils.cpp", 189 "slang_rs_special_func.cpp", 190 "slang_rs_special_kernel_param.cpp", 191 ], 192 193 static_libs: ["libslang"] + static_libraries_needed_by_slang, 194 195 shared_libs: [ 196 "libbcinfo", 197 "libclang_android", 198 "libLLVM_android", 199 ], 200 201 target: { 202 windows: { 203 host_ldlibs: [ 204 "-limagehlp", 205 "-lpsapi", 206 ], 207 cflags: [ 208 // Skip missing-field-initializer warnings for mingw. 209 "-Wno-error=missing-field-initializers", 210 ], 211 }, 212 }, 213} 214 215cc_binary_host { 216 name: "lld", 217 srcs: ["lld_main.cpp"], 218 ldflags: ["-static"], 219 stl: "libc++_static", 220 target: { 221 darwin: { 222 enabled: false, 223 }, 224 linux: { 225 enabled: false, 226 }, 227 windows: { 228 enabled: true, 229 }, 230 }, 231} 232 233subdirs = [ 234 "BitWriter_2_9", 235 "BitWriter_2_9_func", 236 "BitWriter_3_2", 237 "StripUnkAttr", 238] 239