From 683f25af15524856122759c2dc56163e4b917d21 Mon Sep 17 00:00:00 2001 From: xuxin19 Date: Fri, 12 Jul 2024 16:36:10 +0800 Subject: [PATCH] cmake:support romfs prog for SIM CMake build Signed-off-by: xuxin19 --- examples/romfs/CMakeLists.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/examples/romfs/CMakeLists.txt b/examples/romfs/CMakeLists.txt index d09398011..70effd4cd 100644 --- a/examples/romfs/CMakeLists.txt +++ b/examples/romfs/CMakeLists.txt @@ -19,5 +19,27 @@ # ############################################################################## if(CONFIG_EXAMPLES_ROMFS) - nuttx_add_application(NAME romfs) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/romfs_testdir.h + COMMAND tar zxf ${CMAKE_CURRENT_LIST_DIR}/testdir.tar.gz + COMMAND genromfs -f testdir.img -d testdir -V "ROMFS_Test" + COMMAND xxd -i testdir.img romfs_testdir.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_LIST_DIR}/testdir.tar.gz) + add_custom_target(testromfs + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/romfs_testdir.h) + + nuttx_add_application( + NAME + romfs + MODULE + ${CONFIG_EXAMPLES_ROMFS} + INCLUDE_DIRECTORIES + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + testromfs + SRCS + romfs_main.c) + endif()