Skip to content

Commit

Permalink
wamr:remove CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY
Browse files Browse the repository at this point in the history
  • Loading branch information
yangkun27 authored and xiaoxiang781216 committed Dec 28, 2024
1 parent 43b1c89 commit 6c785d2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 30 deletions.
26 changes: 16 additions & 10 deletions interpreters/wamr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,23 @@ if(CONFIG_INTERPRETERS_WAMR)
DEPENDS
wamr)

if(CONFIG_INTERPRETERS_WAMR_LIBC_NUTTX
OR CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY)
nuttx_append_source_file_properties(
${WAMR_DIR}/product-mini/platforms/nuttx/main.c COMPILE_FLAGS
-Dwasm_runtime_full_init=wamr_custom_init)
target_sources(wamr PRIVATE wamr_custom_init.c)
endif()
nuttx_append_source_file_properties(
${WAMR_DIR}/product-mini/platforms/nuttx/main.c COMPILE_FLAGS
-Dwasm_runtime_full_init=wamr_custom_init)
target_sources(wamr PRIVATE wamr_custom_init.c)

set(WAMR_MODULE_LIST ${CMAKE_BINARY_DIR}/wamrmod/wamr_external_module_list.h)
set(WAMR_MODULE_PROTO
${CMAKE_BINARY_DIR}/wamrmod/wamr_external_module_proto.h)

add_custom_target(
wamr_module_gen
COMMAND ${CMAKE_COMMAND} -E touch ${WAMR_MODULE_LIST}
COMMAND ${CMAKE_COMMAND} -E touch ${WAMR_MODULE_PROTO})

nuttx_add_dependencies(TARGET wamr DEPENDS wamr_module_gen)

# Add ${CMAKE_BINARY_DIR}/wamrmod to the include directories
if(CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY)
target_include_directories(wamr PRIVATE ${CMAKE_BINARY_DIR}/wamrmod)
endif()
target_include_directories(wamr PRIVATE ${CMAKE_BINARY_DIR}/wamrmod)

endif()
8 changes: 0 additions & 8 deletions interpreters/wamr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,4 @@ config INTERPRETERS_WAMR_CONFIGUABLE_BOUNDS_CHECKS
disable bounds checks passing --disable-bounds-checks to
iwasm.

config INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY
bool "Enable external module registry"
default n
---help---
This option enables the support for loading WASM modules from
external libraries, which is useful when you want to extend the
functionality of WAMR without modifying its source code.

endif
6 changes: 1 addition & 5 deletions interpreters/wamr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ WAMR_NEED_CUSTOM_INIT = n

# Check if we need to build custom init code

ifeq ($(CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY),y)
WAMR_NEED_CUSTOM_INIT = y
endif

# If we need custom init code, add it to the build
ifeq ($(WAMR_NEED_CUSTOM_INIT),y)
Expand All @@ -70,8 +68,6 @@ $(WAMR_UNPACK): $(WAMR_TARBALL)

# Register the external WAMR module

ifeq ($(CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY),y)

PDATLIST = $(strip $(call RWILDCARD, registry, *.pdat))
BDATLIST = $(strip $(call RWILDCARD, registry, *.bdat))

Expand All @@ -95,7 +91,6 @@ else
endif

depend:: $(GLUECSRCS) wamr_external_module_list.h wamr_external_module_proto.h
endif # CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY

clean::
$(call DELFILE, wamr_external_module_list.h)
Expand All @@ -104,6 +99,7 @@ clean::
clean_context::
$(call DELFILE, $(BDATLIST))
$(call DELFILE, $(PDATLIST))
$(call DELFILE, registry$(DELIM).updated)

# Download and unpack tarball if no git repo found
ifeq ($(wildcard $(WAMR_UNPACK)/.git),)
Expand Down
7 changes: 0 additions & 7 deletions interpreters/wamr/wamr_custom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,18 @@
#include <iconv.h>

#include "wasm_native.h"

#ifdef CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY
#include "wamr_external_module_proto.h"
#endif

/****************************************************************************
* Private Data
****************************************************************************/

typedef bool (*module_register_t)(void);

#ifdef CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY
static const module_register_t g_wamr_modules[] =
{
#include "wamr_external_module_list.h"
};
#endif

/****************************************************************************
* Public Functions
Expand All @@ -65,7 +60,6 @@ bool wamr_custom_init(RuntimeInitArgs *init_args)

/* Add extra init hook here */

#ifdef CONFIG_INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY
for (int i = 0; i < nitems(g_wamr_modules); i++)
{
ret = g_wamr_modules[i]();
Expand All @@ -74,7 +68,6 @@ bool wamr_custom_init(RuntimeInitArgs *init_args)
return ret;
}
}
#endif

return ret;
}

0 comments on commit 6c785d2

Please sign in to comment.