Skip to content

Commit 99cc93b

Browse files
committed
Add wasm-mini build target
Signed-off-by: falkTX <[email protected]>
1 parent 8d9cd6b commit 99cc93b

File tree

2 files changed

+82
-1
lines changed

2 files changed

+82
-1
lines changed

.github/workflows/build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,78 @@ jobs:
765765
files: |
766766
*.zip
767767
768+
wasm-mini:
769+
runs-on: ubuntu-20.04
770+
steps:
771+
- uses: actions/checkout@v2
772+
with:
773+
submodules: recursive
774+
- name: Set up cache
775+
id: cache
776+
uses: actions/cache@v2
777+
with:
778+
path: |
779+
~/emsdk
780+
*/*.a
781+
build/CardinalFX
782+
build/plugins
783+
build/rack
784+
dpf/build
785+
src/Rack/dep/bin
786+
src/Rack/dep/include
787+
src/Rack/dep/lib
788+
src/Rack/dep/share
789+
src/Rack/dep/jansson-2.12
790+
src/Rack/dep/libarchive-3.4.3
791+
src/Rack/dep/libsamplerate-0.1.9
792+
src/Rack/dep/speexdsp-SpeexDSP-1.2rc3
793+
src/Rack/dep/zstd-1.4.5
794+
key: wasm-mini-v${{ env.CACHE_VERSION }}
795+
- name: Set up dependencies
796+
run: |
797+
[ -e ~/emsdk ] || git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
798+
cd ~/emsdk && ./emsdk install latest && ./emsdk activate latest
799+
- name: Build wasm-mini cross-compiled
800+
env:
801+
AR: emar
802+
CC: emcc
803+
CXX: em++
804+
NM: emnm
805+
RANLIB: emranlib
806+
STRIP: emstrip
807+
run: |
808+
source ~/emsdk/emsdk_env.sh
809+
make features
810+
make CIBUILD=true NOPLUGINS=true STATIC_BUILD=true USE_GLES2=true -j $(nproc)
811+
- name: Set sha8 (non-release)
812+
if: startsWith(github.ref, 'refs/tags/') != true
813+
id: slug1
814+
run: echo "::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)"
815+
- name: Set sha8 (release)
816+
if: startsWith(github.ref, 'refs/tags/')
817+
id: slug2
818+
run: echo "::set-output name=sha8::$(echo ${{ github.ref_name }})"
819+
- name: Set sha8
820+
id: slug
821+
run: echo "::set-output name=sha8::$(echo ${{ steps.slug1.outputs.sha8 || steps.slug2.outputs.sha8 }})"
822+
- name: Pack binaries
823+
run: |
824+
cd bin; zip -r -9 ../${{ github.event.repository.name }}-wasm-mini-${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}.zip $(ls *.html *.data *.js *.wasm)
825+
- uses: actions/upload-artifact@v2
826+
with:
827+
name: ${{ github.event.repository.name }}-wasm-mini-${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
828+
path: |
829+
*.zip
830+
- uses: softprops/action-gh-release@v1
831+
if: startsWith(github.ref, 'refs/tags/')
832+
with:
833+
tag_name: ${{ github.ref_name }}
834+
name: ${{ github.ref_name }}
835+
draft: false
836+
prerelease: false
837+
files: |
838+
*.zip
839+
768840
win32:
769841
runs-on: ubuntu-20.04
770842
steps:

src/Makefile.cardinal.mk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ endif
117117

118118
# FIXME
119119
ifeq ($(WASM),true)
120+
ifneq ($(STATIC_BUILD),true)
120121
STATIC_CARLA_PLUGIN_LIBS = -lsndfile -lopus -lFLAC -lvorbisenc -lvorbis -logg -lm
121122
endif
123+
endif
122124

123125
EXTRA_DEPENDENCIES = $(RACK_EXTRA_LIBS) $(CARLA_EXTRA_LIBS)
124126
EXTRA_LIBS = $(RACK_EXTRA_LIBS) $(CARLA_EXTRA_LIBS) $(STATIC_CARLA_PLUGIN_LIBS)
@@ -215,8 +217,10 @@ BASE_FLAGS += -Wno-unused-variable
215217
# extra linker flags
216218

217219
ifeq ($(WASM),true)
220+
ifneq ($(STATIC_BUILD),true)
218221
LINK_FLAGS += --preload-file=./jsfx
219222
LINK_FLAGS += --preload-file=./lv2
223+
endif
220224
LINK_FLAGS += --preload-file=./resources
221225
LINK_FLAGS += -sALLOW_MEMORY_GROWTH
222226
LINK_FLAGS += -sINITIAL_MEMORY=64Mb
@@ -341,7 +345,12 @@ vst3: $(VST3_RESOURCES)
341345
# --------------------------------------------------------------
342346
# Extra rules for wasm resources
343347

344-
wasm_resources: $(CURDIR)/lv2 $(CURDIR)/resources
348+
WASM_RESOURCES = $(CURDIR)/resources
349+
ifneq ($(STATIC_BUILD),true)
350+
WASM_RESOURCES += $(CURDIR)/lv2
351+
endif
352+
353+
wasm_resources: $(WASM_RESOURCES)
345354

346355
$(CURDIR)/lv2: $(LV2_RESOURCES)
347356
$(shell wget https://falktx.com/data/wasm-things-2022-08-15.tar.gz && tar xf wasm-things-2022-08-15.tar.gz)

0 commit comments

Comments
 (0)