Skip to content

Commit

Permalink
build single dylibs to project build directories
Browse files Browse the repository at this point in the history
Former-commit-id: e34daec
  • Loading branch information
woodser committed Dec 11, 2019
1 parent 54b0d13 commit 397550a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="monero-java/lib"/>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="monero-java/build"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
**/pom.xml.versionsBackup
**/logs
/test_wallets
/lib/
/external-libs/
/log_java_tests.txt
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ project(MoneroJavaJni)
# System
#############

set(MONERO_CPP "external/monero-cpp-library")
set(MONERO_CPP "${CMAKE_SOURCE_DIR}/external/monero-cpp-library")
message(STATUS MONERO_CPP : ${MONERO_CPP} : ${MONERO_CPP})

set(MONERO_CPP_SRC "${MONERO_CPP}/src")
set(MONERO_CORE ${MONERO_CPP}/external/monero-core)
set(MONERO_CORE_SRC "${MONERO_CORE}/src")
Expand All @@ -33,9 +35,6 @@ include_directories("${MONERO_CORE_SRC}/wallet/api")
include_directories("${MONERO_CORE_SRC}/crypto/crypto_ops_builder/include/")
include_directories(${BOOST})

set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/external-libs)
message(STATUS EXTERNAL_LIBS_DIR : ${EXTERNAL_LIBS_DIR})

# TODO: remove TRUEs, how are APPLE, DEPENDS, etc initialized?
if (TRUE OR HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
if (TRUE OR APPLE)
Expand Down Expand Up @@ -63,7 +62,7 @@ message(STATUS EXTRA_LIBRARIES: ${EXTRA_LIBRARIES})
#include_directories(${BOOST})
add_library(monero-cpp SHARED IMPORTED)
set_target_properties(monero-cpp PROPERTIES IMPORTED_LOCATION
${EXTERNAL_LIBS_DIR}/libmonero-cpp.dylib)
${MONERO_CPP}/build/libmonero-cpp.dylib)

###############################################
# Build Java dynamic library (.dylib) for JNI
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
**Compatible with [Monero Core v0.15.0.1](https://web.getmonero.org/downloads/) Carbon Chameleon**

# Monero Java Library

This project is a library for using a Monero wallet and daemon in Java using RPC and JNI bindings to [Monero Core](https://github.com/monero-project/monero).

In addition, this project conforms to an [API specification](http://moneroecosystem.org/monero-java/monero-spec.pdf) intended to be intuitive, robust, and suitable for long-term use in the Monero project.

This library is compatible with [Monero Core v0.15.0.1 Carbon Chamaeleon](https://github.com/monero-project/monero/tree/v0.15.0.1).

## Main Features

- Manage a Monero daemon using RPC
Expand Down Expand Up @@ -143,14 +143,12 @@ walletJni.close(true);

You are now ready to use this library with [monero-daemon-rpc](https://getmonero.org/resources/developer-guides/daemon-rpc.html) and [monero-wallet-rpc](https://getmonero.org/resources/developer-guides/wallet-rpc.html) endpoints.

If you want to process binary data or use a Monero wallet using JNI instead of RPC, a dynamic library must be built for your specific platform for this Java library to use. This project uses a [C++ counterpart library](https://github.com/woodser/monero-cpp-library) to support JNI (included as a submodule in ./external/monero-cpp-library).
If you want to process binary data or use a Monero wallet using JNI instead of RPC, a dynamic library must be built for your specific platform for this Java library to use. This project uses a [C++ counterpart library](https://github.com/woodser/monero-cpp-library) to support JNI, which is included as a submodule in ./external/monero-cpp-library.

1. [Build the C++ library as a dynamic library](https://github.com/woodser/monero-cpp-library#building-a-dynamic--shared-library)
2. Copy the built libmonero-cpp.dylib in step 1 to ./external-libs
3. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/` (change as appropriate)
4. Build libmonero-java.dylib to ./build: `./bin/build-libmonero-java.sh`
5. Copy ./build/libmonero-java.dylib to ./lib
6. Run TestMoneroCppUtils.java JUnit tests to verify the dynamic library is working with Java JNI
1. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/` (change as appropriate)
2. `cd <project_root>`
3. `./bin/build-libmonero-java.sh
4. Run TestMoneroCppUtils.java JUnit tests to verify the dynamic library is working with Java JNI

## How to Run Monero RPC

Expand Down
20 changes: 0 additions & 20 deletions bin/build-and-install-libmonero-java.sh

This file was deleted.

8 changes: 7 additions & 1 deletion bin/build-libmonero-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

#EMCC_DEBUG=1

mkdir -p build &&
# Make libmonero-cpp.dylib
cd ./external/monero-cpp-library/ &&
./bin/build-libmonero-cpp.sh &&

# Make libmonero-java.dylib and copy to ./lib
cd ../../ &&
mkdir -p ./build &&
cd build &&
cmake .. &&
cmake --build . &&
Expand Down

0 comments on commit 397550a

Please sign in to comment.