From 2562811433df46708828de457ae0e992beb52afa Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 6 Jan 2022 20:26:20 +0100 Subject: [PATCH] Revert "get android cmake running on host, only for testing" This reverts commit 3edf9a0975d136f0866aa349ad03c2d3f7ced845. --- client/android/CMakeLists.txt | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/client/android/CMakeLists.txt b/client/android/CMakeLists.txt index 72c68ab66..9bf318d09 100644 --- a/client/android/CMakeLists.txt +++ b/client/android/CMakeLists.txt @@ -10,7 +10,32 @@ set(PM3_ROOT ../../) add_subdirectory(../deps deps) -find_package (BZip2 REQUIRED) +# Build zlib deps at external +if (CMAKE_MAKE_PROGRAM MATCHES ".*ninja.*") + set(BZIP2_INCLUDE_DIRS ${BZIP2_ROOT}) + set(BZIP2_LIBRARIES pm3rrg_rdv4_bzip2) +elseif (UNIX) # Cross compile at Unix Makefile System. + # bzip2 dep. + include(ExternalProject) + set(CFLAGS_EXTERNAL_LIB "CFLAGS=--target=${CMAKE_C_COMPILER_TARGET} -w") + set(BZIP2_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2) + ExternalProject_Add(bzip2 + GIT_REPOSITORY https://android.googlesource.com/platform/external/bzip2 + GIT_TAG platform-tools-30.0.2 + PREFIX deps/bzip2 + #SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/bzip2 + CONFIGURE_COMMAND mkdir -p ${BZIP2_BUILD_DIR} && git archive --format tar HEAD | tar -C ${BZIP2_BUILD_DIR} -x + BUILD_IN_SOURCE ON + BUILD_COMMAND make -C ${BZIP2_BUILD_DIR} -j4 CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} libbz2.a + INSTALL_COMMAND "" + LOG_DOWNLOAD ON + ) + ExternalProject_Add_StepTargets(bzip2 configure build install) + set(BZIP2_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2) + set(BZIP2_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2/libbz2.a) +else () + message(ERROR "Please implement your BZIP2 import.") +endif () # client resources add_library(pm3rrg_rdv4 SHARED @@ -175,7 +200,9 @@ add_library(pm3rrg_rdv4 SHARED ${PM3_ROOT}/client/src/util.c ${PM3_ROOT}/client/src/wiegand_formats.c ${PM3_ROOT}/client/src/wiegand_formatutils.c - ${PM3_ROOT}/client/src/proxmark3.c + # android resources + jni_tools.c + pm3_main.c ) # includes @@ -200,4 +227,5 @@ target_link_libraries(pm3rrg_rdv4 pm3rrg_rdv4_amiibo pm3rrg_rdv4_reveng pm3rrg_rdv4_whereami - ) + android + log)