mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-21 17:18:44 +02:00
Merge branch 'cmakelists_2' into wasm59_save
This commit is contained in:
+30
-26
@@ -12,7 +12,7 @@ project(MoneroCppLibrary)
|
||||
# monero-project
|
||||
###################
|
||||
|
||||
set(MONERO_CORE "external/monero-core")
|
||||
set(MONERO_CORE "${CMAKE_SOURCE_DIR}/external/monero-core")
|
||||
set(MONERO_CORE_SRC "${MONERO_CORE}/src")
|
||||
|
||||
# header includes
|
||||
@@ -73,11 +73,12 @@ set_target_properties(hidapi PROPERTIES IMPORTED_LOCATION
|
||||
#SET(BOOST_SRC ${BOOST}/boost)
|
||||
#SET(BOOST_LIB ${BOOST}/stage/lib)
|
||||
|
||||
SET(BOOST external/boost-sdk)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
SET(BOOST ${CMAKE_SOURCE_DIR}/external/boost-sdk)
|
||||
include_directories(${BOOST})
|
||||
link_directories(${EXTERNAL_LIBS_DIR}/boost)
|
||||
|
||||
find_package(Boost 1.69 REQUIRED COMPONENTS chrono date_time filesystem program_options regex serialization wserialization system thread)
|
||||
find_package(Boost 1.72 REQUIRED COMPONENTS chrono date_time filesystem program_options regex serialization wserialization system thread)
|
||||
|
||||
add_library(boost_chrono STATIC IMPORTED)
|
||||
set_target_properties(boost_chrono PROPERTIES IMPORTED_LOCATION
|
||||
@@ -113,13 +114,13 @@ set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION
|
||||
|
||||
add_library(boost_thread STATIC IMPORTED)
|
||||
set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/boost/libboost_thread-mt.a)
|
||||
${EXTERNAL_LIBS_DIR}/boost/libboost_thread.a)
|
||||
|
||||
############
|
||||
# OpenSSL
|
||||
############
|
||||
|
||||
include_directories(external/openssl-sdk/include)
|
||||
include_directories(./external/openssl-sdk/include)
|
||||
|
||||
add_library(crypto STATIC IMPORTED)
|
||||
set_target_properties(crypto PROPERTIES IMPORTED_LOCATION
|
||||
@@ -143,89 +144,92 @@ set_target_properties(sodium PROPERTIES IMPORTED_LOCATION
|
||||
# Monero
|
||||
#############
|
||||
|
||||
set(MONERO_CORE_BUILD "${MONERO_CORE}/build/release")
|
||||
message(STATUS MONERO_CORE_BUILD : ${MONERO_CORE_BUILD})
|
||||
|
||||
add_library(wallet_merged STATIC IMPORTED)
|
||||
set_target_properties(wallet_merged PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libwallet_merged.a)
|
||||
${MONERO_CORE_BUILD}/lib/libwallet_merged.a)
|
||||
|
||||
add_library(wallet STATIC IMPORTED)
|
||||
set_target_properties(wallet PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libwallet.a)
|
||||
${MONERO_CORE_BUILD}/lib/libwallet.a)
|
||||
|
||||
add_library(lmdb STATIC IMPORTED)
|
||||
set_target_properties(lmdb PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/liblmdb.a)
|
||||
${MONERO_CORE_BUILD}/external/db_drivers/liblmdb/liblmdb.a)
|
||||
|
||||
add_library(epee STATIC IMPORTED)
|
||||
set_target_properties(epee PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libepee.a)
|
||||
${MONERO_CORE_BUILD}/contrib/epee/src/libepee.a)
|
||||
|
||||
add_library(unbound STATIC IMPORTED)
|
||||
set_target_properties(unbound PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libunbound.a)
|
||||
${MONERO_CORE_BUILD}/external/unbound/libunbound.a)
|
||||
|
||||
add_library(easylogging STATIC IMPORTED)
|
||||
set_target_properties(easylogging PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libeasylogging.a)
|
||||
${MONERO_CORE_BUILD}/external/easylogging++/libeasylogging.a)
|
||||
|
||||
add_library(cryptonote_core STATIC IMPORTED)
|
||||
set_target_properties(cryptonote_core PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libcryptonote_core.a)
|
||||
${MONERO_CORE_BUILD}/src/cryptonote_core/libcryptonote_core.a)
|
||||
|
||||
add_library(cryptonote_basic STATIC IMPORTED)
|
||||
set_target_properties(cryptonote_basic PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libcryptonote_basic.a)
|
||||
${MONERO_CORE_BUILD}/src/cryptonote_basic/libcryptonote_basic.a)
|
||||
|
||||
add_library(mnemonics STATIC IMPORTED)
|
||||
set_target_properties(mnemonics PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libmnemonics.a)
|
||||
${MONERO_CORE_BUILD}/src/mnemonics/libmnemonics.a)
|
||||
|
||||
add_library(common STATIC IMPORTED)
|
||||
set_target_properties(common PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libcommon.a)
|
||||
${MONERO_CORE_BUILD}/src/common/libcommon.a)
|
||||
|
||||
add_library(cncrypto STATIC IMPORTED)
|
||||
set_target_properties(cncrypto PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libcncrypto.a)
|
||||
${MONERO_CORE_BUILD}/src/crypto/libcncrypto.a)
|
||||
|
||||
add_library(ringct STATIC IMPORTED)
|
||||
set_target_properties(ringct PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libringct.a)
|
||||
${MONERO_CORE_BUILD}/src/ringct/libringct.a)
|
||||
|
||||
add_library(ringct_basic STATIC IMPORTED)
|
||||
set_target_properties(ringct_basic PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libringct_basic.a)
|
||||
${MONERO_CORE_BUILD}/src/ringct/libringct_basic.a)
|
||||
|
||||
add_library(blockchain_db STATIC IMPORTED)
|
||||
set_target_properties(blockchain_db PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libblockchain_db.a)
|
||||
${MONERO_CORE_BUILD}/src/blockchain_db/libblockchain_db.a)
|
||||
|
||||
add_library(blocks STATIC IMPORTED)
|
||||
set_target_properties(blocks PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libblocks.a)
|
||||
${MONERO_CORE_BUILD}/src/blocks/libblocks.a)
|
||||
|
||||
add_library(checkpoints STATIC IMPORTED)
|
||||
set_target_properties(checkpoints PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libcheckpoints.a)
|
||||
${MONERO_CORE_BUILD}/src/checkpoints/libcheckpoints.a)
|
||||
|
||||
add_library(device STATIC IMPORTED)
|
||||
set_target_properties(device PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libdevice.a)
|
||||
${MONERO_CORE_BUILD}/src/device/libdevice.a)
|
||||
|
||||
add_library(device_trezor STATIC IMPORTED)
|
||||
set_target_properties(device_trezor PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libdevice_trezor.a)
|
||||
${MONERO_CORE_BUILD}/src/device_trezor/libdevice_trezor.a)
|
||||
|
||||
add_library(multisig STATIC IMPORTED)
|
||||
set_target_properties(multisig PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libmultisig.a)
|
||||
${MONERO_CORE_BUILD}/src/multisig/libmultisig.a)
|
||||
|
||||
add_library(version STATIC IMPORTED)
|
||||
set_target_properties(version PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/libversion.a)
|
||||
${MONERO_CORE_BUILD}/src/libversion.a)
|
||||
|
||||
add_library(randomx STATIC IMPORTED)
|
||||
set_target_properties(randomx PROPERTIES IMPORTED_LOCATION
|
||||
${EXTERNAL_LIBS_DIR}/monero-core/librandomx.a)
|
||||
${MONERO_CORE_BUILD}/external/randomx/librandomx.a)
|
||||
|
||||
########################
|
||||
# Build c++ library
|
||||
|
||||
@@ -143,35 +143,33 @@ wallet_restored->relay_tx(*created_tx); // submit the transaction to the Monero
|
||||
The following dependencies must be set up before running this project.
|
||||
|
||||
1. Set up Boost
|
||||
1. Download and extract the boost 1.69.0 source code zip from https://www.boost.org/users/download/ to ./external/boost-sdk/.
|
||||
1. Download and extract the boost 1.72.0 source code zip from https://www.boost.org/users/download/ to ./external/boost-sdk/.
|
||||
2. `cd ./external/boost-sdk/`
|
||||
3. `./bootstraph.sh`
|
||||
3. `./bootstrap.sh`
|
||||
4. `./b2`
|
||||
5. Copy .a files from ./external/boost-sdk/bin.v2/libs/\*/link-static/\* to ./external-libs/boost according to CMakeLists.txt.
|
||||
2. Set up OpenSSL
|
||||
1. Download and extract the latest OpenSSL source code zip from https://github.com/openssl/openssl to ./external/openssl-sdk/.
|
||||
2. Build for your system.<br>
|
||||
Mac: installed through boost at /usr/local/opt/openssl/lib
|
||||
3. Copy libcrypto.a and libssl.a ./external-libs/openssl.
|
||||
3. Set up Monero Core
|
||||
1. Initialize submodules: `git submodule update --init --recursive`
|
||||
2. cd ./submodules/monero-core
|
||||
3. Modify CMakeLists.txt: `option(BUILD_GUI_DEPS "Build GUI dependencies." ON)`.
|
||||
4. Build twice to create libwallet_merged.a in addition to other .a libraries: `make release-static -j8`.
|
||||
5. Copy .a files from ./submodules/monero-core/build/release/* to ./external-libs/monero-core according to CMakeLists.txt.
|
||||
4. Set up hidapi
|
||||
3. Copy libcrypto.a and libssl.a ./external-libs/openssl
|
||||
3. Set up hidapi
|
||||
1. Download the latest hidapi source code from https://github.com/signal11/hidapi.
|
||||
2. Build hidapi for your system.<br>
|
||||
Mac requires autoreconf: `brew install automake`
|
||||
3. Copy libhidapi.a to ./external-libs/hidapi.
|
||||
5. Set up libsodium
|
||||
4. Set up libsodium
|
||||
1. Build libsodium for your system.
|
||||
2. Copy libsodium.a to ./external-libs/libsodium.<br>
|
||||
Mac: installed through homebrew at /usr/local/Cellar/libsodium/1.0.17/lib/libsodium.a
|
||||
5. Set up Monero Core
|
||||
1. Initialize submodules: `git submodule update --init --recursive`
|
||||
2. cd ./submodules/monero-core
|
||||
3. Modify CMakeLists.txt: `option(BUILD_GUI_DEPS "Build GUI dependencies." ON)`.
|
||||
4. Build twice to create libwallet_merged.a in addition to other .a libraries: `make release-static -j8`.
|
||||
6. Build this project as a dynamic library at `./build/libmonero-cpp.dylib`: `./bin/build-libmonero-cpp.sh`.
|
||||
|
||||
After the dependencies are set up, this project may be compiled as part of another application, as a dynamic library, or as a shared library. For example, the associated [Java library](https://github.com/monero-ecosystem/monero-java-rpc) depends on a dynamic library built from this project to support a wallet using Java JNI.
|
||||
|
||||
To build this project as a dynamic library at `./build/libmonero-cpp.dylib`, execute: `./bin/build-libmonero-cpp.sh`.
|
||||
This project may be compiled as part of another application, as a dynamic library, or as a shared library. For example, the associated [Java library](https://github.com/monero-ecosystem/monero-java-rpc) depends on a dynamic library built from this project to support a wallet using Java JNI.
|
||||
|
||||
These build steps aspire to be automated further and [any help is greatly appreciated](https://github.com/woodser/monero-cpp-library/issues/1).
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Make libmonero-cpp.dylib
|
||||
cd ./external/monero-core/ &&
|
||||
make release-static -j8 &&
|
||||
|
||||
# Make libmonero-cpp.dylib
|
||||
cd ../../ &&
|
||||
mkdir -p build &&
|
||||
cd build &&
|
||||
cmake .. &&
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "wallet2.h"
|
||||
#include "wallet/monero_wallet.h"
|
||||
#include "wallet/monero_wallet_core.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -29,7 +29,7 @@ int main(int argc, const char* argv[]) {
|
||||
int network_type = 2;
|
||||
|
||||
// load wallet
|
||||
monero_wallet* wallet = monero_wallet::open_wallet("../../test_wallets/test_wallet_1", "supersecretpassword123", monero_network_type::STAGENET);
|
||||
monero_wallet* wallet = monero_wallet_core::open_wallet("../../test_wallets/test_wallet_1", "supersecretpassword123", monero_network_type::STAGENET);
|
||||
wallet->set_daemon_connection("http://localhost:38081", "", "");
|
||||
|
||||
// fetch txs
|
||||
|
||||
Reference in New Issue
Block a user