Files
JuiceAgent/cmake/JuiceModule.cmake
T
xiaozhou233 126e255a85 [Update] log system
- [Add] New `log.c` module based on rxi's MIT-licensed log library
- [Implement] Runtime switches to enable/disable output elements:
  - log_is_log_time()
  - log_is_log_level()
  - log_is_log_filename()
  - log_is_log_line()
- [Improve] stdout and file callbacks now respect user-defined output settings
- [Remove] Remove some useless logic
2025-10-08 15:57:37 +08:00

37 lines
1.1 KiB
CMake

# JuiceModule.cmake
# Function to add a JuiceAgent module (agent, injector, juiceloader)
function(add_juice_module NAME)
link_directories("$ENV{JAVA_HOME}/lib")
# Collect all source files in module src and utils
file(GLOB MODULE_SOURCES
"${CMAKE_SOURCE_DIR}/src/${NAME}/*.c"
"${CMAKE_SOURCE_DIR}/src/${NAME}/utils/*.c"
)
# Create shared library
add_library(${NAME} SHARED ${MODULE_SOURCES})
# Include directories
target_include_directories(${NAME} PRIVATE
${CMAKE_SOURCE_DIR}/includes
${CMAKE_SOURCE_DIR}/includes/jvm
${CMAKE_SOURCE_DIR}/includes/jvm/win32
${CMAKE_SOURCE_DIR}/includes/JuiceLoader
${CMAKE_SOURCE_DIR}/includes/ReflectiveDLLInjection
${CMAKE_SOURCE_DIR}/includes/log.c
"${CMAKE_SOURCE_DIR}/src/${NAME}/utils"
"${CMAKE_SOURCE_DIR}/src/${NAME}/include"
)
# Link common libraries
target_link_libraries(${NAME} PRIVATE
ReflectiveDLLInjection
log.c
jvm
)
add_subdirectory("${CMAKE_SOURCE_DIR}/src/${NAME}")
endfunction()