cmake(bugfix):fix NuttX CMake Wasm build multi dirs cannot be identified

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 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2024-12-18 11:39:38 +08:00 committed by Xiang Xiao
parent 0b0a220c52
commit add50b3bd5
3 changed files with 10 additions and 1 deletions

View file

@ -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)

View file

@ -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})

View file

@ -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.")