From cf627e87aef942c7a26034bb608042707fcd6398 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Thu, 19 Dec 2024 13:33:53 +0200 Subject: [PATCH 1/3] ROMFS/CMakeLists.txt: Fix dependency for rc.sysinit (again) Prior to this patch rc.sysinit was always rebuilt unconditionally, this rule stops that. --- ROMFS/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ROMFS/CMakeLists.txt b/ROMFS/CMakeLists.txt index d6c404241514..341b606347ed 100644 --- a/ROMFS/CMakeLists.txt +++ b/ROMFS/CMakeLists.txt @@ -142,15 +142,16 @@ set(extras_dependencies) # sysinit script for kernel mode if(CONFIG_BUILD_KERNEL) - add_custom_command(OUTPUT ${romfs_gen_root_dir}/init.d/rc.sysinit + add_custom_command(OUTPUT ${romfs_gen_root_dir}/init.d/rc.sysinit rc.sysinit.stamp COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PX4_BINARY_DIR}/NuttX/rc.sysinit ${romfs_gen_root_dir}/init.d/rc.sysinit + COMMAND ${CMAKE_COMMAND} -E touch rc.sysinit.stamp DEPENDS ${PX4_BINARY_DIR}/NuttX/rc.sysinit romfs_copy.stamp COMMENT "ROMFS: copying rc.sysinit" ) list(APPEND extras_dependencies - ${romfs_gen_root_dir}/init.d/rc.sysinit + rc.sysinit.stamp ) endif() From 69e90c94db21e2314c0b07d63cd52350fa7ca717 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Thu, 19 Dec 2024 13:34:42 +0200 Subject: [PATCH 2/3] nuttx/CMakeLists.txt: Fix dependencies for px4 module executables Prior to this change all px4 modules were rebuilt unconditionally, this patch stops that. --- platforms/nuttx/CMakeLists.txt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/CMakeLists.txt index 25dcce0bdca7..07c9a3d9089d 100644 --- a/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/CMakeLists.txt @@ -284,7 +284,8 @@ if (CONFIG_BUILD_KERNEL) # Build module.a into module.elf set(BIN px4-${MAIN}.elf) add_executable(${BIN} ${PX4_SOURCE_DIR}/platforms/nuttx/src/px4/common/process/main.cpp) - set_target_properties(${BIN} PROPERTIES OUTPUT_NAME ${BIN}) + set_target_properties(${BIN} PROPERTIES OUTPUT_NAME ${MAIN}) + set_target_properties(${BIN} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PX4_BINARY_DIR}/bin) add_dependencies(${BIN} nuttx_crt0 ${module}) target_compile_options(${BIN} PRIVATE -Dentry=${MAIN}_main) @@ -328,19 +329,11 @@ if (CONFIG_BUILD_KERNEL) # The individual module deps are FUBAR, so this cannot be done #target_link_libraries(${BIN} PRIVATE ${module}) target_link_libraries(${BIN} INTERFACE perf nuttx_c) + # Some global deps are also FUBAR, so this must be done target_link_libraries(px4_platform board_bus_info) - # Install the executable to /bin - add_custom_target(${BIN}_install - COMMAND mkdir -p ${PX4_BINARY_DIR}/bin - COMMAND install -D ${PX4_BINARY_DIR}/${BIN} -t ${PX4_BINARY_DIR}/bin - COMMAND mv ${PX4_BINARY_DIR}/bin/${BIN} ${PX4_BINARY_DIR}/bin/${MAIN} - COMMAND rm -f ${PX4_BINARY_DIR}/${BIN} - DEPENDS ${BIN} - ) - - list(APPEND px4_bins ${BIN}_install) + list(APPEND px4_bins ${BIN}) endforeach() # Create the /bin ROMFS From e4cdbc095fe1fb9d8bc500c67bad48d6e5c8fe93 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Thu, 19 Dec 2024 14:53:53 +0200 Subject: [PATCH 3/3] NuttX/CMakeLists.txt: Fix dependencies for NuttX executables Prior to this change all NuttX executables were rebuilt unconditionally, this patch stops that. --- platforms/nuttx/NuttX/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platforms/nuttx/NuttX/CMakeLists.txt b/platforms/nuttx/NuttX/CMakeLists.txt index 5a3253cd7a78..042d175900e5 100644 --- a/platforms/nuttx/NuttX/CMakeLists.txt +++ b/platforms/nuttx/NuttX/CMakeLists.txt @@ -268,7 +268,7 @@ if (CONFIG_BUILD_KERNEL) get_property(CRT0_OBJ TARGET nuttx_crt0 PROPERTY IMPORTED_OBJECTS) - add_custom_target(nuttx_app_bins + add_custom_command(OUTPUT nuttx_install.stamp COMMAND mkdir -p ${PX4_BINARY_DIR}/bin COMMAND make -C ${NUTTX_SRC_DIR}/apps install --no-print-directory --silent ARCHCRT0OBJ="${CRT0_OBJ}" @@ -276,9 +276,11 @@ if (CONFIG_BUILD_KERNEL) TOPDIR="${NUTTX_DIR}" ELFLDNAME="${LDSCRIPT}" USERLIBS="${userlibs}" > ${CMAKE_CURRENT_BINARY_DIR}/nuttx_apps_install.log + COMMAND touch nuttx_install.stamp BYPRODUCTS ${PX4_BINARY_DIR}/bin/nsh DEPENDS ${nuttx_userlibs} nuttx_startup ) + add_custom_target(nuttx_app_bins DEPENDS nuttx_install.stamp) endif() ###############################################################################