Home | History | Annotate | Download | only in slang
      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         linux: {
     90             host_ldlibs: [
     91                 "-ldl",
     92                 "-lpthread",
     93             ],
     94         },
     95         darwin: {
     96             host_ldlibs: [
     97                 "-ldl",
     98                 "-lpthread",
     99             ],
    100         },
    101         windows: {
    102             // Skip missing-field-initializer warnings for mingw.
    103             cflags: ["-Wno-error=missing-field-initializers"],
    104         },
    105     },
    106 
    107     srcs: [
    108         "slang.cpp",
    109         "slang_bitcode_gen.cpp",
    110         "slang_backend.cpp",
    111         "slang_diagnostic_buffer.cpp",
    112     ],
    113 
    114     shared_libs: ["libbcinfo"],
    115 
    116     product_variables: {
    117         unbundled_build: {
    118             enabled: false,
    119         },
    120     },
    121 }
    122 
    123 // ========================================================
    124 
    125 cc_binary_host {
    126     name: "llvm-rs-as",
    127     defaults: ["slang-defaults"],
    128 
    129     srcs: ["llvm-rs-as.cpp"],
    130 
    131     static_libs: ["libslang"] + static_libraries_needed_by_slang,
    132     shared_libs: ["libLLVM"],
    133 
    134     product_variables: {
    135         unbundled_build: {
    136             enabled: false,
    137         },
    138     },
    139 }
    140 
    141 // Executable llvm-rs-cc for host
    142 // ========================================================
    143 
    144 // For build RSCCOptions.inc from RSCCOptions.td
    145 llvm_tblgen {
    146     name: "slang-gen-options",
    147     in: "RSCCOptions.td",
    148     outs: ["RSCCOptions.inc"],
    149 }
    150 
    151 cc_binary_host {
    152     name: "llvm-rs-cc",
    153     defaults: ["slang-defaults"],
    154 
    155     generated_headers: ["slang-gen-options"],
    156     srcs: [
    157         "llvm-rs-cc.cpp",
    158         "rs_cc_options.cpp",
    159         "slang_rs_foreach_lowering.cpp",
    160         "slang_rs_ast_replace.cpp",
    161         "slang_rs_check_ast.cpp",
    162         "slang_rs_context.cpp",
    163         "slang_rs_pragma_handler.cpp",
    164         "slang_rs_exportable.cpp",
    165         "slang_rs_export_type.cpp",
    166         "slang_rs_export_element.cpp",
    167         "slang_rs_export_var.cpp",
    168         "slang_rs_export_func.cpp",
    169         "slang_rs_export_foreach.cpp",
    170         "slang_rs_export_reduce.cpp",
    171         "slang_rs_object_ref_count.cpp",
    172         "slang_rs_reflection.cpp",
    173         "slang_rs_reflection_cpp.cpp",
    174         "slang_rs_reflect_utils.cpp",
    175         "slang_rs_special_func.cpp",
    176         "slang_rs_special_kernel_param.cpp",
    177     ],
    178 
    179     static_libs: ["libslang"] + static_libraries_needed_by_slang,
    180 
    181     shared_libs: [
    182         "libbcinfo",
    183         "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 
    219 subdirs = [
    220     "BitWriter_2_9",
    221     "BitWriter_2_9_func",
    222     "BitWriter_3_2",
    223     "StripUnkAttr",
    224 ]
    225