Skip to content

Commit

Permalink
building static libraries with shared library wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
nsec1 committed Jun 26, 2024
1 parent 00dbecd commit 15d4918
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 $<TARGET_OBJECTS:monero-java-static>)

if (WIN32)
target_link_options(monero-java PUBLIC "-Wl,--enable-auto-import,--export-all-symbols")
endif()
Expand Down

0 comments on commit 15d4918

Please sign in to comment.