Skip to content

Commit

Permalink
add eez-framework as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Mar 5, 2022
1 parent 4d7eb22 commit 690eaa2
Show file tree
Hide file tree
Showing 29 changed files with 6,793 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ bundle-meta.json
circular.txt

!resources/project-templates/*.eez-project-ui-state

packages/project-editor/flow/runtime/cpp/build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".\\packages\\project-editor\\flow\\runtime\\cpp\\eez"]
path = .\\packages\\project-editor\\flow\\runtime\\cpp\\eez
url = https://github.com/eez-open/eez-framework
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
},
"typescript.tsdk": "node_modules\\typescript\\lib",
"workbench.editor.enablePreview": false,
"editor.formatOnSave": true
"editor.formatOnSave": true,
"C_Cpp.formatting": "Disabled"
}
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
"scripts": {
"postinstall": "electron-builder install-app-deps",
"start": "electron --trace-warnings .",
"build": "npm run build-src && npm run build-css && npm run build-dark-css && npm run make-electron-builder-yml",
"build": "npm run build-src && npm run build-css && npm run build-dark-css && npm run build-flow-runtime && npm run make-electron-builder-yml",
"build-src": "tsc && node node_modules/gulp-cli/bin/gulp.js release",
"build-css": "node node_modules/less/bin/lessc --clean-css packages/eez-studio-ui/_stylesheets/main.less build/eez-studio-ui/_stylesheets/main.css",
"build-dark-css": "node node_modules/less/bin/lessc packages/eez-studio-ui/_stylesheets/main-dark.less build/eez-studio-ui/_stylesheets/main-dark.css",
"build-flow-runtime": "cp packages/project-editor/flow/runtime/flow_runtime.* build/project-editor/flow/runtime",
"make-electron-builder-yml": "cd installation && tsc && cd .. && node installation/make-electron-builder-yml.js",
"watch-all": "concurrently \"npm run watch\" \"npm run watch-less\"",
"watch": "node node_modules/gulp-cli/bin/gulp.js debug && tsc --project tsconfig.dev.json",
Expand Down Expand Up @@ -97,6 +98,7 @@
"@electron/remote": "^2.0.4",
"@emotion/css": "^11.7.1",
"@popperjs/core": "^2.9.2",
"@types/emscripten": "^1.39.6",
"app-module-path": "^2.2.0",
"archiver": "^2.1.1",
"better-sqlite3": "^7.5.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/eez-studio-shared/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ declare class GoldenLayout {
}

declare module "xml-formatter";

declare const WasmFlowRuntime: {
HEAPU8: Uint8Array;
_malloc(size: number): number;
_free(ptr: number): void;

_mainLoop();
_getSyncedBuffer(): number;
_onMouseWheelEvent(wheelDeltaY: number, wheelClicked: number);
_onPointerEvent(x: number, y: number, pressed: number);
_loadAssets(assets: number, assetsSize: number);
};
2 changes: 1 addition & 1 deletion packages/eez-studio-ui/_stylesheets/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -4364,7 +4364,7 @@ button.EezStudio_Action {
flex-direction: row;

&:not(.empty) {
padding: 3px;
padding: 3px 0;
}

.inputs,
Expand Down
4 changes: 3 additions & 1 deletion packages/project-editor/core/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2992,10 +2992,12 @@ export class DocumentStoreClass {
}

setRuntimeMode(isDebuggerActive: boolean) {
let runtime: RuntimeBase | undefined;
let runtime: RuntimeBase;

if (this.project.isDashboardProject) {
runtime = new ProjectEditor.LocalRuntimeClass(this);
} else if (this.project.isFirmwareWithFlowSupportProject) {
runtime = new ProjectEditor.WasmRuntimeClass(this);
} else {
runtime = new ProjectEditor.RemoteRuntimeClass(this);
}
Expand Down
8 changes: 8 additions & 0 deletions packages/project-editor/features/page/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,14 @@ export class Page extends Flow {
}

renderComponents(flowContext: IFlowContext) {
if (
flowContext.DocumentStore.runtime &&
flowContext.DocumentStore.runtime instanceof
ProjectEditor.WasmRuntimeClass
) {
return flowContext.DocumentStore.runtime.renderPage();
}

return (
<>
<ComponentEnclosure
Expand Down
103 changes: 103 additions & 0 deletions packages/project-editor/flow/runtime/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
cmake_minimum_required(VERSION 3.10)

project(flow_runtime)

set (CMAKE_CXX_STANDARD 17)

#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-const-variable -Wno-nested-anon-types -Wno-dollar-in-identifier-extension -O2 --no-entry")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -s DEMANGLE_SUPPORT=1 -s FORCE_FILESYSTEM=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=83886080 -s LLD_REPORT_UNDEFINED --bind -lidbfs.js --pre-js ${PROJECT_SOURCE_DIR}/src/platform/simulator/emscripten/pre.js")
add_definitions(-DEMCC_DEBUG)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -pedantic")

add_definitions(-DEEZ_PLATFORM_SIMULATOR)
add_definitions(-DEEZ_PLATFORM_SIMULATOR_UNIX)
add_definitions(-DEEZ_PLATFORM_SIMULATOR_EMSCRIPTEN)

include_directories(
./
./eez/libs/agg
./eez/platform/simulator
./src/conf
)


set(src_files)
set(header_files)


################################################################################
# EEZ Framework files
file(GLOB_RECURSE src_eez
eez/*.cpp
eez/*.c
)
file(GLOB_RECURSE header_eez
eez/*.h
)

# exclude STM32 platform specific files
set (EXCLUDE_DIR "eez/platform/stm32")
foreach (TMP_PATH ${src_eez})
string (FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND)
if (NOT ${EXCLUDE_DIR_FOUND} EQUAL -1)
list (REMOVE_ITEM src_eez ${TMP_PATH})
endif ()
endforeach(TMP_PATH)
foreach (TMP_PATH ${header_eez})
string (FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND)
if (NOT ${EXCLUDE_DIR_FOUND} EQUAL -1)
list (REMOVE_ITEM header_eez ${TMP_PATH})
endif ()
endforeach(TMP_PATH)

# exclude libscpi
set (EXCLUDE_DIR "eez/libs/libscpi")
foreach (TMP_PATH ${src_eez})
string (FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND)
if (NOT ${EXCLUDE_DIR_FOUND} EQUAL -1)
list (REMOVE_ITEM src_eez ${TMP_PATH})
endif ()
endforeach(TMP_PATH)
foreach (TMP_PATH ${header_eez})
string (FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND)
if (NOT ${EXCLUDE_DIR_FOUND} EQUAL -1)
list (REMOVE_ITEM header_eez ${TMP_PATH})
endif ()
endforeach(TMP_PATH)

list (APPEND src_files ${src_eez})
list (APPEND header_files ${header_eez})

################################################################################


################################################################################
file(GLOB_RECURSE src_flow_runtime
src/*.cpp
src/*.c
)
file(GLOB_RECURSE header_flow_runtime
src/*.h
)

list (APPEND src_files ${src_flow_runtime})
list (APPEND header_files ${header_flow_runtime})

################################################################################

add_executable(flow_runtime ${src_files} ${header_files})

if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
add_custom_command(TARGET flow_runtime POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/flow_runtime.js"
"${PROJECT_SOURCE_DIR}/..")

add_custom_command(TARGET flow_runtime POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/build/emscripten/flow_runtime.wasm"
"${PROJECT_SOURCE_DIR}/..")
endif()
Loading

0 comments on commit 690eaa2

Please sign in to comment.