blob: f0bda4f855244e3f553cdc89fc681d615eeebfd4 [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
17cc_defaults {
18 name: "rs-version",
19 cflags: [
20 "-DRS_VERSION=24",
21 ],
22}
23
24cc_defaults {
25 name: "slang-defaults",
26 defaults: [
27 "clang-defaults",
28 "rs-version",
29 ],
30
31 cflags: [
32 "-Wall",
33 "-Werror",
34 "-std=c++11",
35
36 "-D__DISABLE_ASSERTS",
37
38 "-DTARGET_BUILD_VARIANT=user",
39 ],
40
41 product_variables: {
42 debuggable: {
43 cflags: [
44 "-U__DISABLE_ASSERTS",
45
46 "-UTARGET_BUILD_VARIANT",
47 "-DTARGET_BUILD_VARIANT=userdebug",
48 ],
49 },
50 eng: {
51 cflags: [
52 "-O0",
53 "-D__ENABLE_INTERNAL_OPTIONS",
54
55 "-UTARGET_BUILD_VARIANT",
56 "-DTARGET_BUILD_VARIANT=eng",
57 ],
58 },
59 },
60}
61
62static_libraries_needed_by_slang = [
63 "libLLVMBitWriter_2_9",
64 "libLLVMBitWriter_2_9_func",
65 "libLLVMBitWriter_3_2",
66]
67
David Gross37dbf5c2017-03-29 20:54:15 +000068// Exported header files
69cc_library_headers {
70 name: "slang_headers",
71 export_include_dirs: ["."],
72 host_supported: true,
73 target: {
74 windows: {
75 enabled: true,
76 },
77 },
78}
79
Colin Cross50eeccb2016-12-07 13:17:55 -080080// Static library libslang for host
81// ========================================================
82cc_library_host_static {
83 name: "libslang",
84 defaults: ["slang-defaults"],
Colin Cross925085e2016-12-17 12:13:43 -080085 compile_multilib: "first",
Colin Cross50eeccb2016-12-07 13:17:55 -080086
87 target: {
88 linux: {
89 host_ldlibs: [
90 "-ldl",
91 "-lpthread",
92 ],
93 },
94 darwin: {
95 host_ldlibs: [
96 "-ldl",
97 "-lpthread",
98 ],
99 },
100 windows: {
101 // Skip missing-field-initializer warnings for mingw.
102 cflags: ["-Wno-error=missing-field-initializers"],
103 },
104 },
105
106 srcs: [
107 "slang.cpp",
108 "slang_bitcode_gen.cpp",
109 "slang_backend.cpp",
110 "slang_diagnostic_buffer.cpp",
111 ],
112
Colin Cross925085e2016-12-17 12:13:43 -0800113 shared_libs: ["libbcinfo"],
Colin Cross50eeccb2016-12-07 13:17:55 -0800114
115 product_variables: {
116 unbundled_build: {
117 enabled: false,
118 },
119 },
120}
121
122// ========================================================
123
124cc_binary_host {
125 name: "llvm-rs-as",
126 defaults: ["slang-defaults"],
127
128 srcs: ["llvm-rs-as.cpp"],
129
130 static_libs: ["libslang"] + static_libraries_needed_by_slang,
131 shared_libs: ["libLLVM"],
132
133 product_variables: {
134 unbundled_build: {
135 enabled: false,
136 },
137 },
138}
139
140// Executable llvm-rs-cc for host
141// ========================================================
142
143// For build RSCCOptions.inc from RSCCOptions.td
144llvm_tblgen {
145 name: "slang-gen-options",
146 in: "RSCCOptions.td",
147 outs: ["RSCCOptions.inc"],
148}
149
150cc_binary_host {
151 name: "llvm-rs-cc",
152 defaults: ["slang-defaults"],
153
154 generated_headers: ["slang-gen-options"],
155 srcs: [
156 "llvm-rs-cc.cpp",
157 "rs_cc_options.cpp",
158 "slang_rs_foreach_lowering.cpp",
159 "slang_rs_ast_replace.cpp",
160 "slang_rs_check_ast.cpp",
161 "slang_rs_context.cpp",
162 "slang_rs_pragma_handler.cpp",
163 "slang_rs_exportable.cpp",
164 "slang_rs_export_type.cpp",
165 "slang_rs_export_element.cpp",
166 "slang_rs_export_var.cpp",
167 "slang_rs_export_func.cpp",
168 "slang_rs_export_foreach.cpp",
169 "slang_rs_export_reduce.cpp",
170 "slang_rs_object_ref_count.cpp",
171 "slang_rs_reflection.cpp",
172 "slang_rs_reflection_cpp.cpp",
173 "slang_rs_reflect_utils.cpp",
174 "slang_rs_special_func.cpp",
175 "slang_rs_special_kernel_param.cpp",
176 "strip_unknown_attributes.cpp",
177 ],
178
Colin Cross50eeccb2016-12-07 13:17:55 -0800179 static_libs: ["libslang"] + static_libraries_needed_by_slang,
180
181 shared_libs: [
Colin Cross925085e2016-12-17 12:13:43 -0800182 "libbcinfo",
Colin Cross50eeccb2016-12-07 13:17:55 -0800183 "libclang",
184 "libLLVM",
185 ],
186
187 target: {
188 windows: {
189 host_ldlibs: [
190 "-limagehlp",
191 "-lpsapi",
192 ],
193 cflags: [
194 // Skip missing-field-initializer warnings for mingw.
195 "-Wno-error=missing-field-initializers",
196 ],
197 },
198 linux: {
199 host_ldlibs: [
200 "-ldl",
201 "-lpthread",
202 ],
203 },
204 darwin: {
205 host_ldlibs: [
206 "-ldl",
207 "-lpthread",
208 ],
209 },
210 },
211
212 product_variables: {
213 unbundled_build: {
214 enabled: false,
215 },
216 },
217}
218
219subdirs = [
220 "BitWriter_2_9",
221 "BitWriter_2_9_func",
222 "BitWriter_3_2",
223]