Skip to content

Commit b2029e8

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

File tree

3 files changed

+95
-3
lines changed

3 files changed

+95
-3
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:

plugins/Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,9 +1134,14 @@ clean:
11341134

11351135
ifeq ($(NOPLUGINS),true)
11361136
PLUGIN_LIST = Cardinal Fundamental
1137+
1138+
RESOURCE_FILES = \
1139+
$(wildcard Cardinal/res/*.svg) \
1140+
$(wildcard Fundamental/res/*.svg) \
1141+
$(wildcard Fundamental/res/components/*.svg) \
1142+
Fundamental/presets
11371143
else
11381144
PLUGIN_LIST = $(subst /plugin.json,,$(wildcard */plugin.json))
1139-
endif
11401145

11411146
UNWANTED_FILES = HetrickCV/res/illustrator - deprecated/MyModule.svg
11421147
UNWANTED_FILES += $(wildcard Meander/res/*)
@@ -1163,7 +1168,6 @@ RESOURCE_FILES += BaconPlugs/res/Keypunch029.json
11631168
RESOURCE_FILES += BaconPlugs/res/midi/chopin
11641169
RESOURCE_FILES += BaconPlugs/res/midi/debussy
11651170
RESOURCE_FILES += BaconPlugs/res/midi/goldberg
1166-
RESOURCE_FILES += Cardinal/res/Miku/Miku.png
11671171
RESOURCE_FILES += cf/playeroscs
11681172
RESOURCE_FILES += DrumKit/res/samples
11691173
RESOURCE_FILES += MindMeldModular/res/ShapeMaster/CommunityPresets
@@ -1178,14 +1182,20 @@ RESOURCE_FILES += $(wildcard unless_modules/art/*.art)
11781182
RESOURCE_FILES += $(wildcard unless_modules/art/svg/*/*.svg)
11791183
RESOURCE_FILES += $(wildcard unless_modules/font/*.ttf)
11801184
# RESOURCE_FILES += $(wildcard unless_modules/manual/*)
1185+
endif
1186+
1187+
RESOURCE_FILES += Cardinal/res/Miku/Miku.png
11811188

11821189
# MOD builds only have LV2 FX variant for now
11831190
ifeq ($(MOD_BUILD),true)
1191+
11841192
LV2_RESOURCES = $(PLUGIN_LIST:%=../bin/Cardinal.lv2/resources/PluginManifests/%.json)
11851193
LV2_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/PluginManifests/%.json)
11861194
LV2_RESOURCES += $(RESOURCE_FILES:%=../bin/Cardinal.lv2/resources/%)
11871195
LV2_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.lv2/resources/%)
1196+
11881197
else
1198+
11891199
LV2_RESOURCES = $(PLUGIN_LIST:%=../bin/Cardinal.lv2/resources/PluginManifests/%.json)
11901200
LV2_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/PluginManifests/%.json)
11911201
LV2_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalSynth.lv2/resources/PluginManifests/%.json)
@@ -1209,6 +1219,7 @@ VST3_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalSynth.vst3/Contents/Resources/P
12091219
VST3_RESOURCES += $(RESOURCE_FILES:%=../bin/Cardinal.vst3/Contents/Resources/%)
12101220
VST3_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalFX.vst3/Contents/Resources/%)
12111221
VST3_RESOURCES += $(RESOURCE_FILES:%=../bin/CardinalSynth.vst3/Contents/Resources/%)
1222+
12121223
endif
12131224

12141225
resources: $(LV2_RESOURCES) $(VST2_RESOURCES) $(VST3_RESOURCES)

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)