Skip to content

Commit

Permalink
iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Jan 4, 2023
1 parent a483d16 commit a6434d0
Show file tree
Hide file tree
Showing 7 changed files with 849 additions and 229 deletions.
1 change: 0 additions & 1 deletion ffi/capi_cdylib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ icu_provider = { version = "1.0.0", path = "../../provider/core", default-featur
# Please keep features/cargo-all-features lists in sync with the icu_capi crate
[features]
default = ["icu_capi/default"]
any_provider = ["icu_capi/any_provider"]
buffer_provider = ["icu_capi/buffer_provider"]
baked_provider = ["icu_capi/baked_provider"]
provider_fs = ["icu_capi/provider_fs"] # Indirectly implies buffer_provider
Expand Down
1 change: 0 additions & 1 deletion ffi/capi_staticlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ icu_provider = { version = "1.0.0", path = "../../provider/core", default-featur
# Please keep features/cargo-all-features lists in sync with the icu_capi crate
[features]
default = ["icu_capi/default"]
any_provider = ["icu_capi/any_provider"]
buffer_provider = ["icu_capi/buffer_provider"]
baked_provider = ["icu_capi/baked_provider"]
provider_fs = ["icu_capi/provider_fs"] # Indirectly implies buffer_provider
Expand Down
8 changes: 3 additions & 5 deletions ffi/diplomat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ all-features = true
skip_optional_dependencies = true
# Bench feature gets tested separately and is only relevant for CI.
# logging enables a feature of a dependency that has no externally visible API changes
# baked_provider requires datagen.
denylist = ["bench", "logging", "baked_provider"]
denylist = ["bench", "logging"]

# Please keep the features list in sync with the icu_capi_staticlib/icu_capi_cdylib crates
[features]
default = ["any_provider"]
any_provider = []
default = []
buffer_provider = [
"dep:icu_provider_blob",
"dep:serde",
Expand All @@ -61,7 +59,7 @@ provider_test = ["dep:icu_testdata"]
logging = ["icu_provider/log_error_context", "dep:log"]
# Use the env_logger functionality to log based on environment variables
simple_logger = ["dep:simple_logger"]
baked_provider = ["any_provider", "dep:zerovec"]
baked_provider = ["dep:zerovec"]

# meta feature for things we enable by default in C and C++
cpp_default = ["provider_test", "logging", "simple_logger"]
Expand Down
14 changes: 14 additions & 0 deletions ffi/diplomat/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

fn main() {
if std::env::var("ICU4X_FFI_BAKED_ROOT").is_err() {
// Default generated with
// $ cargo run -p icu_datagen --features bin,icu_segmenter -- --key-file /dev/null --format mod --use-separate-crates --pretty --out empty_bake
println!(
"cargo:rustc-env=ICU4X_FFI_BAKED_ROOT={}/empty_bake",
std::env!("CARGO_MANIFEST_DIR")
);
}
}
18 changes: 9 additions & 9 deletions ffi/diplomat/c/examples/fixeddecimal_tiny/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ GCC := gcc
CLANG := clang-14
LLD := lld-14

ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
export ICU4X_FFI_BAKED_ROOT = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))baked

../../../../../target/debug/libicu_capi_staticlib.a: $(ALL_RUST) baked/mod.rs
ICU4X_FFI_BAKED_ROOT=$(ROOT_DIR)/baked/mod.rs cargo build -p icu_capi_staticlib --no-default-features --features baked_provider
../../../../../target/debug/libicu_capi_staticlib.a: $(ALL_RUST) $(ICU4X_FFI_BAKED_ROOT)
cargo build -p icu_capi_staticlib --no-default-features --features baked_provider

icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a: $(ALL_RUST) baked/mod.rs
icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a: $(ALL_RUST) $(ICU4X_FFI_BAKED_ROOT)
cd icu_capi_staticlib_tiny && \
ICU4X_FFI_BAKED_ROOT=$(ROOT_DIR)/baked/mod.rs RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu
RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +$(ICU4X_NIGHTLY_TOOLCHAIN) panic-abort-build --target x86_64-unknown-linux-gnu

icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a: $(ALL_RUST) baked/mod.rs
icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a: $(ALL_RUST) $(ICU4X_FFI_BAKED_ROOT)
cd icu_capi_staticlib_tiny && \
ICU4X_FFI_BAKED_ROOT=$(ROOT_DIR)/baked/mod.rs RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu --profile=release-opt-size
RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +$(ICU4X_NIGHTLY_TOOLCHAIN) panic-abort-build --target x86_64-unknown-linux-gnu --profile=release-opt-size

baked/mod.rs:
cargo run -p icu_datagen --features bin,icu_segmenter -- --locales en bn --all-keys --cldr-tag 42.0.0 --icuexport-tag release-72-1 --format mod --out baked --use-separate-crates
$(ICU4X_FFI_BAKED_ROOT):
cargo run -p icu_datagen --features bin,icu_segmenter -- --locales en bn --keys "decimal/symbols@1" --cldr-root ../../../../../provider/testdata/data/cldr/ --format mod --use-separate-crates --pretty --out ${ICU4X_FFI_BAKED_ROOT}

# Naive target: no optimizations, full std
optim0.elf: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.c
Expand Down
Loading

0 comments on commit a6434d0

Please sign in to comment.