Skip to content

Commit

Permalink
wasm C++ projects moved from packages/project-editor/flow/runtime/cpp…
Browse files Browse the repository at this point in the history
… to /wasm
  • Loading branch information
mvladic committed Dec 5, 2024
1 parent 492430b commit d792997
Show file tree
Hide file tree
Showing 57 changed files with 102 additions and 83 deletions.
17 changes: 4 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,16 @@ tools/freetype-tools/FreeType-Emscripten
bundle-meta.json
circular.txt

packages/project-editor/flow/runtime/cpp/eez-runtime/build
wasm/eez-runtime/build
!packages/project-editor/flow/runtime/eez_runtime.js
!packages/project-editor/flow/runtime/cpp/eez-runtime/platform/simulator/emscripten/pre.js
!packages/project-editor/flow/runtime/cpp/eez-runtime/platform/simulator/emscripten/post.js

packages/project-editor/flow/runtime/cpp/lvgl-runtime/build
!packages/project-editor/flow/runtime/cpp/lvgl-runtime/pre.js
!packages/project-editor/flow/runtime/cpp/lvgl-runtime/post.js

packages/project-editor/flow/runtime/cpp/lvgl-runtime/v8.3/build
wasm/lvgl-runtime/v8.3/build
!packages/project-editor/flow/runtime/lvgl_runtime_v8.3.js

packages/project-editor/flow/runtime/cpp/lvgl-runtime/v9.0/build
wasm/lvgl-runtime/v9.0/build
!packages/project-editor/flow/runtime/lvgl_runtime_v9.0.js

!packages/project-editor/flow/runtime/cpp/lvgl-runtime/common/pre.js
!packages/project-editor/flow/runtime/cpp/lvgl-runtime/common/post.js

packages/project-editor/flow/runtime/cpp/lz4/build
wasm/lz4/build
!packages/project-editor/flow/runtime/lz4.js

npm-module/packages
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[submodule "eez-framework"]
path = packages/project-editor/flow/runtime/cpp/eez-framework
path = wasm/eez-framework
url = https://github.com/eez-open/eez-framework
[submodule "lvgl-8.3"]
path = packages/project-editor/flow/runtime/cpp/lvgl-runtime/v8.3/lvgl
path = wasm/lvgl-runtime/v8.3/lvgl
url = https://github.com/littlevgl/lvgl.git
[submodule "lvgl-9.0"]
path = packages/project-editor/flow/runtime/cpp/lvgl-runtime/v9.0/lvgl
path = wasm/lvgl-runtime/v9.0/lvgl
url = https://github.com/lvgl/lvgl.git
branch = release/v9.0
2 changes: 1 addition & 1 deletion packages/project-editor/flow/runtime/eez_runtime.js

Large diffs are not rendered by default.

