mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-02-11 00:39:55 +00:00
* fix feature request #1442 * Do not require -I before each addtional path * Fix pico_btstack_make_gatt_header warning gatt header files are always made into the "generated" folder so you get a warning if you have more than one target generating a gatt header with the same name. Also, simplify the expansion of ARGN * Improve pico_btstack_make_gatt_header description --------- Co-authored-by: Peter Harper <peter.harper@raspberrypi.com>
This commit is contained in:
parent
62bb486f2a
commit
f1c6fc8b6d
@ -232,21 +232,22 @@ if (EXISTS ${PICO_BTSTACK_PATH}/${BTSTACK_TEST_PATH})
|
|||||||
|
|
||||||
# Make a GATT header file from a BTstack GATT file
|
# Make a GATT header file from a BTstack GATT file
|
||||||
# Pass the target library name library type and path to the GATT input file
|
# Pass the target library name library type and path to the GATT input file
|
||||||
|
# To add additional directories to the gatt #import path, add them to the end of the argument list.
|
||||||
function(pico_btstack_make_gatt_header TARGET_LIB TARGET_TYPE GATT_FILE)
|
function(pico_btstack_make_gatt_header TARGET_LIB TARGET_TYPE GATT_FILE)
|
||||||
find_package (Python3 REQUIRED COMPONENTS Interpreter)
|
find_package (Python3 REQUIRED COMPONENTS Interpreter)
|
||||||
get_filename_component(GATT_NAME "${GATT_FILE}" NAME_WE)
|
get_filename_component(GATT_NAME "${GATT_FILE}" NAME_WE)
|
||||||
get_filename_component(GATT_PATH "${GATT_FILE}" PATH)
|
get_filename_component(GATT_PATH "${GATT_FILE}" PATH)
|
||||||
set(GATT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
|
||||||
set(GATT_HEADER "${GATT_BINARY_DIR}/${GATT_NAME}.h")
|
|
||||||
set(TARGET_GATT "${TARGET_LIB}_gatt_header")
|
set(TARGET_GATT "${TARGET_LIB}_gatt_header")
|
||||||
|
set(GATT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated/${TARGET_GATT}")
|
||||||
|
set(GATT_HEADER "${GATT_BINARY_DIR}/${GATT_NAME}.h")
|
||||||
|
list(TRANSFORM ARGN PREPEND "-I")
|
||||||
add_custom_target(${TARGET_GATT} DEPENDS ${GATT_HEADER})
|
add_custom_target(${TARGET_GATT} DEPENDS ${GATT_HEADER})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${GATT_HEADER}
|
OUTPUT ${GATT_HEADER}
|
||||||
DEPENDS ${GATT_FILE}
|
DEPENDS ${GATT_FILE}
|
||||||
WORKING_DIRECTORY ${GATT_PATH}
|
WORKING_DIRECTORY ${GATT_PATH}
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${GATT_BINARY_DIR} &&
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${GATT_BINARY_DIR} &&
|
||||||
${Python3_EXECUTABLE} ${PICO_SDK_PATH}/lib/btstack/tool/compile_gatt.py ${GATT_FILE} ${GATT_HEADER}
|
${Python3_EXECUTABLE} ${PICO_SDK_PATH}/lib/btstack/tool/compile_gatt.py ${GATT_FILE} ${GATT_HEADER} ${ARGN}
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
add_dependencies(${TARGET_LIB}
|
add_dependencies(${TARGET_LIB}
|
||||||
${TARGET_GATT}
|
${TARGET_GATT}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user