diff --git a/.github/workflows/build_wasm.yml b/.github/workflows/build_wasm.yml new file mode 100644 index 0000000000..e424003b7d --- /dev/null +++ b/.github/workflows/build_wasm.yml @@ -0,0 +1,71 @@ +name: build_wasm + +on: + push: + paths-ignore: + - '**.md' + pull_request: + paths-ignore: + - '**.md' + workflow_dispatch: + +jobs: + + build_wasm: + name: Build_WASM + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Linux_EMCC_2 + os: ubuntu-20.04 + compiler_version: "2.0.20" + + steps: + - name: Sync Repository + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: '12' + + - name: Install Dependencies (Linux) + run: | + sudo apt-get update + sudo apt-get install libglu1-mesa-dev xorg-dev + mkdir -p tmp + cd tmp + git clone --recursive https://github.com/emscripten-core/emsdk + cd emsdk + ./emsdk install ${{ matrix.compiler_version }} + ./emsdk activate ${{ matrix.compiler_version }} + source ./emsdk_env.sh + echo "EMSDK=$EMSDK" >> $GITHUB_ENV + + - name: Create Build Directory + run: mkdir build + + - name: CMake Generate + run: cmake -DMATERIALX_BUILD_JS=ON -DMATERIALX_EMSDK_PATH=${{ env.EMSDK }} -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_TESTS=OFF -DMATERIALX_TEST_RENDER=OFF -DMATERIALX_WARNINGS_AS_ERRORS=ON ${{matrix.cmake_config}} .. + working-directory: build + + - name: CMake Build + run: cmake --build . --target install --config Release --parallel 2 + working-directory: build + + - name: JS Tests + run: | + cd ../source/JsMaterialX/test/ + npm install + npm run test + working-directory: build + + - name: Upload Installed Package + uses: actions/upload-artifact@v2 + with: + name: MaterialX_${{ matrix.name }} + path: build/installed/ \ No newline at end of file diff --git a/source/JsMaterialX/JsMaterialXCore/JsElement.cpp b/source/JsMaterialX/JsMaterialXCore/JsElement.cpp index 3ef0563634..9a9bc6dbd7 100644 --- a/source/JsMaterialX/JsMaterialXCore/JsElement.cpp +++ b/source/JsMaterialX/JsMaterialXCore/JsElement.cpp @@ -214,9 +214,9 @@ extern "C" .function("getFilenameSubstitutions", ems::optional_override([](mx::StringResolver &self) { std::unordered_map res = self.mx::StringResolver::getFilenameSubstitutions(); ems::val obj = ems::val::object(); - for (const auto &[key, value] : res) + for (std::pair element : res) { - obj.set(key, value); + obj.set(element.first, element.second); } return obj; @@ -225,9 +225,9 @@ extern "C" .function("getGeomNameSubstitutions", ems::optional_override([](mx::StringResolver &self) { std::unordered_map res = self.mx::StringResolver::getGeomNameSubstitutions(); ems::val obj = ems::val::object(); - for (const auto &[key, value] : res) + for (std::pair element : res) { - obj.set(key, value); + obj.set(element.first, element.second); } return obj;