Skip to content

Commit d48d26c

Browse files
committed
chore: simd and multithreading
1 parent ad05b54 commit d48d26c

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,21 @@ jobs:
1212
strategy:
1313
matrix:
1414
EMSCRIPTEN_VERSION: [ '3.1.12','3.1.34','3.1.56' ]
15+
multithreaded: [true, false]
16+
simd: [true, false]
1517
steps:
1618
- uses: actions/checkout@v2
1719

1820
- name: Build unoicu.a
1921
run: |
2022
pushd src/unoicu
21-
docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --output type=local,dest=./out .
23+
docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=out/${{ matrix.EMSCRIPTEN_VERSION }}/${{ matrix.multithreaded == 'true' && 'mt' || 'st' }}${{ matrix.simd == 'true' && ',simd' || '' }} .
2224
popd
2325
2426
- name: Upload unoicu.a
2527
uses: actions/upload-artifact@v4
2628
with:
27-
name: unoicu-${{ matrix.EMSCRIPTEN_VERSION }}
29+
name: unoicu-${{ matrix.EMSCRIPTEN_VERSION }}-${{ matrix.multithreaded == 'true' && 'mt' || 'st' }}-${{ matrix.simd == 'true' && 'simd' || 'nosimd' }}
2830
path: ./src/unoicu/out
2931

3032
build_icudt:
@@ -78,9 +80,7 @@ jobs:
7880
mkdir -p ./nuget/buildTransitive/native/unoicu.a
7981
pushd merged-artifacts
8082
for dir in unoicu-*; do
81-
new_name="${dir#unoicu-}"
82-
mkdir -p ../nuget/buildTransitive/native/unoicu.a/"$new_name"/st
83-
cp -r "$dir"/unoicu.a ../nuget/buildTransitive/native/unoicu.a/"$new_name"/st/unoicu.a
83+
cp -r "$dir"/** ../nuget/buildTransitive/native/unoicu.a/
8484
done
8585
popd
8686

src/unoicu/Dockerfile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Build this Dockerfile with "docker build --build-arg EMSCRIPTEN_VERSION=<your-version> --output type=local,dest=. ." to get the unoicu.a file in the currect directory
1+
# Build this Dockerfile with "docker build --build-arg EMSCRIPTEN_VERSION=<your-version> --build-arg IS_MULTITHREADED=<true|false> --build-arg IS_SIMD_SUPPORTED=<true|false> --output type=local,dest=. ." to get the unoicu.a file in the currect directory
22
ARG EMSCRIPTEN_VERSION
33

44
FROM docker.io/emscripten/emsdk:${EMSCRIPTEN_VERSION} AS build
@@ -11,10 +11,23 @@ RUN wget https://github.com/unicode-org/icu/archive/refs/tags/release-77-1.zip
1111
RUN unzip release-77-1.zip
1212
WORKDIR icu-release-77-1/icu4c/source
1313

14+
ARG IS_MULTITHREADED
15+
ARG IS_SIMD_SUPPORTED
16+
17+
1418
# Thanks to https://github.com/echogarden-project/icu-segmentation-wasm/blob/1f0c7381f76e0d38784dd6ad23fed5f6365da319/docs/Building.md
1519
# for documenting the necessary configure options
1620

17-
RUN emconfigure ./configure --enable-static --disable-shared --with-data-packaging=static --disable-tests --disable-samples --disable-tools --disable-extras CFLAGS="-O3 -std=c11" CXXFLAGS="-O3 -std=c++17"
21+
RUN emconfigure ./configure \
22+
--enable-static \
23+
--disable-shared \
24+
--with-data-packaging=static \
25+
--disable-tests \
26+
--disable-samples \
27+
--disable-tools \
28+
--disable-extras \
29+
CFLAGS="-O3 -std=c11 $([ "$IS_MULTITHREADED" = "true" ] && echo "-pthread") $([ "$IS_SIMD_SUPPORTED" = "true" ] && echo "-msimd128")" \
30+
CXXFLAGS="-O3 -std=c++17 $([ "$IS_MULTITHREADED" = "true" ] && echo "-pthread") $([ "$IS_SIMD_SUPPORTED" = "true" ] && echo "-msimd128")"
1831
RUN emmake make -j $(nproc)
1932

2033
COPY unoicu.c .
@@ -23,6 +36,5 @@ RUN emar x lib/libicuuc.a
2336
RUN emar x stubdata/libicudata.a
2437
RUN emar rc unoicu.a *.ao unoicu.o
2538

26-
2739
FROM scratch
2840
COPY --from=build /icu/icu-release-77-1/icu4c/source/unoicu.a /

0 commit comments

Comments
 (0)