mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 07:23:33 +08:00
cmake only run libuavcan_dsdlc if there are changes
This commit is contained in:
@@ -14,10 +14,10 @@ endif()
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower)
|
||||
if (build_type_lower STREQUAL "debug")
|
||||
set(DEBUG_BUILD 1)
|
||||
message(STATUS "Debug build")
|
||||
else ()
|
||||
set(DEBUG_BUILD 0)
|
||||
endif ()
|
||||
message(STATUS "Debug build: ${DEBUG_BUILD}")
|
||||
|
||||
project(libuavcan)
|
||||
|
||||
@@ -34,8 +34,19 @@ endif ()
|
||||
execute_process(COMMAND ./setup.py build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler)
|
||||
set(DSDLC_INPUTS "test/dsdl_test/root_ns_a" "test/dsdl_test/root_ns_b" "${CMAKE_CURRENT_SOURCE_DIR}/../dsdl/uavcan")
|
||||
set(DSDLC_OUTPUT "include/dsdlc_generated")
|
||||
add_custom_target(libuavcan_dsdlc dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(DSDLC_INPUT_FILES "")
|
||||
foreach(DSDLC_INPUT ${DSDLC_INPUTS})
|
||||
file(GLOB_RECURSE DSDLC_NEW_INPUT_FILES ${CMAKE_CURRENT_SOURCE_DIR} "${DSDLC_INPUT}/*.uavcan")
|
||||
set(DSDLC_INPUT_FILES ${DSDLC_INPUT_FILES} ${DSDLC_NEW_INPUT_FILES})
|
||||
endforeach(DSDLC_INPUT)
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/libuavcan_dsdlc_run.stamp
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/libuavcan_dsdlc_run.stamp
|
||||
DEPENDS ${DSDLC_INPUT_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Running dsdl compiler")
|
||||
add_custom_target(libuavcan_dsdlc DEPENDS ${CMAKE_BINARY_DIR}/libuavcan_dsdlc_run.stamp)
|
||||
include_directories(${DSDLC_OUTPUT})
|
||||
|
||||
#
|
||||
|
||||
@@ -16,7 +16,7 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
LOCAL_PYUAVCAN_DIR = os.path.join(SCRIPT_DIR, 'pyuavcan')
|
||||
RUNNING_FROM_SRC_DIR = os.path.isdir(LOCAL_PYUAVCAN_DIR)
|
||||
if RUNNING_FROM_SRC_DIR:
|
||||
print('Running from the source directory')
|
||||
#print('Running from the source directory')
|
||||
sys.path.insert(0, SCRIPT_DIR)
|
||||
sys.path.insert(0, LOCAL_PYUAVCAN_DIR)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user