Added option to build against non-default python3 with CMake as well

This commit is contained in:
Philippe Teuwen 2024-11-14 09:31:49 +01:00
commit 8602a182bb
5 changed files with 22 additions and 14 deletions

View file

@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Added option to build against non-default python3 (@ANTodorov)
- Added option to build against non-default python3 with CMake as well (@doegox)
- Added option to build against non-default python3 with Makefile (@ANTodorov)
- Changed `hf 14a info` `hf mf info` - now detects FM1216-137 CPU cards (@iceman1001)
- Changed `hf iclass configcard` expanding the list of available options and functionalities (@antiklesys)
- Fixed `intertic.py` - missing comma in array (@iceman1001)

View file

@ -44,6 +44,9 @@ endif()
find_package(PkgConfig)
# Allow specifying a Python version via cmake option
set(PYTHON3_PKGCONFIG "python3" CACHE STRING "Python3 package config version suffix")
if (NOT SKIPQT EQUAL 1)
if(APPLE AND EXISTS /usr/local/opt/qt5)
@ -87,8 +90,8 @@ if (NOT SKIPBT EQUAL 1)
endif (NOT SKIPBT EQUAL 1)
if (NOT SKIPPYTHON EQUAL 1)
pkg_search_module(PYTHON3 QUIET python3)
pkg_search_module(PYTHON3EMBED QUIET python3-embed)
pkg_search_module(PYTHON3 QUIET ${PYTHON3_PKGCONFIG})
pkg_search_module(PYTHON3EMBED QUIET ${PYTHON3_PKGCONFIG}-embed)
endif (NOT SKIPPYTHON EQUAL 1)
# If cross-compiled, we need to init source and build.
@ -611,11 +614,11 @@ if (SKIPPYTHON EQUAL 1)
message(STATUS "Python3 library: skipped")
else (SKIPPYTHON EQUAL 1)
if (PYTHON3EMBED_FOUND)
message(STATUS "Python3 library: Python3 embed found, enabled")
message(STATUS "Python3 library: ${PYTHON3_PKGCONFIG}-embed found, enabled")
elseif (PYTHON3_FOUND)
message(STATUS "Python3 library: Python3 found, enabled")
message(STATUS "Python3 library: ${PYTHON3_PKGCONFIG} found, enabled")
else (PYTHON3EMBED_FOUND)
message(STATUS "Python3 library: Python3 not found, disabled")
message(STATUS "Python3 library: ${PYTHON3_PKGCONFIG} not found, disabled")
endif (PYTHON3EMBED_FOUND)
endif(SKIPPYTHON EQUAL 1)

View file

@ -45,6 +45,9 @@ endif()
find_package(PkgConfig)
# Allow specifying a Python version via cmake option
set(PYTHON3_PKGCONFIG "python3" CACHE STRING "Python3 package config version suffix")
if (NOT SKIPQT EQUAL 1)
if(APPLE AND EXISTS /usr/local/opt/qt5)
@ -88,8 +91,8 @@ if (NOT SKIPBT EQUAL 1)
endif (NOT SKIPBT EQUAL 1)
if (NOT SKIPPYTHON EQUAL 1)
pkg_search_module(PYTHON3 QUIET python3)
pkg_search_module(PYTHON3EMBED QUIET python3-embed)
pkg_search_module(PYTHON3 QUIET ${PYTHON3_PKGCONFIG})
pkg_search_module(PYTHON3EMBED QUIET ${PYTHON3_PKGCONFIG}-embed)
endif (NOT SKIPPYTHON EQUAL 1)
# If cross-compiled, we need to init source and build.
@ -612,11 +615,11 @@ if (SKIPPYTHON EQUAL 1)
message(STATUS "Python3 library: skipped")
else (SKIPPYTHON EQUAL 1)
if (PYTHON3EMBED_FOUND)
message(STATUS "Python3 library: Python3 embed found, enabled")
message(STATUS "Python3 library: ${PYTHON3_PKGCONFIG}-embed found, enabled")
elseif (PYTHON3_FOUND)
message(STATUS "Python3 library: Python3 found, enabled")
message(STATUS "Python3 library: ${PYTHON3_PKGCONFIG} found, enabled")
else (PYTHON3EMBED_FOUND)
message(STATUS "Python3 library: Python3 not found, disabled")
message(STATUS "Python3 library: ${PYTHON3_PKGCONFIG} not found, disabled")
endif (PYTHON3EMBED_FOUND)
endif(SKIPPYTHON EQUAL 1)

View file

@ -65,6 +65,7 @@ At the moment both are maintained because they don't perfectly overlap yet.
| dep mbedtls | in_common | in_common | no sys lib: missing support for CMAC in def conf (btw no .pc available) |
| dep python3 | opt, sys, < 3.8 & 3.8 | opt, sys, < 3.8 & 3.8 | |
| python3 detection | pc | pkg_search_module | |
| force python3 version | `PYTHON3_PKGCONFIG=python-3.12` | `-DPYTHON3_PKGCONFIG=python-3.12` | |
| `SKIPPYTHON` | yes | yes | |
| dep pthread | sys | sys | |
| pthread detection | **none** | **none** (1) | (1) cf https://stackoverflow.com/questions/1620918/cmake-and-libpthread ? |

View file

@ -10,7 +10,7 @@
- [Compile for generic Proxmark3 platforms](#compile-for-generic-proxmark3-platforms)
- [Get the latest commits](#get-the-latest-commits)
- [Clean and compile everything](#clean-and-compile-everything)
- [if there are different python3 packages installed](#if-there-are-different-python3-packages-installed)
- [if there are different Python 3 packages installed](#if-there-are-different-python-3-packages-installed)
- [if you got an error](#if-you-got-an-error)
- [Install](#install)
- [Flash the BOOTROM & FULLIMAGE](#flash-the-bootrom--fullimage)
@ -57,10 +57,10 @@ git pull
make clean && make -j
```
### if there are different python3 packages installed
### if there are different Python 3 packages installed
^[Top](#top)
It is possible to point to a different python3 package. For example, to build against Python3.11:
It is possible to point to a different Python 3 package. For example, to build against Python 3.11:
```sh
make clean && make -j PYTHON3_PKGCONFIG=python-3.11