Initial implementation of MuJoCo Live.
This is a combination of minor tweaks to the existing Studio WASM application, CMake cleanup to make it buildable, and integration with GitHub Actions for deployment. The new features added are drag-and-drop, model specification through `?model=` URL parameter, HTTP and HTTPS resource provider, and a user-visible loading message while the model is loading. PiperOrigin-RevId: 904594610 Change-Id: I3a73b1ca0fcd6fc9ba192469942b2dab010a9308
This commit is contained in:
committed by
Copybara-Service
parent
4eba85093a
commit
1465d8b6ce
@@ -295,6 +295,32 @@ EOF
|
||||
}
|
||||
|
||||
|
||||
build_mujoco_live() {
|
||||
echo "Setting up Emscripten SDK..."
|
||||
source emsdk/emsdk_env.sh
|
||||
|
||||
echo "Building Filament tools, targeting host platform..."
|
||||
cmake -S . -B build_host -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_STATIC_LIBCXX=OFF \
|
||||
-DMUJOCO_BUILD_STUDIO=ON \
|
||||
-DMUJOCO_USE_FILAMENT=ON \
|
||||
-DMUJOCO_BUILD_TESTS=OFF \
|
||||
-DMUJOCO_BUILD_EXAMPLES=OFF \
|
||||
-DMUJOCO_BUILD_SIMULATE=OFF
|
||||
cmake --build build_host --target matc resgen cmgen mujoco_filament_assets -j$(nproc)
|
||||
|
||||
echo "Building WASM app..."
|
||||
emcmake cmake -S . -B build_wasm -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DMUJOCO_BUILD_STUDIO=ON \
|
||||
-DMUJOCO_USE_FILAMENT=ON \
|
||||
-DMUJOCO_BUILD_TESTS_WASM=OFF \
|
||||
-DMUJOCO_NATIVE_BUILD_DIR=$(pwd)/build_host
|
||||
cmake --build build_wasm --target mujoco_live -j$(nproc)
|
||||
}
|
||||
|
||||
|
||||
# Discover functions defined in this script by finding identifiers followed by
|
||||
# "()" and capturing the identifier as a valid function name.
|
||||
VALID_FUNCTIONS=()
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
name: live
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- live
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
build-and-upload-artifacts:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare Linux
|
||||
run: bash ./.github/workflows/build_steps.sh prepare_linux
|
||||
|
||||
- name: Setup Emscripten
|
||||
run: bash ./.github/workflows/build_steps.sh setup_emsdk
|
||||
|
||||
- name: Build MuJoCo Live
|
||||
env:
|
||||
CC: clang-18
|
||||
CXX: clang++-18
|
||||
run: bash ./.github/workflows/build_steps.sh build_mujoco_live
|
||||
|
||||
- name: Prepare files for GitHub Pages
|
||||
run: |
|
||||
mkdir -p dist/bin
|
||||
cp -r build_wasm/bin/* dist/bin/
|
||||
cp src/experimental/studio/index.html dist/index.html
|
||||
|
||||
- name: Upload GitHub Pages artifacts
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: dist
|
||||
|
||||
deploy-pages:
|
||||
needs: build-and-upload-artifacts
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
Reference in New Issue
Block a user