diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06ae362..ef41d5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,8 +107,8 @@ jobs: ./deps/PawPaw/bootstrap-cardinal.sh linux-${{ matrix.target }} && ./deps/PawPaw/.cleanup.sh linux-${{ matrix.target }} - name: Build linux run: | - pushd deps/PawPaw; source local.env linux-${{ matrix.target }}; popd export PATH="/usr/lib/ccache:${PATH}" + source deps/PawPaw/local.env linux-${{ matrix.target }} export PKG_CONFIG_PATH+=:/usr/lib/${{ matrix.target }}-linux-gnu/pkgconfig make features make HAVE_PULSEAUDIO=false NOOPT=true -j $(nproc) @@ -169,7 +169,7 @@ jobs: path: | *.tar.gz - linux-headless: + headless: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -186,7 +186,7 @@ jobs: make HEADLESS=true features make HEADLESS=true -j $(nproc) - linux-lto: + lto: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -202,7 +202,7 @@ jobs: make features make WITH_LTO=true -j $(nproc) - linux-sysdeps: + sysdeps: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -256,32 +256,32 @@ jobs: if: steps.cache.outputs.cache-hit == 'true' run: | export PATH="/usr/local/opt/ccache/libexec:${PATH}" - pushd deps/PawPaw; source local.env macos-${{ matrix.target }}; popd + source deps/PawPaw/local.env macos-${{ matrix.target }} make features make NOOPT=true -j $(sysctl -n hw.logicalcpu) - name: Build macOS (AU using juce) if: steps.cache.outputs.cache-hit == 'true' run: | export PATH="/usr/local/opt/ccache/libexec:${PATH}" - pushd deps/PawPaw; source local.env macos-${{ matrix.target }}; popd + source deps/PawPaw/local.env macos-${{ matrix.target }} git clone --depth=1 -b v6.1.6 https://github.com/DISTRHO/JUCE.git jucewrapper/JUCE ${{ matrix.target == 'intel' }} && sed -i -e 's/kAudioUnitProperty_SupportsMPE/kAudioUnitProperty_ignore_SupportsMPE/' jucewrapper/JUCE/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h mkdir -p jucewrapper/build - pushd jucewrapper/build; cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release .. && make VERBOSE=1 -j $(sysctl -n hw.logicalcpu); popd + pushd jucewrapper/build; cmake -DCMAKE_BUILD_TYPE=Release .. && make VERBOSE=1 -j $(sysctl -n hw.logicalcpu); popd mv jucewrapper/build/*_artefacts/Release/AU/*.component bin/ - name: Build macOS (intel packaging) if: ${{ steps.cache.outputs.cache-hit == 'true' && matrix.target == 'intel' }} env: MACOS_ARCHS: 'x86_64' run: | - pushd deps/PawPaw; source local.env macos-${{ matrix.target }}; popd + source deps/PawPaw/local.env macos-${{ matrix.target }} ./utils/create-macos-installer.sh - name: Build macOS (universal packaging) if: ${{ steps.cache.outputs.cache-hit == 'true' && matrix.target == 'universal' }} env: MACOS_ARCHS: 'arm64,x86_64' run: | - pushd deps/PawPaw; source local.env macos-${{ matrix.target }}; popd + source deps/PawPaw/local.env macos-${{ matrix.target }} ./utils/create-macos-installer.sh - name: Set sha8 (non-release) if: startsWith(github.ref, 'refs/tags/') != true @@ -308,7 +308,17 @@ jobs: files: | ${{ github.event.repository.name }}-*.pkg - modduo: + modaudio: + strategy: + matrix: + include: + - name: modduo + target: modduo-static + extraflags: MODDUO=true + - name: modduox + target: modduox-static + - name: moddwarf + target: moddwarf runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -320,7 +330,7 @@ jobs: with: path: | ~/mod-workdir - key: modduo-static-v${{ env.CACHE_VERSION }} + key: ${{ matrix.target }}-v${{ env.CACHE_VERSION }} - name: Set up dependencies run: | sudo apt-get update -qq @@ -332,112 +342,29 @@ jobs: run: | git clone --depth=1 https://github.com/moddevices/mod-plugin-builder.git deps/mod-plugin-builder sed -i "s/CT_LOG_PROGRESS_BAR=y/CT_LOG_PROGRESS_BAR=n/" deps/mod-plugin-builder/toolchain/*.config - $(pwd)/deps/mod-plugin-builder/bootstrap.sh modduo-static minimal && $(pwd)/deps/mod-plugin-builder/.clean-install.sh modduo-static - - name: Build for modduo + $(pwd)/deps/mod-plugin-builder/bootstrap.sh ${{ matrix.target }} minimal && $(pwd)/deps/mod-plugin-builder/.clean-install.sh ${{ matrix.target }} + - name: Build for modaudio if: steps.mpb-cache.outputs.cache-hit == 'true' run: | - make HEADLESS=true modduo-features - make HEADLESS=true MODDUO=true modduo -j $(nproc) + make HEADLESS=true ${{ matrix.name }}-features + make HEADLESS=true ${{ matrix.extraflags }} ${{ matrix.name }} -j $(nproc) - name: Set sha8 id: slug run: echo "SHA8=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV - name: Pack binaries if: steps.mpb-cache.outputs.cache-hit == 'true' run: | - tar -c -h --hard-dereference -z -f ${{ github.event.repository.name }}-modduo-${{ github.event.pull_request.number || env.SHA8 }}.tar.gz -C bin $(ls bin | grep lv2) + tar -c -h --hard-dereference -z -f ${{ github.event.repository.name }}-${{ matrix.name }}-${{ github.event.pull_request.number || env.SHA8 }}.tar.gz -C bin $(ls bin | grep lv2) - uses: actions/upload-artifact@v3 with: - name: ${{ github.event.repository.name }}-modduo-${{ github.event.pull_request.number || env.SHA8 }} - path: | - *.tar.gz - - modduox: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Set up cache - uses: actions/cache@v3 - id: mpb-cache - with: - path: | - ~/mod-workdir - key: modduox-v${{ env.CACHE_VERSION }} - - name: Set up dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -yqq acl bc curl cvs git mercurial rsync subversion wget bison bzip2 flex gawk gperf gzip help2man nano perl patch tar texinfo unzip automake binutils build-essential cpio libtool libncurses-dev pkg-config python libtool-bin liblo-dev qemu-user-static - sudo apt-get install -yqq pandoc texlive-latex-recommended texlive-latex-extra - sudo apt-get clean - - name: Bootstrap toolchain - if: steps.mpb-cache.outputs.cache-hit != 'true' - run: | - git clone --depth=1 https://github.com/moddevices/mod-plugin-builder.git deps/mod-plugin-builder - sed -i "s/CT_LOG_PROGRESS_BAR=y/CT_LOG_PROGRESS_BAR=n/" deps/mod-plugin-builder/toolchain/*.config - $(pwd)/deps/mod-plugin-builder/bootstrap.sh modduox-static minimal && $(pwd)/deps/mod-plugin-builder/.clean-install.sh modduox-static - - name: Build for modduox - if: steps.mpb-cache.outputs.cache-hit == 'true' - run: | - make HEADLESS=true modduox-features - make HEADLESS=true modduox -j $(nproc) - - name: Set sha8 - id: slug - run: echo "SHA8=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV - - name: Pack binaries - if: steps.mpb-cache.outputs.cache-hit == 'true' - run: | - tar -c -h --hard-dereference -z -f ${{ github.event.repository.name }}-modduox-${{ github.event.pull_request.number || env.SHA8 }}.tar.gz -C bin $(ls bin | grep lv2) - - uses: actions/upload-artifact@v3 - with: - name: ${{ github.event.repository.name }}-modduox-${{ github.event.pull_request.number || env.SHA8 }} - path: | - *.tar.gz - - moddwarf: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Set up cache - uses: actions/cache@v3 - id: mpb-cache - with: - path: | - ~/mod-workdir - key: moddwarf-v${{ env.CACHE_VERSION }} - - name: Set up dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -yqq acl bc curl cvs git mercurial rsync subversion wget bison bzip2 flex gawk gperf gzip help2man nano perl patch tar texinfo unzip automake binutils build-essential cpio libtool libncurses-dev pkg-config python libtool-bin liblo-dev qemu-user-static - sudo apt-get install -yqq pandoc texlive-latex-recommended texlive-latex-extra - sudo apt-get clean - - name: Bootstrap toolchain - if: steps.mpb-cache.outputs.cache-hit != 'true' - run: | - git clone --depth=1 https://github.com/moddevices/mod-plugin-builder.git deps/mod-plugin-builder - sed -i "s/CT_LOG_PROGRESS_BAR=y/CT_LOG_PROGRESS_BAR=n/" deps/mod-plugin-builder/toolchain/*.config - $(pwd)/deps/mod-plugin-builder/bootstrap.sh moddwarf minimal && $(pwd)/deps/mod-plugin-builder/.clean-install.sh moddwarf - - name: Build for moddwarf - if: steps.mpb-cache.outputs.cache-hit == 'true' - run: | - make HEADLESS=true moddwarf-features - make HEADLESS=true moddwarf -j $(nproc) - - name: Set sha8 - id: slug - run: echo "SHA8=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV - - name: Pack binaries - if: steps.mpb-cache.outputs.cache-hit == 'true' - run: | - tar -c -h --hard-dereference -z -f ${{ github.event.repository.name }}-moddwarf-${{ github.event.pull_request.number || env.SHA8 }}.tar.gz -C bin $(ls bin | grep lv2) - - uses: actions/upload-artifact@v3 - with: - name: ${{ github.event.repository.name }}-moddwarf-${{ github.event.pull_request.number || env.SHA8 }} + name: ${{ github.event.repository.name }}-${{ matrix.name }}-${{ github.event.pull_request.number || env.SHA8 }} path: | *.tar.gz wasm: + strategy: + matrix: + target: [simd, nosimd] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 @@ -458,7 +385,7 @@ jobs: src/Rack/dep/libsamplerate-0.1.9 src/Rack/dep/speexdsp-SpeexDSP-1.2rc3 src/Rack/dep/zstd-1.4.5 - key: wasm-v${{ env.CACHE_VERSION }} + key: wasm-${{ matrix.target }}-v${{ env.CACHE_VERSION }} - name: Set up dependencies run: | sudo apt-get update -qq @@ -468,115 +395,40 @@ jobs: cd ~/PawPawBuilds/emsdk && ./emsdk install ${{ env.EMSCRIPTEN_VERSION }} && ./emsdk activate ${{ env.EMSCRIPTEN_VERSION }} - name: Build extra dependencies run: | + ${{ matrix.target == 'nosimd' }} && export PAWPAW_NOSIMD=1 source ~/PawPawBuilds/emsdk/emsdk_env.sh ./deps/PawPaw/bootstrap-cardinal.sh wasm && ./deps/PawPaw/.cleanup.sh wasm - name: Build wasm cross-compiled if: steps.cache.outputs.cache-hit == 'true' run: | + ${{ matrix.target == 'nosimd' }} && export PAWPAW_NOSIMD=1 source ~/PawPawBuilds/emsdk/emsdk_env.sh - pushd deps/PawPaw; source local.env wasm; popd - make features - make HAVE_LIBLO=false NOOPT=true -j $(nproc) - - name: Make wasm versioned and compress - if: steps.cache.outputs.cache-hit == 'true' - run: | - VERSION=$(cat Makefile | awk 'sub("VERSION = ","")') - cd bin - sed -i "s/CardinalMini\./CardinalMini-v${VERSION}\./g" *.html *.js - sed -i "s/CardinalNative\./CardinalNative-v${VERSION}\./g" *.html *.js - mv CardinalMini.data CardinalMini-v${VERSION}.data - mv CardinalMini.js CardinalMini-v${VERSION}.js - mv CardinalMini.wasm CardinalMini-v${VERSION}.wasm - mv CardinalNative.data CardinalNative-v${VERSION}.data - mv CardinalNative.js CardinalNative-v${VERSION}.js - mv CardinalNative.wasm CardinalNative-v${VERSION}.wasm - brotli -k -q 11 *.data *.html *.js *.wasm - - name: Set sha8 (non-release) - if: startsWith(github.ref, 'refs/tags/') != true - run: echo "SHA8=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV - - name: Set sha8 (release) - if: startsWith(github.ref, 'refs/tags/') - run: echo "SHA8=$(echo ${{ github.ref_name }})" >> $GITHUB_ENV - - name: Pack binaries - if: steps.cache.outputs.cache-hit == 'true' - run: | - cd bin; zip -r -9 ../${{ github.event.repository.name }}-wasm-${{ github.event.pull_request.number || env.SHA8 }}.zip $(ls *.br *.html *.data *.js *.wasm) - - uses: actions/upload-artifact@v3 - with: - name: ${{ github.event.repository.name }}-wasm-${{ github.event.pull_request.number || env.SHA8 }} - path: | - *.zip - - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - tag_name: ${{ github.ref_name }} - name: ${{ github.ref_name }} - draft: false - prerelease: false - files: | - *.zip - - wasm-noopt: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Set up cache - id: cache - uses: actions/cache@v3 - with: - path: | - ~/PawPawBuilds - src/Rack/dep/bin - src/Rack/dep/include - src/Rack/dep/lib - src/Rack/dep/share - src/Rack/dep/jansson-2.12 - src/Rack/dep/libarchive-3.4.3 - src/Rack/dep/libsamplerate-0.1.9 - src/Rack/dep/speexdsp-SpeexDSP-1.2rc3 - src/Rack/dep/zstd-1.4.5 - key: wasm-noopt-v${{ env.CACHE_VERSION }} - - name: Set up dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -yqq brotli gperf - sudo apt-get clean - [ -e ~/PawPawBuilds/emsdk ] || git clone https://github.com/emscripten-core/emsdk.git ~/PawPawBuilds/emsdk - cd ~/PawPawBuilds/emsdk && ./emsdk install ${{ env.EMSCRIPTEN_VERSION }} && ./emsdk activate ${{ env.EMSCRIPTEN_VERSION }} - - name: Build extra dependencies - env: - PAWPAW_NOSIMD: 1 - run: | - source ~/PawPawBuilds/emsdk/emsdk_env.sh - ./deps/PawPaw/bootstrap-cardinal.sh wasm && ./deps/PawPaw/.cleanup.sh wasm - - name: Build wasm-noopt cross-compiled - if: steps.cache.outputs.cache-hit == 'true' - env: - PAWPAW_NOSIMD: 1 - NOSIMD: true - run: | - source ~/PawPawBuilds/emsdk/emsdk_env.sh - pushd deps/PawPaw; source local.env wasm; popd + source deps/PawPaw/local.env wasm # FIXME send patch upstream, assuming this works.. sed -i -e 's/defined(__riscv)/defined(__riscv) || defined(__EMSCRIPTEN__)/' plugins/surgext/surge/src/common/globals.h make features - make HAVE_LIBLO=false NOOPT=true -j $(nproc) - make HAVE_LIBLO=false NOOPT=true -j $(nproc) -C src/CardinalMiniSep modgui - - name: Make wasm-noopt versioned and compress + make HAVE_LIBLO=false NOOPT=true NOSIMD=${{ matrix.target == 'nosimd' }} -j $(nproc) + - name: Build modgui + if: ${{ steps.cache.outputs.cache-hit == 'true' && matrix.target == 'nosimd' }} + run: | + ${{ matrix.target == 'nosimd' }} && export PAWPAW_NOSIMD=1 + source ~/PawPawBuilds/emsdk/emsdk_env.sh + source deps/PawPaw/local.env wasm + make HAVE_LIBLO=false NOOPT=true NOSIMD=true -j $(nproc) -C src/CardinalMiniSep modgui + - name: Make wasm versioned and compress if: steps.cache.outputs.cache-hit == 'true' run: | + ${{ matrix.target == 'nosimd' }} && export SUFFIX="-nosimd" VERSION=$(cat Makefile | awk 'sub("VERSION = ","")') cd bin - sed -i "s/CardinalMini\./CardinalMini-noopt-v${VERSION}\./g" *.html *.js - sed -i "s/CardinalNative\./CardinalNative-noopt-v${VERSION}\./g" *.html *.js - mv CardinalMini.data CardinalMini-noopt-v${VERSION}.data - mv CardinalMini.js CardinalMini-noopt-v${VERSION}.js - mv CardinalMini.wasm CardinalMini-noopt-v${VERSION}.wasm - mv CardinalNative.data CardinalNative-noopt-v${VERSION}.data - mv CardinalNative.js CardinalNative-noopt-v${VERSION}.js - mv CardinalNative.wasm CardinalNative-noopt-v${VERSION}.wasm + sed -i "s/CardinalMini${SUFFIX}\./CardinalMini${SUFFIX}-v${VERSION}\./g" *.html *.js + sed -i "s/CardinalNative${SUFFIX}\./CardinalNative${SUFFIX}-v${VERSION}\./g" *.html *.js + mv CardinalMini.data CardinalMini${SUFFIX}-v${VERSION}.data + mv CardinalMini.js CardinalMini${SUFFIX}-v${VERSION}.js + mv CardinalMini.wasm CardinalMini${SUFFIX}-v${VERSION}.wasm + mv CardinalNative.data CardinalNative${SUFFIX}-v${VERSION}.data + mv CardinalNative.js CardinalNative${SUFFIX}-v${VERSION}.js + mv CardinalNative.wasm CardinalNative${SUFFIX}-v${VERSION}.wasm brotli -k -q 11 *.data *.html *.js *.wasm - name: Set sha8 (non-release) if: startsWith(github.ref, 'refs/tags/') != true @@ -587,10 +439,10 @@ jobs: - name: Pack binaries if: steps.cache.outputs.cache-hit == 'true' run: | - cd bin; zip -r -9 ../${{ github.event.repository.name }}-wasm-noopt-${{ github.event.pull_request.number || env.SHA8 }}.zip $(ls *.br *.html *.data *.js *.wasm-noopt) CardinalMini.lv2/modgui + cd bin; zip -r -9 ../${{ github.event.repository.name }}-wasm-${{ matrix.target }}-${{ github.event.pull_request.number || env.SHA8 }}.zip $(ls *.br *.html *.data *.js *.wasm) - uses: actions/upload-artifact@v3 with: - name: ${{ github.event.repository.name }}-wasm-noopt-${{ github.event.pull_request.number || env.SHA8 }} + name: ${{ github.event.repository.name }}-wasm-${{ matrix.target }}-${{ github.event.pull_request.number || env.SHA8 }} path: | *.zip - uses: softprops/action-gh-release@v1 @@ -660,21 +512,21 @@ jobs: if: steps.cache.outputs.cache-hit == 'true' run: | export PATH="/usr/lib/ccache:${PATH}" - pushd deps/PawPaw; source local.env ${{ matrix.target }}; popd + source deps/PawPaw/local.env ${{ matrix.target }} make features make NOOPT=true -j $(nproc) - name: Build cross-compiled (carla) if: steps.cache.outputs.cache-hit == 'true' run: | export PATH="/usr/lib/ccache:${PATH}" - pushd deps/PawPaw; source local.env ${{ matrix.target }}; popd + source deps/PawPaw/local.env ${{ matrix.target }} make carla-win32 -j $(nproc) make -C carla EMBED_TARGET=true TESTING=true dist make -C carla EMBED_TARGET=true TESTING=true dist - name: Build cross-compiled (packaging) if: steps.cache.outputs.cache-hit == 'true' run: | - pushd deps/PawPaw; source local.env ${{ matrix.target }}; popd + source deps/PawPaw/local.env ${{ matrix.target }} xvfb-run ./utils/create-windows-installer.sh ${{ matrix.target }} make unzipfx - name: Set sha8 (non-release) diff --git a/Makefile.base.mk b/Makefile.base.mk index d7d4b2d..13940c1 100644 --- a/Makefile.base.mk +++ b/Makefile.base.mk @@ -8,16 +8,22 @@ ifeq ($(ROOT),) $(error invalid usage) endif +ifeq ($(NOSIMD),true) +ifneq (,$(findstring -msse,$(CXXFLAGS))) +$(error NOSIMD build requested but -msse compiler flag is present in CXXFLAGS) +endif +endif + # ----------------------------------------------------------------------------- # Import base definitions -DISTRHO_NAMESPACE = CardinalDISTRHO -DGL_NAMESPACE = CardinalDGL -NVG_DISABLE_SKIPPING_WHITESPACE = true -NVG_FONT_TEXTURE_FLAGS = NVG_IMAGE_NEAREST -USE_NANOVG_FBO = true -WASM_EXCEPTIONS = true -WINDOWS_ICON_ID = 401 +export DISTRHO_NAMESPACE = CardinalDISTRHO +export DGL_NAMESPACE = CardinalDGL +export NVG_DISABLE_SKIPPING_WHITESPACE = true +export NVG_FONT_TEXTURE_FLAGS = NVG_IMAGE_NEAREST +export USE_NANOVG_FBO = true +export WASM_EXCEPTIONS = true +export WINDOWS_ICON_ID = 401 include $(ROOT)/dpf/Makefile.base.mk DGL_EXTRA_ARGS = \ diff --git a/jucewrapper/CMakeLists.txt b/jucewrapper/CMakeLists.txt index 9d97a5e..3cc44bd 100644 --- a/jucewrapper/CMakeLists.txt +++ b/jucewrapper/CMakeLists.txt @@ -237,7 +237,6 @@ target_link_libraries(Cardinal -lmagic PUBLIC juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) #]] @@ -340,7 +339,6 @@ target_link_libraries(CardinalFX -lmagic PUBLIC juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) # MIDI variant @@ -442,7 +440,6 @@ target_link_libraries(CardinalMIDI -lmagic PUBLIC juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) # Synth variant @@ -544,5 +541,4 @@ target_link_libraries(CardinalSynth -lmagic PUBLIC juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) diff --git a/src/Makefile.cardinal.mk b/src/Makefile.cardinal.mk index 0feb19f..c0ebe95 100644 --- a/src/Makefile.cardinal.mk +++ b/src/Makefile.cardinal.mk @@ -219,7 +219,7 @@ endif endif ifeq ($(WASM),true) -WASM_RESOURCES = $(LV2_RESOURCES) +WASM_RESOURCES = $(TARGET_DIR)/$(NAME).html $(LV2_RESOURCES) ifneq ($(CARDINAL_VARIANT),mini) WASM_RESOURCES += $(CURDIR)/lv2/fomp.lv2/manifest.ttl @@ -256,6 +256,10 @@ else ifneq ($(CARDINAL_VARIANT),mini) FORCE_NATIVE_AUDIO_FALLBACK = true endif +ifeq ($(WASM),true) +APP_EXT = .js +endif + USE_VST2_BUNDLE = true USE_CLAP_BUNDLE = true include ../../dpf/Makefile.plugins.mk @@ -283,10 +287,8 @@ LINK_FLAGS += -sINITIAL_MEMORY=64Mb LINK_FLAGS += -sLZ4=1 ifeq ($(CARDINAL_VARIANT),mini) -LINK_FLAGS += --shell-file=../emscripten/CardinalMini.html LINK_FLAGS += --preload-file=../../bin/CardinalMini.lv2/resources@/resources else -LINK_FLAGS += --shell-file=../emscripten/CardinalNative.html LINK_FLAGS += --preload-file=../../bin/CardinalNative.lv2/resources@/resources LINK_FLAGS += --preload-file=./jsfx LINK_FLAGS += --preload-file=./lv2 @@ -434,6 +436,10 @@ $(TARGET_DIR)/%.app/Contents/Resources/distrho.icns: ../../utils/distrho.icns # Extra rules for wasm resources ifeq ($(WASM),true) +$(TARGET_DIR)/$(NAME).html: ../emscripten/$(NAME).html + -@mkdir -p $(shell dirname $@) + cp $< $@ + $(CURDIR)/lv2/fomp.lv2/manifest.ttl: $(TARGET_DIR)/$(NAME).lv2/resources/PluginManifests/Cardinal.json wget -O - https://falktx.com/data/wasm-things-2022-08-15.tar.gz | tar xz -C $(CURDIR) touch $@ diff --git a/src/emscripten/CardinalMini.html b/src/emscripten/CardinalMini.html index ee0ed28..1525716 100644 --- a/src/emscripten/CardinalMini.html +++ b/src/emscripten/CardinalMini.html @@ -115,9 +115,6 @@ if (typeof(WebAssembly) === "undefined") { wasmErrors.push('WebAssembly unsupported'); } else { - if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11]))) { - wasmErrors.push('Bulk Memory Operations unsupported'); - } if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1]))) { wasmErrors.push('Importable/Exportable mutable globals unsupported'); } @@ -188,8 +185,19 @@ if (text) console.error('[post-exception status] ' + text); }; }; + + var jsModuleName; + if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))) { + jsModuleName = "CardinalMini-nosimd.js"; + } else { + jsModuleName = "CardinalMini.js"; + } + var jsModuleScript = document.createElement('script'); + jsModuleScript.setAttribute('async', true); + jsModuleScript.setAttribute('src', jsModuleName); + jsModuleScript.setAttribute('type','text/javascript'); + document.head.appendChild(jsModuleScript); } - {{{ SCRIPT }}} diff --git a/src/emscripten/CardinalNative.html b/src/emscripten/CardinalNative.html index c82a928..13861c7 100644 --- a/src/emscripten/CardinalNative.html +++ b/src/emscripten/CardinalNative.html @@ -115,15 +115,9 @@ if (typeof(WebAssembly) === "undefined") { wasmErrors.push('WebAssembly unsupported'); } else { - if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11]))) { - wasmErrors.push('Bulk Memory Operations unsupported'); - } if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1]))) { wasmErrors.push('Importable/Exportable mutable globals unsupported'); } - if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))) { - wasmErrors.push('Fixed-Width SIMD unsupported'); - } } if (wasmErrors.length !== 0) { @@ -191,8 +185,19 @@ if (text) console.error('[post-exception status] ' + text); }; }; + + var jsModuleName; + if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))) { + jsModuleName = "CardinalNative-nosimd.js"; + } else { + jsModuleName = "CardinalNative.js"; + } + var jsModuleScript = document.createElement('script'); + jsModuleScript.setAttribute('async', true); + jsModuleScript.setAttribute('src', jsModuleName); + jsModuleScript.setAttribute('type','text/javascript'); + document.head.appendChild(jsModuleScript); } - {{{ SCRIPT }}}