mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:58:53 +08:00
cmake only run libuavcan_dsdlc if there are changes
This commit is contained in:
+5
-2
@@ -22,6 +22,7 @@ set(opts
|
|||||||
"UAVCAN_USE_CPP03:BOOL:OFF::Use C++03 standard."
|
"UAVCAN_USE_CPP03:BOOL:OFF::Use C++03 standard."
|
||||||
"UAVCAN_PLATFORM:STRING:generic:generic linux stm32:Platform."
|
"UAVCAN_PLATFORM:STRING:generic:generic linux stm32:Platform."
|
||||||
"CONTINUOUS_INTEGRATION_BUILD:BOOL:OFF::Disable error redirection and timing tests"
|
"CONTINUOUS_INTEGRATION_BUILD:BOOL:OFF::Disable error redirection and timing tests"
|
||||||
|
"UAVCAN_CMAKE_VERBOSE:BOOL:OFF::Verbose CMake configure output"
|
||||||
)
|
)
|
||||||
foreach(_opt ${opts})
|
foreach(_opt ${opts})
|
||||||
# arguments are : delimited
|
# arguments are : delimited
|
||||||
@@ -42,7 +43,9 @@ foreach(_opt ${opts})
|
|||||||
set(${_name} ${DEFAULT_${_name}})
|
set(${_name} ${DEFAULT_${_name}})
|
||||||
endif()
|
endif()
|
||||||
# create a cache from the variable and force it to set
|
# create a cache from the variable and force it to set
|
||||||
|
if(UAVCAN_CMAKE_VERBOSE)
|
||||||
message(STATUS "${_name}\t: ${${_name}} : ${_descr}")
|
message(STATUS "${_name}\t: ${${_name}} : ${_descr}")
|
||||||
|
endif()
|
||||||
set("${_name}" "${${_name}}" CACHE "${_type}" "${_descr}" FORCE)
|
set("${_name}" "${${_name}}" CACHE "${_type}" "${_descr}" FORCE)
|
||||||
# if an options list is provided for the cache, set it
|
# if an options list is provided for the cache, set it
|
||||||
if("${_type}" STREQUAL "STRING" AND NOT "${_options}" STREQUAL "")
|
if("${_type}" STREQUAL "STRING" AND NOT "${_options}" STREQUAL "")
|
||||||
@@ -72,11 +75,11 @@ add_subdirectory(libuavcan)
|
|||||||
|
|
||||||
# drivers
|
# drivers
|
||||||
if (${UAVCAN_PLATFORM} STREQUAL "linux")
|
if (${UAVCAN_PLATFORM} STREQUAL "linux")
|
||||||
message(STATUS "Adding Linux platform driver")
|
message(STATUS "Adding UAVCAN Linux platform driver")
|
||||||
add_subdirectory(libuavcan_drivers/posix)
|
add_subdirectory(libuavcan_drivers/posix)
|
||||||
add_subdirectory(libuavcan_drivers/linux)
|
add_subdirectory(libuavcan_drivers/linux)
|
||||||
elseif(${UAVCAN_PLATFORM} STREQUAL "stm32")
|
elseif(${UAVCAN_PLATFORM} STREQUAL "stm32")
|
||||||
message(STATUS "Adding STM32 platform driver")
|
message(STATUS "Adding UAVCAN STM32 platform driver")
|
||||||
add_subdirectory(libuavcan_drivers/posix)
|
add_subdirectory(libuavcan_drivers/posix)
|
||||||
add_subdirectory(libuavcan_drivers/stm32/driver)
|
add_subdirectory(libuavcan_drivers/stm32/driver)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ endif()
|
|||||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower)
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower)
|
||||||
if (build_type_lower STREQUAL "debug")
|
if (build_type_lower STREQUAL "debug")
|
||||||
set(DEBUG_BUILD 1)
|
set(DEBUG_BUILD 1)
|
||||||
|
message(STATUS "Debug build")
|
||||||
else ()
|
else ()
|
||||||
set(DEBUG_BUILD 0)
|
set(DEBUG_BUILD 0)
|
||||||
endif ()
|
endif ()
|
||||||
message(STATUS "Debug build: ${DEBUG_BUILD}")
|
|
||||||
|
|
||||||
project(libuavcan)
|
project(libuavcan)
|
||||||
|
|
||||||
@@ -34,8 +34,19 @@ endif ()
|
|||||||
execute_process(COMMAND ./setup.py build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dsdl_compiler)
|
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_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")
|
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})
|
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')
|
LOCAL_PYUAVCAN_DIR = os.path.join(SCRIPT_DIR, 'pyuavcan')
|
||||||
RUNNING_FROM_SRC_DIR = os.path.isdir(LOCAL_PYUAVCAN_DIR)
|
RUNNING_FROM_SRC_DIR = os.path.isdir(LOCAL_PYUAVCAN_DIR)
|
||||||
if RUNNING_FROM_SRC_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, SCRIPT_DIR)
|
||||||
sys.path.insert(0, LOCAL_PYUAVCAN_DIR)
|
sys.path.insert(0, LOCAL_PYUAVCAN_DIR)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user