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 | |
| 17 | cc_defaults { |
| 18 | name: "rs-version", |
| 19 | cflags: [ |
| 20 | "-DRS_VERSION=24", |
| 21 | ], |
| 22 | } |
| 23 | |
| 24 | cc_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 | |
| 62 | static_libraries_needed_by_slang = [ |
| 63 | "libLLVMBitWriter_2_9", |
| 64 | "libLLVMBitWriter_2_9_func", |
| 65 | "libLLVMBitWriter_3_2", |
David Gross | 97ac1a5 | 2017-05-16 15:27:52 -0700 | [diff] [blame] | 66 | "libStripUnkAttr", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 67 | ] |
| 68 | |
David Gross | 37dbf5c | 2017-03-29 20:54:15 +0000 | [diff] [blame] | 69 | // Exported header files |
| 70 | cc_library_headers { |
| 71 | name: "slang_headers", |
Tim Klein | a0de4c5 | 2019-05-14 00:22:22 +0100 | [diff] [blame] | 72 | vendor_available: true, |
David Gross | 37dbf5c | 2017-03-29 20:54:15 +0000 | [diff] [blame] | 73 | export_include_dirs: ["."], |
| 74 | host_supported: true, |
Victor Khimenko | 3d69acd | 2020-07-02 01:22:42 +0200 | [diff] [blame] | 75 | // TODO(b/153609531): remove when no longer needed. |
| 76 | native_bridge_supported: true, |
David Gross | 37dbf5c | 2017-03-29 20:54:15 +0000 | [diff] [blame] | 77 | target: { |
| 78 | windows: { |
| 79 | enabled: true, |
| 80 | }, |
| 81 | }, |
| 82 | } |
| 83 | |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 84 | // Static library libslang for host |
| 85 | // ======================================================== |
| 86 | cc_library_host_static { |
| 87 | name: "libslang", |
| 88 | defaults: ["slang-defaults"], |
Colin Cross | 925085e | 2016-12-17 12:13:43 -0800 | [diff] [blame] | 89 | compile_multilib: "first", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 90 | |
| 91 | target: { |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 92 | windows: { |
| 93 | // Skip missing-field-initializer warnings for mingw. |
| 94 | cflags: ["-Wno-error=missing-field-initializers"], |
| 95 | }, |
| 96 | }, |
| 97 | |
| 98 | srcs: [ |
| 99 | "slang.cpp", |
| 100 | "slang_bitcode_gen.cpp", |
| 101 | "slang_backend.cpp", |
| 102 | "slang_diagnostic_buffer.cpp", |
| 103 | ], |
| 104 | |
Colin Cross | 925085e | 2016-12-17 12:13:43 -0800 | [diff] [blame] | 105 | shared_libs: ["libbcinfo"], |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | // ======================================================== |
| 109 | |
| 110 | cc_binary_host { |
| 111 | name: "llvm-rs-as", |
| 112 | defaults: ["slang-defaults"], |
| 113 | |
| 114 | srcs: ["llvm-rs-as.cpp"], |
| 115 | |
| 116 | static_libs: ["libslang"] + static_libraries_needed_by_slang, |
Pirama Arumuga Nainar | 24bfa42 | 2017-08-03 11:41:05 -0700 | [diff] [blame] | 117 | shared_libs: ["libLLVM_android"], |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 118 | |
| 119 | product_variables: { |
| 120 | unbundled_build: { |
| 121 | enabled: false, |
| 122 | }, |
| 123 | }, |
| 124 | } |
| 125 | |
| 126 | // Executable llvm-rs-cc for host |
| 127 | // ======================================================== |
| 128 | |
| 129 | // For build RSCCOptions.inc from RSCCOptions.td |
| 130 | llvm_tblgen { |
| 131 | name: "slang-gen-options", |
| 132 | in: "RSCCOptions.td", |
| 133 | outs: ["RSCCOptions.inc"], |
| 134 | } |
| 135 | |
| 136 | cc_binary_host { |
| 137 | name: "llvm-rs-cc", |
| 138 | defaults: ["slang-defaults"], |
| 139 | |
| 140 | generated_headers: ["slang-gen-options"], |
| 141 | srcs: [ |
| 142 | "llvm-rs-cc.cpp", |
| 143 | "rs_cc_options.cpp", |
| 144 | "slang_rs_foreach_lowering.cpp", |
| 145 | "slang_rs_ast_replace.cpp", |
| 146 | "slang_rs_check_ast.cpp", |
| 147 | "slang_rs_context.cpp", |
| 148 | "slang_rs_pragma_handler.cpp", |
| 149 | "slang_rs_exportable.cpp", |
| 150 | "slang_rs_export_type.cpp", |
| 151 | "slang_rs_export_element.cpp", |
| 152 | "slang_rs_export_var.cpp", |
| 153 | "slang_rs_export_func.cpp", |
| 154 | "slang_rs_export_foreach.cpp", |
| 155 | "slang_rs_export_reduce.cpp", |
| 156 | "slang_rs_object_ref_count.cpp", |
| 157 | "slang_rs_reflection.cpp", |
| 158 | "slang_rs_reflection_cpp.cpp", |
David Gross | d80e58b | 2017-07-24 11:41:12 -0700 | [diff] [blame] | 159 | "slang_rs_reflection_state.cpp", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 160 | "slang_rs_reflect_utils.cpp", |
| 161 | "slang_rs_special_func.cpp", |
| 162 | "slang_rs_special_kernel_param.cpp", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 163 | ], |
| 164 | |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 165 | static_libs: ["libslang"] + static_libraries_needed_by_slang, |
| 166 | |
| 167 | shared_libs: [ |
Colin Cross | 925085e | 2016-12-17 12:13:43 -0800 | [diff] [blame] | 168 | "libbcinfo", |
Pirama Arumuga Nainar | 24bfa42 | 2017-08-03 11:41:05 -0700 | [diff] [blame] | 169 | "libclang_android", |
| 170 | "libLLVM_android", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 171 | ], |
| 172 | |
| 173 | target: { |
| 174 | windows: { |
| 175 | host_ldlibs: [ |
| 176 | "-limagehlp", |
| 177 | "-lpsapi", |
| 178 | ], |
| 179 | cflags: [ |
| 180 | // Skip missing-field-initializer warnings for mingw. |
| 181 | "-Wno-error=missing-field-initializers", |
| 182 | ], |
| 183 | }, |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 184 | }, |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 185 | } |
| 186 | |
Stephen Hines | a4f47d3 | 2020-03-02 15:22:11 -0800 | [diff] [blame] | 187 | cc_binary_host { |
| 188 | name: "lld", |
| 189 | srcs: ["lld_main.cpp"], |
| 190 | ldflags: ["-static"], |
| 191 | stl: "libc++_static", |
| 192 | target: { |
| 193 | darwin: { |
| 194 | enabled: false, |
| 195 | }, |
| 196 | linux: { |
| 197 | enabled: false, |
| 198 | }, |
| 199 | windows: { |
| 200 | enabled: true, |
| 201 | }, |
| 202 | }, |
| 203 | } |
| 204 | |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 205 | subdirs = [ |
| 206 | "BitWriter_2_9", |
| 207 | "BitWriter_2_9_func", |
| 208 | "BitWriter_3_2", |
David Gross | 97ac1a5 | 2017-05-16 15:27:52 -0700 | [diff] [blame] | 209 | "StripUnkAttr", |
Colin Cross | 50eeccb | 2016-12-07 13:17:55 -0800 | [diff] [blame] | 210 | ] |