nandi/jolt-nativepublic Fork 0
c4f56b0a96ecb29336e2cf16c522b794ae62ad3f
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Ship the object without the notes nobody reads aabacba · on c4f56b0a96ecb29336e2cf16c522b794ae62ad3f · nandi · 18d ago
BUCK · 53 lines · 2.2 KBPython Blame HistoryRaw
 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
# The C ABI Jolt loads for the UI: libvidya.so.
rust_library(
    name = "vidya-ffi",
    srcs = glob(["src/**/*.rs"]),
    crate = "vidya",
    crate_root = "src/lib.rs",
    edition = "2021",
    preferred_linkage = "shared",
    # Without this buck names the library after the target — lib_vidya-ffi.so —
    # and that name, not the filename, is what the linker writes into a
    # dependent's DT_NEEDED. Every consumer looks for `libvidya`.
    soname = "libvidya.so",
    # Cross-crate inlining across the whole graph, and one codegen unit so the
    # dedup is not fighting parallelism inside the crate. Measured on the
    # desktop object: 12.06M to 10.57M, of which 628K is .text and the rest is
    # the unwind tables halving — LTO alone folds most of the duplicate landing
    # pads away. Only the cdylib asks for it; the rlibs above stay as they are.
    #
    # opt-level stays at 2. 3 was measured too and came out 134K *larger*, so
    # the level in the toolchain is the one to keep.
    rustc_flags = [
        "-Clto=fat",
        "-Ccodegen-units=1",
    ],
    visibility = ["PUBLIC"],
    # Cargo renames the dependency so the cdylib itself can keep the `vidya`
    # crate name; mirror that here.
    named_deps = select({
        "DEFAULT": {"vidya_core": "//crates/vidya-core:vidya"},
        # jni is renamed in third-party/rust/Cargo.toml, for the reason given
        # there; the crate is `jni` to the source either way.
        "prelude//os:android": {
            "jni": "//third-party/rust:jni-0-22",
            "vidya_core": "//crates/vidya-core:vidya",
        },
    }),
    deps = [
        "//third-party/rust:egui",
        "//third-party/rust:egui-winit",
        "//third-party/rust:egui_glow",
        "//third-party/rust:glow",
        "//third-party/rust:glutin",
        "//third-party/rust:glutin-winit",
        "//third-party/rust:png",
        "//third-party/rust:winit",
    ] + select({
        # Reading a pasted picture off the clipboard, which arboard has no
        # Android backend for; `vidya_open_url` is an ACTION_VIEW intent there
        # and a JNI call. Mirrors the target-gated deps in Cargo.toml.
        "DEFAULT": ["//third-party/rust:arboard"],
        "prelude//os:android": [],
    }),
)