mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-10 09:32:41 +08:00
cmake: use system libjansson if available
This commit is contained in:
parent
cdf1bc3ce7
commit
3106fa3d3d
2 changed files with 37 additions and 6 deletions
|
@ -20,6 +20,8 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
|
|||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
if (NOT SKIPQT EQUAL 1)
|
||||
if(APPLE AND EXISTS /usr/local/opt/qt5)
|
||||
# Homebrew installs Qt5 (up to at least 5.11.0) in
|
||||
|
@ -46,7 +48,6 @@ if (NOT SKIPQT EQUAL 1)
|
|||
endforeach()
|
||||
endif (NOT SKIPQT EQUAL 1)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (NOT SKIPBT EQUAL 1)
|
||||
pkg_search_module(BLUEZ QUIET bluez)
|
||||
endif (NOT SKIPBT EQUAL 1)
|
||||
|
@ -102,6 +103,19 @@ if (NOT SKIPREADLINE EQUAL 1)
|
|||
endif (READLINE_INCLUDE_DIRS AND READLINE_LIBRARIES)
|
||||
endif (NOT SKIPREADLINE EQUAL 1)
|
||||
|
||||
if (NOT SKIPJANSSONSYSTEM EQUAL 1)
|
||||
pkg_check_modules(PC_JANSSON QUIET jansson)
|
||||
find_path(JANSSON_INCLUDE_DIRS
|
||||
NAMES jansson.h
|
||||
HINTS ${PC_JANSSON_INCLUDEDIR} ${PC_JANSSON_INCLUDE_DIRS})
|
||||
find_library(JANSSON_LIBRARIES
|
||||
NAMES jansson libjansson
|
||||
HINTS ${PC_JANSSON_LIBDIR} ${PC_JANSSON_LIBRARY_DIRS})
|
||||
if (JANSSON_INCLUDE_DIRS AND JANSSON_LIBRARIES)
|
||||
set(JANSSON_FOUND ON)
|
||||
endif (JANSSON_INCLUDE_DIRS AND JANSSON_LIBRARIES)
|
||||
endif (NOT SKIPJANSSONSYSTEM EQUAL 1)
|
||||
|
||||
if(ANDROID)
|
||||
set(BZIP2_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2)
|
||||
ExternalProject_Add(bzip2
|
||||
|
@ -314,6 +328,11 @@ if (NOT SKIPBT EQUAL 1)
|
|||
endif (BLUEZ_FOUND)
|
||||
endif(NOT SKIPBT EQUAL 1)
|
||||
|
||||
if (JANSSON_FOUND)
|
||||
set(ADDITIONAL_DIRS ${JANSSON_INCLUDE_DIRS} ${ADDITIONAL_DIRS})
|
||||
set(ADDITIONAL_LNK ${JANSSON_LIBRARIES} ${ADDITIONAL_LNK})
|
||||
endif (JANSSON_FOUND)
|
||||
|
||||
if (NOT SKIPPYTHON EQUAL 1)
|
||||
if (PYTHON3EMBED_FOUND)
|
||||
add_definitions(-DHAVE_PYTHON)
|
||||
|
@ -367,6 +386,16 @@ else (SKIPBT EQUAL 1)
|
|||
endif (BLUEZ_FOUND)
|
||||
endif(SKIPBT EQUAL 1)
|
||||
|
||||
if (SKIPJANSSONSYSTEM EQUAL 1)
|
||||
message("Jansson library: local library forced")
|
||||
else (SKIPJANSSONSYSTEM EQUAL 1)
|
||||
if (JANSSON_FOUND)
|
||||
message("Jansson library: system library found")
|
||||
else (JANSSON_FOUND)
|
||||
message("Jansson library: system library not found, using local library")
|
||||
endif (JANSSON_FOUND)
|
||||
endif (SKIPJANSSONSYSTEM EQUAL 1)
|
||||
|
||||
if (SKIPPYTHON EQUAL 1)
|
||||
message("Python3 library: skipped")
|
||||
else (SKIPPYTHON EQUAL 1)
|
||||
|
@ -441,13 +470,16 @@ endif (NOT APPLE)
|
|||
|
||||
|
||||
find_library(pm3rrg_rdv4_cliparser REQUIRED)
|
||||
find_library(pm3rrg_rdv4_jansson REQUIRED)
|
||||
find_library(pm3rrg_rdv4_tinycbor REQUIRED)
|
||||
find_library(pm3rrg_rdv4_lua REQUIRED)
|
||||
find_library(pm3rrg_rdv4_mbedtls REQUIRED)
|
||||
find_library(pm3rrg_rdv4_reveng REQUIRED)
|
||||
find_library(pm3rrg_rdv4_hardnested REQUIRED)
|
||||
|
||||
if (NOT JANSSON_FOUND)
|
||||
find_library(pm3rrg_rdv4_jansson REQUIRED)
|
||||
set(ADDITIONAL_LNK pm3rrg_rdv4_jansson ${ADDITIONAL_LNK})
|
||||
endif (NOT JANSSON_FOUND)
|
||||
if (NOT WHEREAMI_FOUND)
|
||||
find_library(pm3rrg_rdv4_whereami REQUIRED)
|
||||
set(ADDITIONAL_LNK pm3rrg_rdv4_whereami ${ADDITIONAL_LNK})
|
||||
|
@ -457,7 +489,6 @@ target_link_libraries(proxmark3 PRIVATE
|
|||
m
|
||||
pm3rrg_rdv4_mbedtls
|
||||
pm3rrg_rdv4_cliparser
|
||||
pm3rrg_rdv4_jansson
|
||||
pm3rrg_rdv4_lua
|
||||
pm3rrg_rdv4_tinycbor
|
||||
pm3rrg_rdv4_amiibo
|
||||
|
|
|
@ -31,9 +31,9 @@ At the moment both are maintained because they don't perfectly overlap yet.
|
|||
| dep hardnested | in_deps | in_deps | |
|
||||
| hardn arch autodetect | `uname -m` =? 86 or amd64; `$(CC) -E -mavx512f`? +AVX512` | `CMAKE_SYSTEM_PROCESSOR` =? x86 or x86_64 or i686 or AMD64 (1) | (1) currently it always includes AVX512 on Intel arch |
|
||||
| `cpu_arch` | yes | **no/auto?** | e.g. `cpu_arch=generic` for cross-compilation
|
||||
| dep jansson | sys / in_deps | **in_deps only** | |
|
||||
| jansson detection | pc | **none** | |
|
||||
| `SKIPJANSSONSYSTEM` | yes | **no** | |
|
||||
| dep jansson | sys / in_deps | sys / in_deps | |
|
||||
| jansson detection | pc | pc/find* | |
|
||||
| `SKIPJANSSONSYSTEM` | yes | yes | |
|
||||
| dep lua | sys / in_deps(1) | **in_deps only**(2) | (1) manual def of `LUAPLATFORM` for mingw/macosx/linux (2) manual, different?, for Android too |
|
||||
| lua detection | pc | **none** | |
|
||||
| `SKIPLUASYSTEM` | yes | **no** | |
|
||||
|
|
Loading…
Reference in a new issue