From bcbd1636113fe0b61c9536535f3734e547c61ac1 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Tue, 1 Oct 2024 12:52:39 +0200 Subject: [PATCH 1/2] List emscripten exported functions separately --- emscripten/buildToolkit | 47 +---------------------------------------- emscripten/exports.txt | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 emscripten/exports.txt diff --git a/emscripten/buildToolkit b/emscripten/buildToolkit index e3dc7dcf492..5ab3be25219 100755 --- a/emscripten/buildToolkit +++ b/emscripten/buildToolkit @@ -186,52 +186,7 @@ $cmake .= " -DNO_MUSICXML_SUPPORT=ON" if ($nomusicxml); my $embed = "--embed-file $DATA_DIR/"; my $output = "-o $BUILD_DIR/verovio.js"; -my $exports = "-s EXPORTED_FUNCTIONS=\"["; -$exports .= "'_enableLog',"; -$exports .= "'_enableLogToBuffer',"; -$exports .= "'_vrvToolkit_constructor',"; -$exports .= "'_vrvToolkit_destructor',"; -$exports .= "'_vrvToolkit_edit',"; -$exports .= "'_vrvToolkit_editInfo',"; -$exports .= "'_vrvToolkit_getAvailableOptions',"; -$exports .= "'_vrvToolkit_getDefaultOptions',"; -$exports .= "'_vrvToolkit_getDescriptiveFeatures',"; -$exports .= "'_vrvToolkit_getElementAttr',"; -$exports .= "'_vrvToolkit_getElementsAtTime',"; -$exports .= "'_vrvToolkit_getExpansionIdsForElement',"; -$exports .= "'_vrvToolkit_getHumdrum',"; -$exports .= "'_vrvToolkit_convertHumdrumToHumdrum',"; -$exports .= "'_vrvToolkit_convertHumdrumToMIDI',"; -$exports .= "'_vrvToolkit_convertMEIToHumdrum',"; -$exports .= "'_vrvToolkit_getLog',"; -$exports .= "'_vrvToolkit_getMEI',"; -$exports .= "'_vrvToolkit_getMIDIValuesForElement',"; -$exports .= "'_vrvToolkit_getNotatedIdForElement',"; -$exports .= "'_vrvToolkit_getOptions',"; -$exports .= "'_vrvToolkit_getPageCount',"; -$exports .= "'_vrvToolkit_getPageWithElement',"; -$exports .= "'_vrvToolkit_getTimeForElement',"; -$exports .= "'_vrvToolkit_getTimesForElement',"; -$exports .= "'_vrvToolkit_getVersion',"; -$exports .= "'_vrvToolkit_loadData',"; -$exports .= "'_vrvToolkit_loadZipDataBase64',"; -$exports .= "'_vrvToolkit_loadZipDataBuffer',"; -$exports .= "'_vrvToolkit_redoLayout',"; -$exports .= "'_vrvToolkit_redoPagePitchPosLayout',"; -$exports .= "'_vrvToolkit_renderData',"; -$exports .= "'_vrvToolkit_renderToExpansionMap',"; -$exports .= "'_vrvToolkit_renderToMIDI',"; -$exports .= "'_vrvToolkit_renderToPAE',"; -$exports .= "'_vrvToolkit_renderToSVG',"; -$exports .= "'_vrvToolkit_renderToTimemap',"; -$exports .= "'_vrvToolkit_resetOptions',"; -$exports .= "'_vrvToolkit_resetXmlIdSeed',"; -$exports .= "'_vrvToolkit_select',"; -$exports .= "'_vrvToolkit_setOptions',"; -$exports .= "'_vrvToolkit_validatePAE',"; -$exports .= "'_malloc',"; -$exports .= "'_free'"; -$exports .= "]\""; +my $exports = "-s EXPORTED_FUNCTIONS=\@exports.txt"; my $extra_exports = "-s EXPORTED_RUNTIME_METHODS='[\"cwrap\", \"HEAPU8\"]'"; diff --git a/emscripten/exports.txt b/emscripten/exports.txt new file mode 100644 index 00000000000..48f3977c61c --- /dev/null +++ b/emscripten/exports.txt @@ -0,0 +1,44 @@ +_enableLog +_enableLogToBuffer +_vrvToolkit_constructor +_vrvToolkit_destructor +_vrvToolkit_edit +_vrvToolkit_editInfo +_vrvToolkit_getAvailableOptions +_vrvToolkit_getDefaultOptions +_vrvToolkit_getDescriptiveFeatures +_vrvToolkit_getElementAttr +_vrvToolkit_getElementsAtTime +_vrvToolkit_getExpansionIdsForElement +_vrvToolkit_getHumdrum +_vrvToolkit_convertHumdrumToHumdrum +_vrvToolkit_convertHumdrumToMIDI +_vrvToolkit_convertMEIToHumdrum +_vrvToolkit_getLog +_vrvToolkit_getMEI +_vrvToolkit_getMIDIValuesForElement +_vrvToolkit_getNotatedIdForElement +_vrvToolkit_getOptions +_vrvToolkit_getPageCount +_vrvToolkit_getPageWithElement +_vrvToolkit_getTimeForElement +_vrvToolkit_getTimesForElement +_vrvToolkit_getVersion +_vrvToolkit_loadData +_vrvToolkit_loadZipDataBase64 +_vrvToolkit_loadZipDataBuffer +_vrvToolkit_redoLayout +_vrvToolkit_redoPagePitchPosLayout +_vrvToolkit_renderData +_vrvToolkit_renderToExpansionMap +_vrvToolkit_renderToMIDI +_vrvToolkit_renderToPAE +_vrvToolkit_renderToSVG +_vrvToolkit_renderToTimemap +_vrvToolkit_resetOptions +_vrvToolkit_resetXmlIdSeed +_vrvToolkit_select +_vrvToolkit_setOptions +_vrvToolkit_validatePAE +_malloc +_free \ No newline at end of file From efbb682d6d01eabba6fcda6afa4cebcdb4c1152c Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Tue, 1 Oct 2024 12:54:09 +0200 Subject: [PATCH 2/2] Add ALLOW_MEMORY_GROWTH to wasm build --- emscripten/buildToolkit | 1 + 1 file changed, 1 insertion(+) diff --git a/emscripten/buildToolkit b/emscripten/buildToolkit index 5ab3be25219..3a2f1304d96 100755 --- a/emscripten/buildToolkit +++ b/emscripten/buildToolkit @@ -122,6 +122,7 @@ if ($wasmQ) { $LFLAGS = " -s WASM=1"; $LFLAGS .= " -s INITIAL_MEMORY=512MB"; $LFLAGS .= " -s STACK_SIZE=256MB"; + $LFLAGS .= " -s ALLOW_MEMORY_GROWTH"; $LFLAGS .= " -s SINGLE_FILE=1"; $LFLAGS .= " -s INCOMING_MODULE_JS_API=onRuntimeInitialized"; if ($debug) {