Binary file modified packages/project-editor/flow/runtime/eez_runtime.wasm
Binary file not shown.
42 changes: 21 additions & 21 deletions packages/project-editor/flow/runtime/lvgl_runtime_v8.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,25 +969,25 @@ function dbg(text) {
// === Body ===

var ASM_CONSTS = {
1036832: ($0) => { startToDebuggerMessage($0); },
1036864: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1036939: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1037014: ($0) => { finishToDebuggerMessage($0); },
1037047: ($0, $1) => { return getLvglScreenByName($0, UTF8ToString($1)); },
1037101: ($0, $1) => { return getLvglObjectByName($0, UTF8ToString($1)); },
1037155: ($0, $1) => { return getLvglGroupByName($0, UTF8ToString($1)); },
1037208: ($0, $1) => { return getLvglStyleByName($0, UTF8ToString($1)); },
1037261: ($0, $1) => { return getLvglImageByName($0, UTF8ToString($1)); },
1037314: ($0, $1, $2) => { lvglObjAddStyle($0, $1, $2); },
1037347: ($0, $1, $2) => { lvglObjRemoveStyle($0, $1, $2); },
1037383: ($0, $1) => { lvglSetColorTheme($0, UTF8ToString($1)); },
1037428: ($0, $1, $2, $3, $4, $5) => { return eez_mqtt_init($0, UTF8ToString($1), UTF8ToString($2), $3, UTF8ToString($4), UTF8ToString($5)); },
1037534: ($0, $1) => { return eez_mqtt_deinit($0, $1); },
1037570: ($0, $1) => { return eez_mqtt_connect($0, $1); },
1037607: ($0, $1) => { return eez_mqtt_disconnect($0, $1); },
1037647: ($0, $1, $2) => { return eez_mqtt_subscribe($0, $1, UTF8ToString($2)); },
1037704: ($0, $1, $2) => { return eez_mqtt_unsubscribe($0, $1, UTF8ToString($2)); },
1037763: ($0, $1, $2, $3) => { return eez_mqtt_publish($0, $1, UTF8ToString($2), UTF8ToString($3)); }
1034880: ($0) => { startToDebuggerMessage($0); },
1034912: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1034987: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1035062: ($0) => { finishToDebuggerMessage($0); },
1035095: ($0, $1) => { return getLvglScreenByName($0, UTF8ToString($1)); },
1035149: ($0, $1) => { return getLvglObjectByName($0, UTF8ToString($1)); },
1035203: ($0, $1) => { return getLvglGroupByName($0, UTF8ToString($1)); },
1035256: ($0, $1) => { return getLvglStyleByName($0, UTF8ToString($1)); },
1035309: ($0, $1) => { return getLvglImageByName($0, UTF8ToString($1)); },
1035362: ($0, $1, $2) => { lvglObjAddStyle($0, $1, $2); },
1035395: ($0, $1, $2) => { lvglObjRemoveStyle($0, $1, $2); },
1035431: ($0, $1) => { lvglSetColorTheme($0, UTF8ToString($1)); },
1035476: ($0, $1, $2, $3, $4, $5) => { return eez_mqtt_init($0, UTF8ToString($1), UTF8ToString($2), $3, UTF8ToString($4), UTF8ToString($5)); },
1035582: ($0, $1) => { return eez_mqtt_deinit($0, $1); },
1035618: ($0, $1) => { return eez_mqtt_connect($0, $1); },
1035655: ($0, $1) => { return eez_mqtt_disconnect($0, $1); },
1035695: ($0, $1, $2) => { return eez_mqtt_subscribe($0, $1, UTF8ToString($2)); },
1035752: ($0, $1, $2) => { return eez_mqtt_unsubscribe($0, $1, UTF8ToString($2)); },
1035811: ($0, $1, $2, $3) => { return eez_mqtt_publish($0, $1, UTF8ToString($2), UTF8ToString($3)); }
};


Expand Down Expand Up @@ -5278,7 +5278,7 @@ run();


// end include: postamble.js
// include: /mnt/c/work/eez/studio/packages/project-editor/flow/runtime/cpp/lvgl-runtime/common/post.js
// include: /mnt/c/work/eez/studio/wasm/lvgl-runtime/common/post.js
}

