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