mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
Teach import_rust_crate() to track RustFFI.h as a real build output, and teach the relevant Rust build scripts to rerun when their FFI inputs change. Also keep a copy of RustFFI.h in Cargo's own OUT_DIR and restore the configured FFI output from that cached copy after cargo rustc runs. This fixes the case where Ninja knows the header is missing, reruns the custom command, and Cargo exits without rerunning build.rs because the crate itself is already up to date. When Cargo leaves multiple hashed build-script outputs behind, pick the newest root-output before restoring RustFFI.h so we do not copy a stale header after Rust-side API changes. Finally, track the remaining Rust-side inputs that could leave build artifacts stale: LibUnicode and LibJS now rerun build.rs when src/ changes, and the asmintgen rule now depends on Cargo.lock, the BytecodeDef path dependency, and newly added Rust source files.
16 lines
500 B
CMake
16 lines
500 B
CMake
if (NOT ENABLE_RUST)
|
|
message(FATAL_ERROR "LibRegex requires ENABLE_RUST; the legacy C++ regex engine has been removed")
|
|
endif()
|
|
|
|
set(SOURCES
|
|
ECMAScriptRegex.cpp
|
|
RustRegex.cpp
|
|
)
|
|
|
|
ladybird_lib(LibRegex regex EXPLICIT_SYMBOL_EXPORT)
|
|
target_link_libraries(LibRegex PRIVATE LibUnicode)
|
|
|
|
import_rust_crate(MANIFEST_PATH Rust/Cargo.toml CRATE_NAME libregex_rust FFI_HEADER RustFFI.h)
|
|
target_link_libraries(LibRegex PRIVATE libregex_rust)
|
|
target_compile_definitions(LibRegex PRIVATE ENABLE_RUST)
|