File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
ffi/cpp/examples/fixeddecimal Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -22,4 +22,12 @@ a.out: ../../../../target/debug/libicu_capi.a $(ALL_HEADERS) test.cpp
22
22
build : a.out
23
23
24
24
test : build
25
- ./a.out
25
+ ./a.out
26
+
27
+
28
+ ../../../../target/wasm32-unknown-unknown/debug/libicu_capi.a : $(ALL_RUST )
29
+ cargo +nightly build -p icu_capi --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
30
+
31
+ # Currently this doesn't run successfully, however it's the status quo of compiling ICU4X in C++ to WASM
32
+ main.html : ../../../../target/wasm32-unknown-unknown/debug/libicu_capi.a $(ALL_HEADERS ) test.cpp
33
+ emcc -std=c++17 test.cpp ../../../../target/wasm32-unknown-unknown/debug/libicu_capi.a -ldl -lpthread -lm -DWASM -g -o main.html --emrun -sWASM=1
Original file line number Diff line number Diff line change 6
6
7
7
#include < iostream>
8
8
9
+ #ifndef WASM
9
10
const std::string_view path = " ../../../../provider/testdata/data/json/" ;
11
+ #endif
10
12
11
13
int main () {
12
14
ICU4XLocale locale = ICU4XLocale::create (" bn" ).value ();
13
15
std::cout << " Running test for locale " << locale.tostring ().ok ().value () << std::endl;
16
+ #ifdef WASM
17
+ ICU4XDataProvider dp = ICU4XDataProvider::create_static ().provider .value ();
18
+ #else
14
19
ICU4XDataProvider dp = ICU4XDataProvider::create_fs (path).provider .value ();
15
-
20
+ # endif
16
21
ICU4XFixedDecimalFormatOptions opts = {ICU4XFixedDecimalGroupingStrategy::Auto, ICU4XFixedDecimalSignDisplay::Auto};
17
22
ICU4XFixedDecimalFormat fdf = ICU4XFixedDecimalFormat::try_new (locale, dp, opts).fdf .value ();
18
23
You can’t perform that action at this time.
0 commit comments