cmake: locally install pip dependencies (#1984)

Signed-off-by: Julian Oes <julian@oes.ch>
This commit is contained in:
Julian Oes
2023-05-11 10:47:05 +12:00
committed by GitHub
parent e9bf6a61d8
commit 31b4aebb5e
2 changed files with 14 additions and 4 deletions
-3
View File
@@ -63,9 +63,6 @@ jobs:
run: |
sudo apt update
sudo apt install -y python3 python3-pip
- name: Install pip dependencies
run: |
python3 -m pip install -r pymavlink/requirements.txt
- name: Install MAVLink headers
run: |
cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=install
+14 -1
View File
@@ -4,6 +4,17 @@ project(mavlink)
find_package(Python COMPONENTS Interpreter REQUIRED)
# We automatically install the pip dependencies locally below.
# Therefore, we check whether pip is available here.
execute_process(
COMMAND ${Python_EXECUTABLE} -m pip -V
RESULT_VARIABLE EXIT_CODE
OUTPUT_QUIET
)
if (NOT ${EXIT_CODE} EQUAL 0)
message(FATAL_ERROR "Python pip not found, pip is required")
endif()
if (NOT MAVLINK_DIALECT)
set(MAVLINK_DIALECT common)
endif()
@@ -17,7 +28,9 @@ message(STATUS "MAVLink version: ${MAVLINK_VERSION}")
set(EXAMPLE_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/mavlink/${MAVLINK_DIALECT}/mavlink.h)
add_custom_command(OUTPUT ${EXAMPLE_HEADER}
COMMAND Python::Interpreter
COMMAND ${Python_EXECUTABLE}
-m pip install -r pymavlink/requirements.txt --upgrade -t ${CMAKE_CURRENT_BINARY_DIR}/pip-dependencies/
COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/pip-dependencies/" ${Python_EXECUTABLE}
-m pymavlink.tools.mavgen
--lang=C
--wire-protocol=${MAVLINK_VERSION}