From f3c2e394383ed4f554ddf9c24a5f420445a405b1 Mon Sep 17 00:00:00 2001 From: chiteroman Date: Wed, 4 Sep 2024 01:16:58 +0200 Subject: [PATCH] Refactor CMake --- app/src/main/cpp/CMakeLists.txt | 52 +++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt index 7ada73ea..7a12f2a1 100644 --- a/app/src/main/cpp/CMakeLists.txt +++ b/app/src/main/cpp/CMakeLists.txt @@ -1,15 +1,37 @@ -cmake_minimum_required(VERSION 3.22.1) - -project("playintegrityfix") - -find_package(cxx REQUIRED CONFIG) - -link_libraries(cxx::cxx) - -add_library(${CMAKE_PROJECT_NAME} SHARED main.cpp cJSON/cJSON.c) - -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE cJSON) - -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE log dobby_static) - -add_subdirectory(Dobby) +cmake_minimum_required(VERSION 3.22.1) + +project("playintegrityfix") + +find_package(cxx REQUIRED CONFIG) + +if (${ANDROID_ABI} STREQUAL "arm64-v8a") + set(ARCH "arm64") +elseif (${ANDROID_ABI} STREQUAL "armeabi-v7a") + set(ARCH "arm") +endif () + +file(GLOB SHADOWHOOK_SRC + shadowhook/*.c + shadowhook/arch/${ARCH}/*.c + shadowhook/common/*.c + shadowhook/third_party/xdl/*.c +) + +add_library(${CMAKE_PROJECT_NAME} SHARED + main.cpp + cJSON/cJSON.c + ${SHADOWHOOK_SRC} +) + +target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE + cJSON + shadowhook/shadowhook/src/main/cpp + shadowhook/arch/${ARCH} + shadowhook/include + shadowhook/common + shadowhook/third_party/bsd + shadowhook/third_party/lss + shadowhook/third_party/xdl +) + +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE log cxx::cxx)