Skip to content

Commit

Permalink
Added option to build against non-default python3 with CMake as well
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Nov 14, 2024
1 parent f3e9a79 commit 8602a18
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 8 additions & 5 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down
13 changes: 8 additions & 5 deletions client/experimental_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions doc/md/Development/Makefile-vs-CMake.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? |
Expand Down
6 changes: 3 additions & 3 deletions doc/md/Use_of_Proxmark/0_Compilation-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8602a18

Please sign in to comment.