// end include: /mnt/c/work/eez/studio/packages/project-editor/flow/runtime/cpp/lvgl-runtime/common/post.js
// end include: /mnt/c/work/eez/studio/wasm/lvgl-runtime/common/post.js
Binary file modified packages/project-editor/flow/runtime/lvgl_runtime_v8.3.wasm
Binary file not shown.
42 changes: 21 additions & 21 deletions packages/project-editor/flow/runtime/lvgl_runtime_v9.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,25 +969,25 @@ function dbg(text) {
// === Body ===

var ASM_CONSTS = {
1031680: ($0) => { startToDebuggerMessage($0); },
1031712: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1031787: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1031862: ($0) => { finishToDebuggerMessage($0); },
1031895: ($0, $1) => { return getLvglScreenByName($0, UTF8ToString($1)); },
1031949: ($0, $1) => { return getLvglObjectByName($0, UTF8ToString($1)); },
1032003: ($0, $1) => { return getLvglGroupByName($0, UTF8ToString($1)); },
1032056: ($0, $1) => { return getLvglStyleByName($0, UTF8ToString($1)); },
1032109: ($0, $1) => { return getLvglImageByName($0, UTF8ToString($1)); },
1032162: ($0, $1, $2) => { lvglObjAddStyle($0, $1, $2); },
1032195: ($0, $1, $2) => { lvglObjRemoveStyle($0, $1, $2); },
1032231: ($0, $1) => { lvglSetColorTheme($0, UTF8ToString($1)); },
1032276: ($0, $1, $2, $3, $4, $5) => { return eez_mqtt_init($0, UTF8ToString($1), UTF8ToString($2), $3, UTF8ToString($4), UTF8ToString($5)); },
1032382: ($0, $1) => { return eez_mqtt_deinit($0, $1); },
1032418: ($0, $1) => { return eez_mqtt_connect($0, $1); },
1032455: ($0, $1) => { return eez_mqtt_disconnect($0, $1); },
1032495: ($0, $1, $2) => { return eez_mqtt_subscribe($0, $1, UTF8ToString($2)); },
1032552: ($0, $1, $2) => { return eez_mqtt_unsubscribe($0, $1, UTF8ToString($2)); },
1032611: ($0, $1, $2, $3) => { return eez_mqtt_publish($0, $1, UTF8ToString($2), UTF8ToString($3)); }
1029552: ($0) => { startToDebuggerMessage($0); },
1029584: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1029659: ($0, $1, $2) => { writeDebuggerBuffer($0, new Uint8Array(Module.HEAPU8.buffer, $1, $2)); },
1029734: ($0) => { finishToDebuggerMessage($0); },
1029767: ($0, $1) => { return getLvglScreenByName($0, UTF8ToString($1)); },
1029821: ($0, $1) => { return getLvglObjectByName($0, UTF8ToString($1)); },
1029875: ($0, $1) => { return getLvglGroupByName($0, UTF8ToString($1)); },
1029928: ($0, $1) => { return getLvglStyleByName($0, UTF8ToString($1)); },
1029981: ($0, $1) => { return getLvglImageByName($0, UTF8ToString($1)); },
1030034: ($0, $1, $2) => { lvglObjAddStyle($0, $1, $2); },
1030067: ($0, $1, $2) => { lvglObjRemoveStyle($0, $1, $2); },
1030103: ($0, $1) => { lvglSetColorTheme($0, UTF8ToString($1)); },
1030148: ($0, $1, $2, $3, $4, $5) => { return eez_mqtt_init($0, UTF8ToString($1), UTF8ToString($2), $3, UTF8ToString($4), UTF8ToString($5)); },
1030254: ($0, $1) => { return eez_mqtt_deinit($0, $1); },
1030290: ($0, $1) => { return eez_mqtt_connect($0, $1); },
1030327: ($0, $1) => { return eez_mqtt_disconnect($0, $1); },
1030367: ($0, $1, $2) => { return eez_mqtt_subscribe($0, $1, UTF8ToString($2)); },
1030424: ($0, $1, $2) => { return eez_mqtt_unsubscribe($0, $1, UTF8ToString($2)); },
1030483: ($0, $1, $2, $3) => { return eez_mqtt_publish($0, $1, UTF8ToString($2), UTF8ToString($3)); }
};


Expand Down Expand Up @@ -5278,7 +5278,7 @@ run();


// end include: postamble.js
// include: /mnt/c/work/eez/studio/packages/project-editor/flow/runtime/cpp/lvgl-runtime/common/post.js
// include: /mnt/c/work/eez/studio/wasm/lvgl-runtime/common/post.js
}

// end include: /mnt/c/work/eez/studio/packages/project-editor/flow/runtime/cpp/lvgl-runtime/common/post.js
// end include: /mnt/c/work/eez/studio/wasm/lvgl-runtime/common/post.js
Binary file modified packages/project-editor/flow/runtime/lvgl_runtime_v9.0.wasm
Binary file not shown.
Binary file modified packages/project-editor/flow/runtime/lz4.wasm
Binary file not shown.
5 changes: 5 additions & 0 deletions wasm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This folder contains C++ projects that are build using Emscripten to create WASM libraries for:

- flow runtime engine for the Dashboard and EEZ-GUI projects (eez-runtime)
- flow runtime engine for the LVGL (lvgl-runtime, for varius versions)
- LZ4 compression used by the Studio
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ target_link_libraries(eez_runtime

add_custom_command(TARGET eez_runtime POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/eez_runtime.js"
"${PROJECT_SOURCE_DIR}/../..")
"${PROJECT_SOURCE_DIR}/build/eez_runtime.js"
"${PROJECT_SOURCE_DIR}/../../packages/project-editor/flow/runtime")

add_custom_command(TARGET eez_runtime POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/eez_runtime.js"
"${PROJECT_SOURCE_DIR}/../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/build/eez_runtime.js"
"${PROJECT_SOURCE_DIR}/../../build/project-editor/flow/runtime")

