From 15d49189f8de8fe4e709a4e400c4d85b65933655 Mon Sep 17 00:00:00 2001 From: nsec1 <167650977+nsec1@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:14:30 -0300 Subject: [PATCH] building static libraries with shared library wrapper Ref. #74 haveno-dex/haveno#795 --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f3ddced..262faf47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,9 +110,9 @@ set( MONERO_JNI_SRC_FILES src/main/cpp/monero_jni_bridge.cpp ) -add_library(monero-java SHARED ${MONERO_JNI_SRC_FILES}) +add_library(monero-java-static STATIC ${MONERO_JNI_SRC_FILES}) -target_include_directories(monero-java PUBLIC +target_include_directories(monero-java-static PUBLIC "$ENV{JAVA_HOME}" "$ENV{JAVA_HOME}/include" "${MONERO_CPP}/external/libsodium/include/sodium" @@ -132,20 +132,22 @@ target_include_directories(monero-java PUBLIC ) if (APPLE) - target_include_directories(monero-java PUBLIC "$ENV{JAVA_HOME}/include/darwin") + target_include_directories(monero-java-static PUBLIC "$ENV{JAVA_HOME}/include/darwin") elseif (WIN32) - target_include_directories(monero-java PUBLIC "$ENV{JAVA_HOME}/include/win32") + target_include_directories(monero-java-static PUBLIC "$ENV{JAVA_HOME}/include/win32") else() - target_include_directories(monero-java PUBLIC "$ENV{JAVA_HOME}/include/linux") + target_include_directories(monero-java-static PUBLIC "$ENV{JAVA_HOME}/include/linux") endif() -target_link_libraries(monero-java +target_link_libraries(monero-java-static monero-cpp ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXTRA_LIBRARIES} ) +add_library(monero-java SHARED $) + if (WIN32) target_link_options(monero-java PUBLIC "-Wl,--enable-auto-import,--export-all-symbols") endif()