| Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago | 1 | # The C ABI Jolt loads for the UI: libvidya.so. |
| 2 | rust_library( |
| 3 | name = "vidya-ffi", |
| 4 | srcs = glob(["src/**/*.rs"]), |
| 5 | crate = "vidya", |
| 6 | crate_root = "src/lib.rs", |
| 7 | edition = "2021", |
| 8 | preferred_linkage = "shared", |
| 9 | # Without this buck names the library after the target — lib_vidya-ffi.so — |
| 10 | # and that name, not the filename, is what the linker writes into a |
| 11 | # dependent's DT_NEEDED. Every consumer looks for `libvidya`. |
| 12 | soname = "libvidya.so", |
| Ship the object without the notes nobody reads aabacba nandi 18d ago | 13 | # Cross-crate inlining across the whole graph, and one codegen unit so the |
| 14 | # dedup is not fighting parallelism inside the crate. Measured on the |
| 15 | # desktop object: 12.06M to 10.57M, of which 628K is .text and the rest is |
| 16 | # the unwind tables halving — LTO alone folds most of the duplicate landing |
| 17 | # pads away. Only the cdylib asks for it; the rlibs above stay as they are. |
| 18 | # |
| 19 | # opt-level stays at 2. 3 was measured too and came out 134K *larger*, so |
| 20 | # the level in the toolchain is the one to keep. |
| 21 | rustc_flags = [ |
| 22 | "-Clto=fat", |
| 23 | "-Ccodegen-units=1", |
| 24 | ], |
| Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago | 25 | visibility = ["PUBLIC"], |
| 26 | # Cargo renames the dependency so the cdylib itself can keep the `vidya` |
| 27 | # crate name; mirror that here. |
| Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago | 28 | named_deps = select({ |
| 29 | "DEFAULT": {"vidya_core": "//crates/vidya-core:vidya"}, |
| 30 | # jni is renamed in third-party/rust/Cargo.toml, for the reason given |
| 31 | # there; the crate is `jni` to the source either way. |
| 32 | "prelude//os:android": { |
| 33 | "jni": "//third-party/rust:jni-0-22", |
| 34 | "vidya_core": "//crates/vidya-core:vidya", |
| 35 | }, |
| 36 | }), |
| Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago | 37 | deps = [ |
| 38 | "//third-party/rust:egui", |
| 39 | "//third-party/rust:egui-winit", |
| 40 | "//third-party/rust:egui_glow", |
| 41 | "//third-party/rust:glow", |
| 42 | "//third-party/rust:glutin", |
| 43 | "//third-party/rust:glutin-winit", |
| 44 | "//third-party/rust:png", |
| 45 | "//third-party/rust:winit", |
| Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago | 46 | ] + select({ |
| 47 | # Reading a pasted picture off the clipboard, which arboard has no |
| 48 | # Android backend for; `vidya_open_url` is an ACTION_VIEW intent there |
| 49 | # and a JNI call. Mirrors the target-gated deps in Cargo.toml. |
| 50 | "DEFAULT": ["//third-party/rust:arboard"], |
| 51 | "prelude//os:android": [], |
| 52 | }), |
| Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago | 53 | ) |