/ BUILD
BUILD
1 # Copyright 2023 Harmoniis Inc. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License 14 15 load("@crate_index//:defs.bzl", "aliases", "all_crate_deps") 16 load("@rules_cc//cc:defs.bzl", "cc_library") 17 load("@rules_rust//bindgen:bindgen.bzl", "rust_bindgen_library") 18 load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") 19 20 config_setting( 21 name = "freebsd-x86_64", 22 values = { 23 "cpu": "x86_64", 24 "os": "freebsd", 25 }, 26 ) 27 28 config_setting( 29 name = "macos-apple-silicon", 30 values = { 31 "apple_platform_type": "macos", 32 "cpu": "arm64", 33 }, 34 ) 35 36 config_setting( 37 name = "macos-universal", 38 values = { 39 "apple_platform_type": "macos", 40 "cpu": "x86_64", 41 }, 42 ) 43 44 config_setting( 45 name = "ios", 46 values = { 47 "apple_platform_type": "ios", 48 "cpu": "arm64", 49 }, 50 ) 51 52 config_setting( 53 name = "ios-simulator-universal", 54 values = { 55 "apple_platform_type": "ios", 56 "cpu": "ios_x86_64", 57 }, 58 ) 59 60 config_setting( 61 name = "ios-simulator-apple-silicon", 62 values = { 63 "apple_platform_type": "ios", 64 "cpu": "ios_arm64", 65 }, 66 ) 67 68 config_setting( 69 name = "android", 70 values = { 71 "cpu": "aarch64", 72 "os": "android", 73 }, 74 ) 75 76 77 rust_library( 78 name = "sharedlib", 79 aliases = aliases(), 80 deps = all_crate_deps( 81 normal = True, 82 ), 83 proc_macro_deps = all_crate_deps( 84 proc_macro = True, 85 ), 86 ) 87 88 rust_test( 89 name = "unit_test", 90 crate = ":sharedlib", 91 aliases = aliases( 92 normal_dev = True, 93 proc_macro_dev = True, 94 ), 95 deps = all_crate_deps( 96 normal_dev = True, 97 ), 98 proc_macro_deps = all_crate_deps( 99 proc_macro_dev = True, 100 ), 101 )