blob: 8e7b887cbc5061e0303e7c8a9c6afcbf5f199a82 [file] [log] [blame]
Colin Cross50eeccb2016-12-07 13:17:55 -08001//
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 Badourb2b9dfd2021-02-12 18:38:58 -080017package {
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
Colin Cross50eeccb2016-12-07 13:17:55 -080050cc_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 "-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
95static_libraries_needed_by_slang = [
96 "libLLVMBitWriter_2_9",
97 "libLLVMBitWriter_2_9_func",
98 "libLLVMBitWriter_3_2",
David Gross97ac1a52017-05-16 15:27:52 -070099 "libStripUnkAttr",
Colin Cross50eeccb2016-12-07 13:17:55 -0800100]
101
David Gross37dbf5c2017-03-29 20:54:15 +0000102// Exported header files
103cc_library_headers {
104 name: "slang_headers",
Tim Kleina0de4c52019-05-14 00:22:22 +0100105 vendor_available: true,
David Gross37dbf5c2017-03-29 20:54:15 +0000106 export_include_dirs: ["."],
107 host_supported: true,
Victor Khimenko3d69acd2020-07-02 01:22:42 +0200108 // TODO(b/153609531): remove when no longer needed.
109 native_bridge_supported: true,
David Gross37dbf5c2017-03-29 20:54:15 +0000110 target: {
111 windows: {
112 enabled: true,
113 },
114 },
115}
116
Colin Cross50eeccb2016-12-07 13:17:55 -0800117// Static library libslang for host
118// ========================================================
119cc_library_host_static {
120 name: "libslang",
121 defaults: ["slang-defaults"],
Colin Cross925085e2016-12-17 12:13:43 -0800122 compile_multilib: "first",
Colin Cross50eeccb2016-12-07 13:17:55 -0800123
124 target: {
Colin Cross50eeccb2016-12-07 13:17:55 -0800125 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 Cross925085e2016-12-17 12:13:43 -0800138 shared_libs: ["libbcinfo"],
Colin Cross50eeccb2016-12-07 13:17:55 -0800139}
140
141// ========================================================
142
143cc_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 Nainar24bfa422017-08-03 11:41:05 -0700150 shared_libs: ["libLLVM_android"],
Colin Cross50eeccb2016-12-07 13:17:55 -0800151
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
163llvm_tblgen {
164 name: "slang-gen-options",
165 in: "RSCCOptions.td",
166 outs: ["RSCCOptions.inc"],
167}
168
169cc_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 Grossd80e58b2017-07-24 11:41:12 -0700192 "slang_rs_reflection_state.cpp",
Colin Cross50eeccb2016-12-07 13:17:55 -0800193 "slang_rs_reflect_utils.cpp",
194 "slang_rs_special_func.cpp",
195 "slang_rs_special_kernel_param.cpp",
Colin Cross50eeccb2016-12-07 13:17:55 -0800196 ],
197
Colin Cross50eeccb2016-12-07 13:17:55 -0800198 static_libs: ["libslang"] + static_libraries_needed_by_slang,
199
200 shared_libs: [
Colin Cross925085e2016-12-17 12:13:43 -0800201 "libbcinfo",
Pirama Arumuga Nainar24bfa422017-08-03 11:41:05 -0700202 "libclang_android",
203 "libLLVM_android",
Colin Cross50eeccb2016-12-07 13:17:55 -0800204 ],
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 Cross50eeccb2016-12-07 13:17:55 -0800217 },
Colin Cross50eeccb2016-12-07 13:17:55 -0800218}
219
Stephen Hinesa4f47d32020-03-02 15:22:11 -0800220cc_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 Cross50eeccb2016-12-07 13:17:55 -0800238subdirs = [
239 "BitWriter_2_9",
240 "BitWriter_2_9_func",
241 "BitWriter_3_2",
David Gross97ac1a52017-05-16 15:27:52 -0700242 "StripUnkAttr",
Colin Cross50eeccb2016-12-07 13:17:55 -0800243]