mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
[Refactor] Modular CMake setup with unified module handling
[Add] JuiceModule.cmake function add_juice_module to create modules with source collection, include dirs, linking, and optional compile definitions [Change] Root CMakeLists.txt now calls add_juice_module for core, injector, loader; no need to repeat add_subdirectory per module [Change] target_compile_definitions for module-specific macros (e.g., agent) moved to function end to ensure target exists before setting [Improve] Simplified module management and build clarity
This commit is contained in:
1 parent
a11fbf76ab
commit
32f2d5c116
9 files changed
+45
-64
No files matched your search
@@ -0,0 +1,4 @@
|
||||
# src/core/CMakeLists.txt
|
||||
|
||||
|
||||
target_compile_definitions(agent PRIVATE REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR)
|
||||
File renamed without changes.
@@ -1,23 +0,0 @@
|
||||
link_directories("$ENV{JAVA_HOME}/lib")
|
||||
|
||||
file(GLOB CORE_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/utils/*.c"
|
||||
)
|
||||
|
||||
add_library(agent SHARED ${CORE_SOURCES})
|
||||
|
||||
target_include_directories(agent PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils
|
||||
${INCLUDES}/jvm
|
||||
${INCLUDES}/jvm/win32
|
||||
${INCLUDES}/JuiceLoader
|
||||
)
|
||||
|
||||
target_compile_definitions(agent PRIVATE REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR)
|
||||
|
||||
target_link_libraries(agent PRIVATE
|
||||
ReflectiveDLLInjection
|
||||
jvm
|
||||
)
|
||||
@@ -1,21 +1,2 @@
|
||||
link_directories("$ENV{JAVA_HOME}/lib")
|
||||
# src/injector/CMakeLists.txt
|
||||
|
||||
file(GLOB INJECTOR_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/utils/*.c"
|
||||
)
|
||||
|
||||
add_library(injector SHARED ${INJECTOR_SOURCES})
|
||||
|
||||
target_include_directories(injector PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils
|
||||
${INCLUDES}/jvm
|
||||
${INCLUDES}/jvm/win32
|
||||
${INCLUDES}/JuiceLoader
|
||||
)
|
||||
|
||||
target_link_libraries(injector PRIVATE
|
||||
jvm
|
||||
ReflectiveDLLInjection
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
# src/loader/CMakeLists.txt
|
||||
File renamed without changes.
@@ -1,18 +0,0 @@
|
||||
link_directories("$ENV{JAVA_HOME}/lib")
|
||||
|
||||
file(GLOB LOADER_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/utils/*.c"
|
||||
)
|
||||
|
||||
add_library(juiceloader SHARED ${LOADER_SOURCES})
|
||||
|
||||
target_include_directories(juiceloader PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/utils
|
||||
${INCLUDES}/jvm
|
||||
${INCLUDES}/jvm/win32
|
||||
${INCLUDES}/JuiceLoader
|
||||
)
|
||||
|
||||
target_link_libraries(juiceloader PRIVATE jvm)
|
||||
Reference in new issue
Block a user