Compare commits

...

1 Commits

Author SHA1 Message Date
Daniel Agar fdd8afc542
cmake: px4_add_git_submodule add git index and HEAD as dependencies
- this ensures any submodule changes are caught
 - fixes #17651
2021-08-21 14:49:51 -04:00
2 changed files with 14 additions and 10 deletions

View File

@ -75,13 +75,24 @@ function(px4_add_git_submodule)
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
)
execute_process(
COMMAND git rev-parse --absolute-git-dir
OUTPUT_VARIABLE git_dir
WORKING_DIRECTORY ${PX4_SOURCE_DIR}/${REL_PATH}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REPLACE "/" "_" NAME ${PATH})
string(REPLACE "." "_" NAME ${NAME})
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/git_init_${NAME}.stamp
COMMAND Tools/check_submodules.sh ${REL_PATH}
COMMAND ${PX4_SOURCE_DIR}/Tools/check_submodules.sh ${REL_PATH}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/git_init_${NAME}.stamp
DEPENDS ${PX4_SOURCE_DIR}/.gitmodules ${PATH}/.git
DEPENDS
${PX4_SOURCE_DIR}/.gitmodules
${PATH}/.git
${git_dir}/HEAD
${git_dir}/index
COMMENT "git submodule ${REL_PATH}"
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
USES_TERMINAL

View File

@ -1,6 +1,6 @@
############################################################################
#
# Copyright (c) 2019 PX4 Development Team. All rights reserved.
# Copyright (c) 2019-2021 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -61,10 +61,6 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# setup custom command to copy changes later
file(GLOB_RECURSE copy_nuttx_files LIST_DIRECTORIES false ${NUTTX_SRC_DIR}/nuttx/*)
list(REMOVE_ITEM copy_nuttx_files ${NUTTX_SRC_DIR}/nuttx/.git)
add_custom_command(
OUTPUT ${PX4_BINARY_DIR}/NuttX/nuttx_copy.stamp
COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST}
@ -73,7 +69,6 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/nuttx_copy.stamp
DEPENDS
git_nuttx
${copy_nuttx_files}
COMMENT "Copying NuttX/nuttx to ${CP_DST}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
@ -85,14 +80,12 @@ file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_SRC_DIR}/apps)
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
# setup custom command to copy changes later
file(GLOB_RECURSE copy_apps_files LIST_DIRECTORIES false ${NUTTX_SRC_DIR}/apps/*)
add_custom_command(
OUTPUT ${PX4_BINARY_DIR}/NuttX/apps_copy.stamp
COMMAND ${NUTTX_COPY_CMD} ${NUTTX_COPY_CMD_OPTS} ${CP_SRC} ${CP_DST}
COMMAND ${CMAKE_COMMAND} -E touch ${PX4_BINARY_DIR}/NuttX/apps_copy.stamp
DEPENDS
git_nuttx_apps
${copy_apps_files}
COMMENT "Copying NuttX/apps to ${CP_DST}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)