port: use find_package(python) in cmake builds

This commit is contained in:
Matthias Ringwald 2022-06-13 16:32:11 +02:00
parent 09fffc1651
commit 02bddf72de
7 changed files with 32 additions and 25 deletions

View File

@ -46,7 +46,8 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# to find generated .h from .gatt files
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
@ -191,9 +192,9 @@ foreach(EXAMPLE_FILE ${EXAMPLES_C})
message("example ${EXAMPLE} -- with GATT DB")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt
COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py
ARGS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
COMMAND ${Python_EXECUTABLE}
ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
else()

View File

@ -36,7 +36,8 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# to find generated .h from .gatt files
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
@ -104,9 +105,9 @@ foreach(EXAMPLE ${EXAMPLES})
message("example ${EXAMPLE} -- with GATT DB")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt
COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py
ARGS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
COMMAND ${Python_EXECUTABLE}
ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
else()

View File

@ -17,7 +17,8 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# to find generated .h from .gatt files
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
@ -174,8 +175,8 @@ foreach(EXAMPLE ${EXAMPLES})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
COMMAND ${BTSTACK_ROOT}/tool/compile_gatt.py
ARGS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
COMMAND ${Python_EXECUTABLE}
ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
else()

View File

@ -15,7 +15,8 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# to find generated .h from .gatt files
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
@ -81,9 +82,9 @@ foreach(EXAMPLE ${EXAMPLES})
message("example ${EXAMPLE} -- with GATT DB")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt
COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py
ARGS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
COMMAND ${Python_EXECUTABLE}
ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
else()

View File

@ -15,7 +15,8 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# to find generated .h from .gatt files
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
@ -81,9 +82,9 @@ foreach(EXAMPLE ${EXAMPLES})
message("example ${EXAMPLE} -- with GATT DB")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt
COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py
ARGS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
COMMAND ${Python_EXECUTABLE}
ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
else()

View File

@ -17,7 +17,8 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# to find generated .h from .gatt files
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
@ -175,7 +176,7 @@ foreach(EXAMPLE ${EXAMPLES})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
COMMAND python3
COMMAND ${Python_EXECUTABLE}
ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)

View File

@ -15,7 +15,8 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# to find generated .h from .gatt files
# to generate .h from .gatt files
find_package (Python REQUIRED COMPONENTS Interpreter)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
@ -92,9 +93,9 @@ foreach(EXAMPLE ${EXAMPLES})
message("example ${EXAMPLE} -- with GATT DB")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt
COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py
ARGS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt
COMMAND ${Python_EXECUTABLE}
ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h
)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h)
else()