add_custom_command(TARGET eez_runtime POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/eez_runtime.wasm"
"${PROJECT_SOURCE_DIR}/../..")
"${PROJECT_SOURCE_DIR}/build/eez_runtime.wasm"
"${PROJECT_SOURCE_DIR}/../../packages/project-editor/flow/runtime")

add_custom_command(TARGET eez_runtime POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/eez_runtime.wasm"
"${PROJECT_SOURCE_DIR}/../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/build/eez_runtime.wasm"
"${PROJECT_SOURCE_DIR}/../../build/project-editor/flow/runtime")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ target_link_libraries(lvgl_runtime_v8.3
add_custom_command(TARGET lvgl_runtime_v8.3 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v8.3.js"
"${PROJECT_SOURCE_DIR}/../../..")
"${PROJECT_SOURCE_DIR}/../../../packages/project-editor/flow/runtime")

add_custom_command(TARGET lvgl_runtime_v8.3 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v8.3.js"
"${PROJECT_SOURCE_DIR}/../../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/../../../build/project-editor/flow/runtime")

add_custom_command(TARGET lvgl_runtime_v8.3 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v8.3.wasm"
"${PROJECT_SOURCE_DIR}/../../..")
"${PROJECT_SOURCE_DIR}/../../../packages/project-editor/flow/runtime")

add_custom_command(TARGET lvgl_runtime_v8.3 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v8.3.wasm"
"${PROJECT_SOURCE_DIR}/../../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/../../../build/project-editor/flow/runtime")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ target_link_libraries(lvgl_runtime_v9.0
add_custom_command(TARGET lvgl_runtime_v9.0 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v9.0.js"
"${PROJECT_SOURCE_DIR}/../../..")
"${PROJECT_SOURCE_DIR}/../../../packages/project-editor/flow/runtime")

add_custom_command(TARGET lvgl_runtime_v9.0 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v9.0.js"
"${PROJECT_SOURCE_DIR}/../../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/../../../build/project-editor/flow/runtime")

add_custom_command(TARGET lvgl_runtime_v9.0 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v9.0.wasm"
"${PROJECT_SOURCE_DIR}/../../..")
"${PROJECT_SOURCE_DIR}/../../../packages/project-editor/flow/runtime")

add_custom_command(TARGET lvgl_runtime_v9.0 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/lvgl_runtime_v9.0.wasm"
"${PROJECT_SOURCE_DIR}/../../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/../../../build/project-editor/flow/runtime")
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ add_executable(lz4 ${src_files} ${header_files})

add_custom_command(TARGET lz4 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/lz4.js"
"${PROJECT_SOURCE_DIR}/../..")
"${PROJECT_SOURCE_DIR}/build/lz4.js"
"${PROJECT_SOURCE_DIR}/../../packages/project-editor/flow/runtime")

add_custom_command(TARGET lz4 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/lz4.js"
"${PROJECT_SOURCE_DIR}/../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/build/lz4.js"
"${PROJECT_SOURCE_DIR}/../../build/project-editor/flow/runtime")

add_custom_command(TARGET lz4 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/lz4.wasm"
"${PROJECT_SOURCE_DIR}/../..")
"${PROJECT_SOURCE_DIR}/build/lz4.wasm"
"${PROJECT_SOURCE_DIR}/../../packages/project-editor/flow/runtime")

add_custom_command(TARGET lz4 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/lz4.wasm"
"${PROJECT_SOURCE_DIR}/../../../../../../build/project-editor/flow/runtime")
"${PROJECT_SOURCE_DIR}/build/lz4.wasm"
"${PROJECT_SOURCE_DIR}/../../build/project-editor/flow/runtime")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions wasm/lz4/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
}
22 changes: 22 additions & 0 deletions wasm/lz4/pre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module["exports"] = function (onRuntimeInitialized) {
var Module = {};

Module.onRuntimeInitialized = function () {
onRuntimeInitialized();
}

Module.print = function (args) {
console.log("From LZ4:", args);
};

Module.printErr = function (args) {
console.error("From LZ4:", args);
};

runWasmModule(Module);

return Module;
}

function runWasmModule(Module) {

0 comments on commit d792997

Please sign in to comment.