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", 66 "libStripUnkAttr", 67 ] 68 69 // Exported header files 70 cc_library_headers { 71 name: "slang_headers", 72 vendor_available: true, 73 export_include_dirs: ["."], 74 host_supported: true, 75 target: { 76 windows: { 77 enabled: true, 78 }, 79 }, 80 } 81 82 // Static library libslang for host 83 // ======================================================== 84 cc_library_host_static { 85 name: "libslang", 86 defaults: ["slang-defaults"], 87 compile_multilib: "first", 88 89 target: { 90 windows: { 91 // Skip missing-field-initializer warnings for mingw. 92 cflags: ["-Wno-error=missing-field-initializers"], 93 }, 94 }, 95 96 srcs: [ 97 "slang.cpp", 98 "slang_bitcode_gen.cpp", 99 "slang_backend.cpp", 100 "slang_diagnostic_buffer.cpp", 101 ], 102 103 shared_libs: ["libbcinfo"], 104 105 product_variables: { 106 unbundled_build: { 107 enabled: false, 108 }, 109 }, 110 } 111 112 // ======================================================== 113 114 cc_binary_host { 115 name: "llvm-rs-as", 116 defaults: ["slang-defaults"], 117 118 srcs: ["llvm-rs-as.cpp"], 119 120 static_libs: ["libslang"] + static_libraries_needed_by_slang, 121 shared_libs: ["libLLVM_android"], 122 123 product_variables: { 124 unbundled_build: { 125 enabled: false, 126 }, 127 }, 128 } 129 130 // Executable llvm-rs-cc for host 131 // ======================================================== 132 133 // For build RSCCOptions.inc from RSCCOptions.td 134 llvm_tblgen { 135 name: "slang-gen-options", 136 in: "RSCCOptions.td", 137 outs: ["RSCCOptions.inc"], 138 } 139 140 cc_binary_host { 141 name: "llvm-rs-cc", 142 defaults: ["slang-defaults"], 143 144 generated_headers: ["slang-gen-options"], 145 srcs: [ 146 "llvm-rs-cc.cpp", 147 "rs_cc_options.cpp", 148 "slang_rs_foreach_lowering.cpp", 149 "slang_rs_ast_replace.cpp", 150 "slang_rs_check_ast.cpp", 151 "slang_rs_context.cpp", 152 "slang_rs_pragma_handler.cpp", 153 "slang_rs_exportable.cpp", 154 "slang_rs_export_type.cpp", 155 "slang_rs_export_element.cpp", 156 "slang_rs_export_var.cpp", 157 "slang_rs_export_func.cpp", 158 "slang_rs_export_foreach.cpp", 159 "slang_rs_export_reduce.cpp", 160 "slang_rs_object_ref_count.cpp", 161 "slang_rs_reflection.cpp", 162 "slang_rs_reflection_cpp.cpp", 163 "slang_rs_reflection_state.cpp", 164 "slang_rs_reflect_utils.cpp", 165 "slang_rs_special_func.cpp", 166 "slang_rs_special_kernel_param.cpp", 167 ], 168 169 static_libs: ["libslang"] + static_libraries_needed_by_slang, 170 171 shared_libs: [ 172 "libbcinfo", 173 "libclang_android", 174 "libLLVM_android", 175 ], 176 177 target: { 178 windows: { 179 host_ldlibs: [ 180 "-limagehlp", 181 "-lpsapi", 182 ], 183 cflags: [ 184 // Skip missing-field-initializer warnings for mingw. 185 "-Wno-error=missing-field-initializers", 186 ], 187 }, 188 }, 189 190 product_variables: { 191 unbundled_build: { 192 enabled: false, 193 }, 194 }, 195 } 196 197 subdirs = [ 198 "BitWriter_2_9", 199 "BitWriter_2_9_func", 200 "BitWriter_3_2", 201 "StripUnkAttr", 202 ] 203