Skip to content

Commit

Permalink
cmake fetch dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
hangedfish committed Dec 9, 2024
1 parent b0aeb2e commit 11cfd54
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
34 changes: 24 additions & 10 deletions shell/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
cmake_minimum_required(VERSION 3.18.1)
cmake_minimum_required(VERSION 3.31.1)

project("dpt")

include(FetchContent)

FetchContent_Declare(
minizip_ng
GIT_REPOSITORY https://github.com/zlib-ng/minizip-ng.git
GIT_TAG 4.0.7
)
set(MZ_LZMA OFF CACHE BOOL "" FORCE)
set(MZ_ZSTD OFF CACHE BOOL "" FORCE)
set(MZ_OPENSSL OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(minizip_ng)

set(patch_book git apply ${CMAKE_CURRENT_SOURCE_DIR}/patches/bhook_add_static_lib.patch)
FetchContent_Declare(
bhook
GIT_REPOSITORY https://github.com/bytedance/bhook.git
GIT_TAG v1.0.5
PATCH_COMMAND ${patch_book}
SOURCE_SUBDIR bytehook/src/main/cpp
)
FetchContent_MakeAvailable(bhook)


set(DPT_NATIVE_SOURCE
dpt.cpp
dpt_hook.cpp
Expand Down Expand Up @@ -40,14 +63,8 @@ else()
message("closed log & stripped so symbols")
endif()


option(MZ_LZMA "Enables LZMA & XZ compression" OFF)
option(MZ_ZSTD "Enables ZSTD compression" OFF)
option(MZ_OPENSSL "Enables OpenSSL for encryption" OFF)

include_directories(./ )
include_directories(./common)
include_directories(./bhook/include)
include_directories(./minizip-ng)

add_library(dpt
Expand All @@ -59,9 +76,6 @@ include_directories(
dobby
)

add_subdirectory(bhook)
add_subdirectory(minizip-ng)

add_library(local_dobby STATIC IMPORTED)
set_target_properties(local_dobby PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libdobby.a)

Expand Down
17 changes: 17 additions & 0 deletions shell/src/main/cpp/patches/bhook_add_static_lib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/bytehook/src/main/cpp/CMakeLists.txt b/bytehook/src/main/cpp/CMakeLists.txt
index 9608bd3..690b8a5 100644
--- a/bytehook/src/main/cpp/CMakeLists.txt
+++ b/bytehook/src/main/cpp/CMakeLists.txt
@@ -4,9 +4,9 @@ project(bytehook)
enable_language(ASM)

file(GLOB SRC *.c)
-add_library(bytehook SHARED ${SRC})
-target_compile_features(bytehook PUBLIC c_std_11)
-target_compile_options(bytehook PUBLIC -Weverything -Werror)
+add_library(bytehook STATIC ${SRC})
+# target_compile_features(bytehook PUBLIC c_std_11)
+# target_compile_options(bytehook PUBLIC -Weverything -Werror)
target_include_directories(bytehook PUBLIC . include third_party/bsd third_party/lss)
target_link_libraries(bytehook log)

0 comments on commit 11cfd54

Please sign in to comment.