Skip to content

Commit

Permalink
Bump min CMake version to 3.12 and use FindPython
Browse files Browse the repository at this point in the history
This also allows up to set the max version to current as we're not using
any removed features.
  • Loading branch information
Daft-Freak committed Jan 20, 2025
1 parent c259df3 commit b1fc2ba
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions 32blit-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ if (NOT DEFINED BLIT_ONCE)
set(CMAKE_CXX_EXTENSIONS OFF)
set(BLIT_MINIMUM_TOOLS_VERSION "0.7.3")

find_package(PythonInterp 3.6 REQUIRED)
find_package(Python 3.6 REQUIRED)

# make sure that the tools are installed
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ttblit version RESULT_VARIABLE VERSION_STATUS OUTPUT_VARIABLE TOOLS_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${Python_EXECUTABLE} -m ttblit version RESULT_VARIABLE VERSION_STATUS OUTPUT_VARIABLE TOOLS_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

if(${VERSION_STATUS})
# check for the executable if the module isn't found
Expand All @@ -18,18 +18,18 @@ if (NOT DEFINED BLIT_ONCE)
execute_process(COMMAND ${32BLIT_TOOLS_EXECUTABLE} version RESULT_VARIABLE VERSION_STATUS OUTPUT_VARIABLE TOOLS_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
else()
set(32BLIT_TOOLS_EXECUTABLE ${PYTHON_EXECUTABLE} -m ttblit)
set(32BLIT_TOOLS_EXECUTABLE ${Python_EXECUTABLE} -m ttblit)
endif()

# get just the python command to output to the user
get_filename_component(PYTHON_USER_EXECUTABLE "${PYTHON_EXECUTABLE}" NAME)
get_filename_component(PYTHON_USER_EXECUTABLE "${Python_EXECUTABLE}" NAME)

if(${VERSION_STATUS})
message(FATAL_ERROR "32Blit tools not found!\nInstall with: ${PYTHON_USER_EXECUTABLE} -m pip install 32blit\n")
message(FATAL_ERROR "32Blit tools not found!\nInstall with: ${Python_USER_EXECUTABLE} -m pip install 32blit\n")
endif()

if("${TOOLS_VERSION}" VERSION_LESS "${BLIT_MINIMUM_TOOLS_VERSION}")
message(FATAL_ERROR "32Blit tools out of date!\nYou have ${TOOLS_VERSION}, we need >= ${BLIT_MINIMUM_TOOLS_VERSION}\nUpdate with: ${PYTHON_USER_EXECUTABLE} -m pip install --upgrade 32blit\n")
message(FATAL_ERROR "32Blit tools out of date!\nYou have ${TOOLS_VERSION}, we need >= ${BLIT_MINIMUM_TOOLS_VERSION}\nUpdate with: ${Python_USER_EXECUTABLE} -m pip install --upgrade 32blit\n")
endif()

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand Down
2 changes: 1 addition & 1 deletion 32blit-stm32/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9...3.26)
cmake_minimum_required(VERSION 3.12...3.31)
project (firmware)
find_package (32BLIT CONFIG REQUIRED PATHS ..)

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9...3.26)
cmake_minimum_required(VERSION 3.12...3.31)

# has to be before project
include(32blit-pico/sdk_import.cmake)
Expand Down
2 changes: 1 addition & 1 deletion launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9...3.26)
cmake_minimum_required(VERSION 3.12...3.31)
project (launcher)
find_package (32BLIT CONFIG REQUIRED PATHS ..)

Expand Down
2 changes: 1 addition & 1 deletion utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9...3.26)
cmake_minimum_required(VERSION 3.12...3.31)
project (examples)
find_package (32BLIT CONFIG REQUIRED PATHS ..)

Expand Down
2 changes: 1 addition & 1 deletion utilities/hardware-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9...3.26)
cmake_minimum_required(VERSION 3.12...3.31)
project (hardware-test)
find_package (32BLIT CONFIG REQUIRED PATHS ../..)

Expand Down
2 changes: 1 addition & 1 deletion utilities/picosystem-hardware-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9...3.26)
cmake_minimum_required(VERSION 3.12...3.31)
project (picosystem-hardware-test)
find_package (32BLIT CONFIG REQUIRED PATHS ../..)

Expand Down

0 comments on commit b1fc2ba

Please sign in to comment.