diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a3eab28..a2a9941 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -87,6 +87,22 @@ jobs: echo "EM_CONFIG=$EM_CONFIG" >> $GITHUB_ENV echo "$EMSDK:$EMSDK/upstream/emscripten" >> $GITHUB_PATH + - name: Cache emscripten build products + id: cache-emscripten + uses: actions/cache@v5 + env: + cache-name: emscripten-cache + with: + path: ${{ env.EMSDK }}/upstream/emscripten/cache + key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.emsdk_version }} + + - if: ${{ steps.cache-emscripten.outputs.cache-hit }} == 'true' + name: Run emscripten sanity check after restoring cache + run: | + source "$EMSDK/emsdk_env.sh" + emcc --check + exit $? + - name: Build TS App run: | source "$EMSDK/emsdk_env.sh" diff --git a/Makefile b/Makefile index b3eb956..a28ec93 100644 --- a/Makefile +++ b/Makefile @@ -47,8 +47,9 @@ opus-wasmlib: $(LIBOPUS_WASM_LIB) # common EMCC options define EMCC_OPTS --O2 \ +-O3 \ -msimd128 \ +-flto \ --minify 0 \ -gsource-map \ -s WASM=1 \ @@ -109,9 +110,11 @@ $(LIBOPUS_WASM_LIB): $(LIBOPUS_BUILD)/Makefile libopus-configure: $(LIBOPUS_BUILD)/Makefile - $(LIBOPUS_BUILD)/Makefile: $(LIBOPUS_SRC)/configure +$(LIBOPUS_BUILD)/Makefile: $(LIBOPUS_SRC)/configure mkdir -p $(LIBOPUS_BUILD) - cd $(LIBOPUS_BUILD); CFLAGS="-O3 -msimd128" emconfigure $(CURDIR)/$(LIBOPUS_SRC)/configure \ + cd $(LIBOPUS_BUILD); \ + CFLAGS="-O3 -msimd128 -flto" \ + emconfigure $(CURDIR)/$(LIBOPUS_SRC)/configure \ --host=wasm32-unknown-emscripten \ --enable-float-approx \ --disable-rtcd \