Check for python in RAM code and use find_package to determine the python interpreter

This commit is contained in:
Mario Hüttel 2021-07-17 15:25:25 +02:00
parent 2fa12cda60
commit e753504ae3
2 changed files with 11 additions and 2 deletions

View File

@ -61,7 +61,7 @@ if (VIRTUALENV)
)
message("${BoldGreen}python virtual environment set up!${ColorReset}")
else(VIRTUALENV)
message("${BoldRed}Python virtual environment not set up: virtualenv: command not found!${ColorReset}")
message(FATAL_ERROR "${BoldRed}Python virtual environment not set up: virtualenv: command not found!${ColorReset}")
endif (VIRTUALENV)

View File

@ -6,6 +6,15 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_TOOLCHAIN_FILE "arm-none-eabi-gcc.cmake")
find_package(Python COMPONENTS Interpreter)
if (Python_FOUND)
message("Python interpreter used for converting updater RAM code: ${Python_EXECUTABLE}")
else (Python_FOUND)
message(FATAL_ERROR "${BoldRed}Python interpreter not found! Please install python 3.${ColorReset}")
endif (Python_FOUND)
set(ELFFILE ${PROJECT_NAME}.elf)
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/ram-link.ld)
@ -44,5 +53,5 @@ add_custom_command(DEPENDS
OUTPUT
${GEN_HEADER_FILE}
COMMAND
mkdir -p ${GEN_HEADER_PATH} && python "${CMAKE_CURRENT_SOURCE_DIR}/bin2carray.py" "${GEN_HEADER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.bin"
mkdir -p ${GEN_HEADER_PATH} && ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/bin2carray.py" "${GEN_HEADER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.bin"
)