• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        "-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",
99    "libStripUnkAttr",
100]
101
102// Exported header files
103cc_library_headers {
104    name: "slang_headers",
105    vendor_available: true,
106    export_include_dirs: ["."],
107    host_supported: true,
108    // TODO(b/153609531): remove when no longer needed.
109    native_bridge_supported: true,
110    target: {
111        windows: {
112	    enabled: true,
113	},
114    },
115}
116
117// Static library libslang for host
118// ========================================================
119cc_library_host_static {
120    name: "libslang",
121    defaults: ["slang-defaults"],
122    compile_multilib: "first",
123
124    target: {
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
138    shared_libs: ["libbcinfo"],
139}
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,
150    shared_libs: ["libLLVM_android"],
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
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",
192        "slang_rs_reflection_state.cpp",
193        "slang_rs_reflect_utils.cpp",
194        "slang_rs_special_func.cpp",
195        "slang_rs_special_kernel_param.cpp",
196    ],
197
198    static_libs: ["libslang"] + static_libraries_needed_by_slang,
199
200    shared_libs: [
201        "libbcinfo",
202        "libclang_android",
203        "libLLVM_android",
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        },
217    },
218}
219
220cc_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
238subdirs = [
239    "BitWriter_2_9",
240    "BitWriter_2_9_func",
241    "BitWriter_3_2",
242    "StripUnkAttr",
243]
244