Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/build-test-distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,17 @@ jobs:
- name: Download C# Wasm Archive (single thread)
uses: actions/download-artifact@v8
with:
pattern: DotNetPatchArchiveWasm-Single
path: browser_wasm_runtime_single
pattern: DotNetPatchArchiveWasm-*
path: browser_wasm_runtime
merge-multiple: true

- name: Build C# Wasm package
run: |
mkdir meshlib_dotnet-wasm
mkdir meshlib_dotnet-wasm/native
move dotnet_dll/MRDotNet2Static.dll meshlib_dotnet-wasm
mkdir meshlib_dotnet-wasm/native/single
move browser_wasm_runtime_single/* meshlib_dotnet-wasm/native/single
move browser_wasm_runtime/* meshlib_dotnet-wasm/native
Compress-Archive -Path meshlib_dotnet-wasm -DestinationPath meshlib_dotnet-wasm.zip

- name: Generate NuGet specification
Expand Down
35 changes: 23 additions & 12 deletions .github/workflows/build-test-emscripten-c-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@ on:
type: boolean

jobs:
emscripten-build:
emscripten-build-c-bindings:
timeout-minutes: 40
runs-on: ubuntu-24.04
container:
image: meshlib/meshlib-emscripten-build-c-bindings:${{ inputs.docker_image_tag }}
strategy:
fail-fast: false
matrix:
config: [Singlethreaded, Multithreaded]
include:
- config: Singlethreaded
target_name: emscripten-singlethreaded
short_name: singlethreaded
thirdparty-dir: emscripten-single
- config: Multithreaded
target_name: emscripten
short_name: multithreaded
thirdparty-dir: emscripten

steps:
- name: Work-around possible permission issues
Expand All @@ -42,7 +53,7 @@ jobs:
continue-on-error: true
uses: ./.github/actions/collect-runner-stats
with:
target_os: emscripten-singlethreaded
target_os: ${{ matrix.target_name }}
target_arch: wasm
cxx_compiler: emcc
build_config: Release
Expand All @@ -65,9 +76,9 @@ jobs:

- name: Install thirdparty libs
run: |
ln -s /usr/local/lib/emscripten-single/include ./include
ln -s /usr/local/lib/emscripten-single/lib ./lib
ln -s /usr/local/lib/emscripten-single/share ./share
ln -s /usr/local/lib/${{ matrix.thirdparty-dir }}/include ./include
ln -s /usr/local/lib/${{ matrix.thirdparty-dir }}/lib ./lib
ln -s /usr/local/lib/${{ matrix.thirdparty-dir }}/share ./share

- name: Wait for C bindings
uses: ./.github/actions/wait-for-job
Expand All @@ -93,7 +104,7 @@ jobs:
MR_EMSCRIPTEN: "ON"
MESHLIB_BUILD_RELEASE: "ON"
MESHLIB_BUILD_DEBUG: "OFF"
MR_EMSCRIPTEN_SINGLE: "ON"
MR_EMSCRIPTEN_SINGLE: ${{ fromJSON('["OFF", "ON"]')[matrix.config == 'Singlethreaded'] }}
MR_EMSCRIPTEN_WASM64: "OFF"
MR_EMSCRIPTEN_MIMALLOC: "OFF"
# options to be passed to cmake
Expand All @@ -105,17 +116,17 @@ jobs:
--target MeshLibC2
run: ./scripts/build_source.sh

- name: Prepare C bindings for Wasm
- name: Prepare output files
shell: bash
run: |
mkdir wasm_files
cp build/Release/bin/*.a wasm_files
cp lib/*.a wasm_files
mkdir -p wasm_files/${{matrix.short_name}}
cp build/Release/bin/*.a wasm_files/${{matrix.short_name}}
cp lib/*.a wasm_files/${{matrix.short_name}}

- name: Upload Wasm files to Artifacts
- name: Upload to Artifacts
uses: actions/upload-artifact@v7
with:
name: DotNetPatchArchiveWasm-Single
name: DotNetPatchArchiveWasm-${{matrix.short_name}}
path: ./wasm_files/*
retention-days: 1
overwrite: true
9 changes: 9 additions & 0 deletions docker/emscripten-build-c-bindingsDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ COPY . .
ENV MR_STATE=DOCKER_BUILD
ENV MR_EMSCRIPTEN=ON

# 32-bit multi-threaded
RUN <<EOF
set -e
./scripts/build_thirdparty.sh
./scripts/cmake_install.sh /opt/meshlib-thirdparty/emscripten
rm -rf bin include lib share thirdparty_build
EOF

# 32-bit single-threaded
RUN <<EOF
set -e
Expand All @@ -48,6 +56,7 @@ EOF

FROM base

COPY --from=builder /opt/meshlib-thirdparty/emscripten /usr/local/lib/emscripten
COPY --from=builder /opt/meshlib-thirdparty/emscripten-single /usr/local/lib/emscripten-single

# Setup non-root user (use 1001 to play nicely with actions/checkout@v4)
Expand Down
Loading