cmake(bugfix):use apps_post to identify the stage of app completion

nuttx_post for all target done
apps_post for all apps lib done

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19
2025-03-19 15:53:47 +08:00
committed by GUIDINGLI
parent 70bddf61c3
commit 197149a297
3 changed files with 20 additions and 6 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ function(nuttx_add_application)
# non-elf output
if(NOT CMAKE_C_ELF_COMPILER)
add_library(${TARGET} ${SRCS})
add_dependencies(${TARGET} nuttx_post)
add_dependencies(${TARGET} apps_post)
add_custom_command(
TARGET ${TARGET}
POST_BUILD
+15 -5
View File
@@ -81,7 +81,9 @@ endfunction()
function(nuttx_add_aux_library target)
# declare target
add_library(${target} OBJECT ${ARGN})
# make sure context and post time ordering
add_dependencies(${target} apps_context)
add_dependencies(apps_post ${target})
nuttx_add_library_internal(${target} ${ARGN})
endfunction()
@@ -93,7 +95,10 @@ endfunction()
function(nuttx_add_user_library target)
# declare target
add_library(${target} OBJECT ${ARGN})
# make sure context and post time ordering
add_dependencies(${target} apps_context)
add_dependencies(apps_post ${target})
nuttx_add_library_internal(${target} ${ARGN})
# link to final libapps
@@ -112,6 +117,9 @@ endfunction()
function(nuttx_add_system_library target)
# declare target
add_library(${target} ${ARGN})
# make sure context and post time ordering
add_dependencies(${target} apps_context)
add_dependencies(apps_post ${target})
# add library to build
nuttx_add_library_internal(${target} ${ARGN})
@@ -124,7 +132,6 @@ function(nuttx_add_system_library target)
APPEND
PROPERTY NUTTX_ELF_LINK_LIBRARIES $<TARGET_FILE:${target}>)
add_dependencies(nuttx_post ${target})
endfunction()
# Kernel Libraries
@@ -201,7 +208,9 @@ define_property(
#
function(nuttx_add_library target)
add_library(${target} ${ARGN})
# make sure context and post time ordering
add_dependencies(${target} apps_context)
add_dependencies(apps_post ${target})
set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target})
set_property(
@@ -209,8 +218,6 @@ function(nuttx_add_library target)
APPEND
PROPERTY NUTTX_ELF_LINK_LIBRARIES $<TARGET_FILE:${target}>)
add_dependencies(nuttx_post ${target})
# Set apps global compile options & definitions hold by nuttx_apps_interface
target_compile_options(
${target}
@@ -279,12 +286,15 @@ endfunction()
function(nuttx_add_external_library target)
cmake_parse_arguments(ARGS "" MODE "" ${ARGN})
if(NOT ARGS_MODE)
# if we add external library as system lib, make sure context and post time
# ordering
add_dependencies(${target} apps_context)
add_dependencies(apps_post ${target})
set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target})
set_property(
TARGET nuttx_global
APPEND
PROPERTY NUTTX_ELF_LINK_LIBRARIES $<TARGET_FILE:${target}>)
add_dependencies(nuttx_post ${target})
elseif("${ARGS_MODE}" STREQUAL "APPS")
set_property(GLOBAL APPEND PROPERTY NUTTX_APPS_LIBRARIES ${target})
elseif("${ARGS_MODE}" STREQUAL "KERNEL")
+4
View File
@@ -156,3 +156,7 @@ add_custom_target(
# apps_context is a PHONY target used as an intermediate process to control the
# time order of context preparation actions of app building
add_custom_target(apps_context ALL DEPENDS nuttx_context)
# apps_post is a PHONY target used as an intermediate process to control the
# time order of all apps library has been built
add_custom_target(apps_post)