Signed-off-by: Faumaray <faumaray@gmail.com>
This commit is contained in:
19 files changed
+579
-10
No files matched your search
+26
-6
@@ -4,10 +4,14 @@ project(VoidLoader LANGUAGES CXX)
|
||||
# ============================================================
|
||||
# Project settings
|
||||
# ============================================================
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
include(FetchContent)
|
||||
|
||||
add_compile_options(-ffunction-sections -fdata-sections)
|
||||
add_link_options(-Wl,--gc-sections)
|
||||
# ============================================================
|
||||
# Source / includes
|
||||
# ============================================================
|
||||
@@ -33,6 +37,15 @@ if (DEFINED ENV{JAVA_HOME})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
VoidLoaderApi
|
||||
GIT_REPOSITORY https://git.faumaray.ru/VoidLoader/VoidLoaderApi.git
|
||||
GIT_TAG main # release-1.10.0
|
||||
)
|
||||
|
||||
|
||||
FetchContent_MakeAvailable(VoidLoaderApi)
|
||||
|
||||
# ============================================================
|
||||
# Platform flags
|
||||
# ============================================================
|
||||
@@ -47,24 +60,31 @@ endif()
|
||||
# ============================================================
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${JNI_LIBRARIES})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${JNI_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC JNI::JNI VoidLoaderApi)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_link_options(${PROJECT_NAME} PRIVATE -static-libstdc++ -static-libgcc)
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
-Wl,-z,defs # no undefined symbols at link
|
||||
-Wl,--no-undefined
|
||||
-Wl,--as-needed
|
||||
-static-libstdc++ # pull libstdc++ into .so
|
||||
-static-libgcc # pull libgcc into .so
|
||||
-Wl,-O1
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
# Output name: YourAgent.dll / libYourAgent.so
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "VoidLoader"
|
||||
)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_options(${PROJECT_NAME} PRIVATE -Wl,--enable-new-dtags -Wl,-rpath,\$ORIGIN)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN")
|
||||
endif()
|
||||
|
||||
# ============================================================
|
||||
# Dep bundler (Option B: auto-scan & copy non-system deps)
|
||||
# ============================================================
|
||||
|
||||
Reference in new issue
Block a user