Skip to content

Commit

Permalink
Adds WebAssembly CI
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeblanc committed Feb 17, 2024
1 parent ac39a95 commit c40422f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 6 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: wasm
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: emscripten-core/emsdk
path: extern/emsdk
- name: Build
run: |
./build-utils/em-build.sh
- name: Uploads artifacts
uses: actions/upload-artifact@v4
with:
name: samples
path: |
build-wasm/samples/**/*.html
build-wasm/samples/**/*.js
build-wasm/samples/**/*.wasm
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Next release
----------------------

* Build pipeline
- Adds CI for WebAssembly.

Release version 0.14.3
----------------------

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ Documentation and samples are available from [ozz-animation website](http://guil
Supported platforms
-------------------

Ozz is tested on Linux, Mac OS and Windows, for x86, x86-64 and ARM architectures. The run-time code (ozz_base, ozz_animation, ozz_geometry) depends only on c++11, on the C and the C++ standard libraries, and has no OS specific code. Portability to any other platform shouldn't be an issue.
ozz-animation is tested on WebAssembly, Linux, macOS and Windows, for x86, x86-64 and ARM architectures. The run-time code (ozz_base, ozz_animation, ozz_geometry) depends only on c++11, on the C and the C++ standard libraries, and has no OS specific code. Portability to any other platform shouldn't be an issue.

Samples, tools and tests depend on external libraries (glfw, tinygltf, Fbx SDK, jsoncpp, gtest, ...), which could limit portability.

Build status
------------

| | Linux | macOS | Windows |
| ------- | ------ | ------ | ------- |
| master | [![Linux](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml/badge.svg?branch=master)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml) | [![macOS](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml/badge.svg?branch=master)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml) | [![Windows](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml/badge.svg?branch=master)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml) |
| develop | [![Linux](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml/badge.svg?branch=develop)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml) | [![macOS](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml/badge.svg?branch=develop)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml) | [![Windows](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml/badge.svg?branch=develop)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml) |
| | Linux | macOS | Windows | WebAssembly |
| ------- | ------ | ------ | ------- | ------- |
| master | [![Linux](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml/badge.svg?branch=master)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml) | [![macOS](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml/badge.svg?branch=master)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml) | [![Windows](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml/badge.svg?branch=master)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml) | [![WASM](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/wasm.yml/badge.svg?branch=master)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/wasm.yml) |
| develop | [![Linux](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml/badge.svg?branch=develop)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/linux.yml) | [![macOS](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml/badge.svg?branch=develop)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/macos.yml) | [![Windows](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml/badge.svg?branch=develop)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/windows.yml) | [![WASM](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/wasm.yml/badge.svg?branch=develop)](https://github.com/guillaumeblanc/ozz-animation/actions/workflows/wasm.yml) |

The dashboard for all branches is available [here](http://guillaumeblanc.github.io/ozz-animation/documentation/dashboard/).

Expand Down
22 changes: 22 additions & 0 deletions build-utils/em-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Setup emscripten
cd extern/emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
cd ../..


# Setup cmake
mkdir build-wasm
cd build-wasm

if [[ $# -eq 0 ]] ; then
emcmake cmake -DCMAKE_BUILD_TYPE=Release ..
else
emcmake cmake -DCMAKE_BUILD_TYPE=$1 ..
fi

# Build
cmake --build .
2 changes: 2 additions & 0 deletions samples/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ add_library(sample_framework STATIC
if(NOT EMSCRIPTEN)
add_subdirectory(${PROJECT_SOURCE_DIR}/extern/glfw glfw)
target_link_libraries(sample_framework glfw)
else()
target_link_options(sample_framework PUBLIC -sUSE_GLFW=2)
endif()

target_link_libraries(sample_framework
Expand Down
2 changes: 1 addition & 1 deletion samples/framework/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Application::LoopStatus Application::OneLoop(int _loops) {
}
#else
int width, height;
if (emscripten_get_canvas_element_size(nullptr, &width, &height) !=
if (emscripten_get_canvas_element_size("#canvas", &width, &height) !=
EMSCRIPTEN_RESULT_SUCCESS) {
return kBreakFailure;
}
Expand Down

0 comments on commit c40422f

Please sign in to comment.