-
Notifications
You must be signed in to change notification settings - Fork 1
/
nanobind.BUILD
62 lines (57 loc) · 1.63 KB
/
nanobind.BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""
A cross-platform nanobind Bazel build.
Supports size and linker optimizations across all three major operating systems.
Size optimizations used: -Os, LTO.
Linker optimizations used: Debug stripping (release mode), linker response file (macOS only).
"""
load(
"@nanobind_bazel//:helpers.bzl",
"maybe_compact_asserts",
"nb_common_opts",
"nb_free_threading",
"nb_sizeopts",
"nb_stripopts",
"py_limited_api",
)
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
cc_library(
name = "nanobind",
srcs = glob(
include = ["src/*.cpp"],
exclude = ["src/nb_combined.cpp"],
),
additional_linker_inputs = select({
"@platforms//os:macos": [":cmake/darwin-ld-cpython.sym"],
"//conditions:default": [],
}),
copts = nb_common_opts(mode = "library") + nb_sizeopts(),
defines = py_limited_api() + nb_free_threading(),
includes = ["include"],
linkopts = select({
"@platforms//os:linux": ["-Wl,--gc-sections"],
"@platforms//os:macos": [
# chained fixups on Apple platforms.
"-Wl,@$(location :cmake/darwin-ld-cpython.sym)",
"-Wl,-dead_strip",
],
"//conditions:default": [],
}) + nb_stripopts(),
local_defines = maybe_compact_asserts(),
textual_hdrs = glob(
[
"include/**/*.h",
"src/*.h",
],
),
deps = [
"@robin_map",
"@rules_python//python/cc:current_py_cc_headers",
],
)
py_library(
name = "stubgen",
srcs = ["src/stubgen.py"],
imports = ["src"],
deps = ["@pypi__typing_extensions//:lib"],
)