Enable WASI feature, enhance security and add SGX sample (#142)
Change emcc to clang Refine interpreter to improve perforamnce
This commit is contained in:
@ -5,7 +5,10 @@ set (WASM_LIB_GUI_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
set (THIRD_PARTY_DIR ${WASM_LIB_GUI_DIR}/../../../3rdparty)
|
||||
|
||||
include_directories(${WASM_LIB_GUI_DIR} ${THIRD_PARTY_DIR} ${THIRD_PARTY_DIR}/lvgl)
|
||||
include_directories(${WASM_LIB_GUI_DIR}
|
||||
${THIRD_PARTY_DIR}
|
||||
${THIRD_PARTY_DIR}/lvgl
|
||||
${THIRD_PARTY_DIR}/lvgl/src)
|
||||
|
||||
file (GLOB_RECURSE lvgl_source ${THIRD_PARTY_DIR}/lvgl/*.c)
|
||||
file (GLOB_RECURSE wrapper_source ${WASM_LIB_GUI_DIR}/*.c)
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "lvgl.h"
|
||||
#include "module_wasm_app.h"
|
||||
#include "wgl_native_utils.h"
|
||||
#include "bh_assert.h"
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* List widget native function wrappers
|
||||
@ -24,16 +25,17 @@ lv_list_add_btn_wrapper(wasm_module_inst_t module_inst,
|
||||
{
|
||||
uint32 btn_obj_id;
|
||||
lv_obj_t *btn;
|
||||
uint32 mod_id;
|
||||
|
||||
btn = lv_list_add_btn(list, NULL, text);
|
||||
|
||||
if (btn == NULL)
|
||||
return 0;
|
||||
|
||||
if (wgl_native_add_object(btn,
|
||||
app_manager_get_module_id(Module_WASM_App,
|
||||
module_inst),
|
||||
&btn_obj_id))
|
||||
mod_id = app_manager_get_module_id(Module_WASM_App, module_inst);
|
||||
bh_assert(mod_id != ID_NONE);
|
||||
|
||||
if (wgl_native_add_object(btn, mod_id, &btn_obj_id))
|
||||
return btn_obj_id; /* success return */
|
||||
|
||||
return 0;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "lvgl.h"
|
||||
#include "module_wasm_app.h"
|
||||
#include "wasm_export.h"
|
||||
#include "wasm_assert.h"
|
||||
#include "bh_assert.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -17,7 +17,8 @@ uint32 wgl_native_wigdet_create(int8 widget_type, lv_obj_t *par, lv_obj_t *copy,
|
||||
wasm_module_inst_t module_inst)
|
||||
{
|
||||
uint32 obj_id;
|
||||
lv_obj_t *wigdet;
|
||||
lv_obj_t *wigdet = NULL;
|
||||
uint32 mod_id;
|
||||
|
||||
//TODO: limit total widget number
|
||||
|
||||
@ -38,10 +39,10 @@ uint32 wgl_native_wigdet_create(int8 widget_type, lv_obj_t *par, lv_obj_t *copy,
|
||||
if (wigdet == NULL)
|
||||
return 0;
|
||||
|
||||
if (wgl_native_add_object(wigdet,
|
||||
app_manager_get_module_id(Module_WASM_App,
|
||||
module_inst),
|
||||
&obj_id))
|
||||
mod_id = app_manager_get_module_id(Module_WASM_App, module_inst);
|
||||
bh_assert(mod_id != ID_NONE);
|
||||
|
||||
if (wgl_native_add_object(wigdet, mod_id, &obj_id))
|
||||
return obj_id; /* success return */
|
||||
|
||||
return 0;
|
||||
@ -49,7 +50,7 @@ uint32 wgl_native_wigdet_create(int8 widget_type, lv_obj_t *par, lv_obj_t *copy,
|
||||
|
||||
static void invokeNative(intptr_t argv[], uint32 argc, void (*native_code)())
|
||||
{
|
||||
wasm_assert(argc >= 1);
|
||||
bh_assert(argc >= 1);
|
||||
|
||||
switch(argc) {
|
||||
case 1:
|
||||
|
||||
@ -50,7 +50,10 @@ static void app_mgr_object_event_callback(module_data *m_data, bh_message_t msg)
|
||||
return;
|
||||
|
||||
func_on_object_event = wasm_runtime_lookup_function(inst, "_on_widget_event",
|
||||
"(i32i32)");
|
||||
"(i32i32)");
|
||||
if (!func_on_object_event)
|
||||
func_on_object_event = wasm_runtime_lookup_function(inst, "on_widget_event",
|
||||
"(i32i32)");
|
||||
if (!func_on_object_event) {
|
||||
printf("Cannot find function _on_object_event\n");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user