Files
ladybird/Libraries/LibUnicode/CMakeLists.txt
Andreas Kling c167bfd50a Meta: Make Rust FFI headers reproducible
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.
2026-03-31 15:59:04 +02:00

43 lines
1.2 KiB
CMake

set(SOURCES
Calendar.cpp
Calendars/AdjustedEraCalendar.cpp
Calendars/ChineseDangiCalendar.cpp
CharacterTypes.cpp
Collator.cpp
CurrencyCode.cpp
DateTimeFormat.cpp
DisplayNames.cpp
DurationFormat.cpp
ICU.cpp
IDNA.cpp
ListFormat.cpp
Locale.cpp
Normalize.cpp
NumberFormat.cpp
PluralRules.cpp
RelativeTimeFormat.cpp
Segmenter.cpp
String.cpp
TimeZone.cpp
UnicodeKeywords.cpp
Utf16String.cpp
)
set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
ladybird_lib(LibUnicode unicode)
find_package(ICU 78.2 EXACT REQUIRED COMPONENTS data i18n uc)
target_link_libraries(LibUnicode PRIVATE ICU::i18n ICU::uc ICU::data)
import_rust_crate(MANIFEST_PATH Rust/Cargo.toml CRATE_NAME libunicode_rust FFI_HEADER RustFFI.h)
target_link_libraries(LibUnicode PRIVATE libunicode_rust)
# FIXME: Add support for building LibGfx in sanitize
# lld-link: error: /failifmismatch: mismatch detected for 'annotate_string':
# >>> lagom-unicode.lib(TimeZone.cpp.obj) has value 1
# >>> lagom-gfx.lib(PaintingSurface.cpp.obj) has value 0
if (WIN32 AND ENABLE_ADDRESS_SANITIZER)
target_compile_options(LibUnicode PRIVATE -fno-sanitize=address)
endif()