[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / third-party / benchmark / bindings / python / nanobind.BUILD
blob9874b80d1f5ac64b7ce1a741241e76662bfbdb8e
1 load("@bazel_skylib//lib:selects.bzl", "selects")
3 licenses(["notice"])
5 package(default_visibility = ["//visibility:public"])
7 config_setting(
8     name = "msvc_compiler",
9     flag_values = {"@bazel_tools//tools/cpp:compiler": "msvc-cl"},
12 selects.config_setting_group(
13     name = "winplusmsvc",
14     match_all = [
15         "@platforms//os:windows",
16         ":msvc_compiler",
17     ],
20 cc_library(
21     name = "nanobind",
22     srcs = glob([
23         "src/*.cpp",
24     ]),
25     additional_linker_inputs = select({
26         "@platforms//os:macos": [":cmake/darwin-ld-cpython.sym"],
27         "//conditions:default": [],
28     }),
29     copts = select({
30         ":msvc_compiler": [
31             "/EHsc",  # exceptions
32             "/Os",  # size optimizations
33             "/GL",  # LTO / whole program optimization
34         ],
35         # these should work on both clang and gcc.
36         "//conditions:default": [
37             "-fexceptions",
38             "-flto",
39             "-Os",
40         ],
41     }),
42     includes = [
43         "ext/robin_map/include",
44         "include",
45     ],
46     linkopts = select({
47         ":winplusmsvc": ["/LTGC"],  # Windows + MSVC.
48         "@platforms//os:macos": ["-Wl,@$(location :cmake/darwin-ld-cpython.sym)"],  # Apple.
49         "//conditions:default": [],
50     }),
51     textual_hdrs = glob(
52         [
53             "include/**/*.h",
54             "src/*.h",
55             "ext/robin_map/include/tsl/*.h",
56         ],
57     ),
58     deps = ["@python_headers"],