Skip to content

Commit

Permalink
cmake(bugfix):fix NuttX CMake Wasm build multi dirs cannot be identified
Browse files Browse the repository at this point in the history
System is unknown to cmake, create:
Platform/WASI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please post that file on discourse.cmake.org.
CMake Error at CMakeLists.txt:100 (add_subdirectory):
  add_subdirectory given source
  /home/data/vela/tmp/apps/frameworks/security/ta/hello_world
  /home/data/vela/tmp/apps/frameworks/security/ta/" which is not an
  existing directory.

Signed-off-by: xuxin19 <[email protected]>
  • Loading branch information
xuxin930 committed Jan 23, 2025
1 parent cb290df commit 6315a35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if(CONFIG_TOOLS_WASM_BUILD OR CONFIG_INTERPRETERS_WAMR_BUILD_MODULES_FOR_NUTTX)
${CMAKE_COMMAND} -B${CMAKE_BINARY_DIR}/Wasm
${CMAKE_CURRENT_SOURCE_DIR}/Wasm -DAPPDIR=${APPDIR} -DTOPDIR=${TOPDIR}
-DTOPBINDIR=${CMAKE_BINARY_DIR} -DKCONFIG_FILE_PATH=${KCONFIG_FILE_PATH}
-DWASI_SDK_PATH=$ENV{WASI_SDK_PATH} -DWASM_DIRS=${WASM_DIRS})
-DWASI_SDK_PATH=$ENV{WASI_SDK_PATH} -DWASM_DIRS="${WASM_DIRS}")

add_custom_target(wasm_build COMMAND ${CMAKE_COMMAND} --build
${CMAKE_BINARY_DIR}/Wasm)
Expand Down
2 changes: 2 additions & 0 deletions tools/Wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ function(nuttx_add_library)

endfunction()

separate_arguments(WASM_DIRS)

# ~~~
# Add all the Wasm apps to the build process.
foreach(WASM_APP ${WASM_DIRS})
Expand Down
7 changes: 7 additions & 0 deletions tools/Wasm/WASI-SDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,13 @@ function(wasm_add_library)
message(FATAL_ERROR "NAME is not provided.")
endif()

# Check if the LIB_NAME (NAME) is already declared If it is, then skip the
# rest of the function
if(TARGET ${LIB_NAME})
message(STATUS "Target ${LIB_NAME} already declared.")
return()
endif()

# Check if the LIB_SRCS (SRCS) is provided
if(NOT LIB_SRCS)
message(FATAL_ERROR "SRCS is not provided.")
Expand Down

0 comments on commit 6315a35

Please sign in to comment.