re-arrange link order to fix linux build

only import libwallet-crypto.a if it exists
This commit is contained in:
woodser
2022-08-12 21:59:32 -04:00
parent 225fbab5e9
commit 7d6e456cc4
2 changed files with 38 additions and 23 deletions
+37 -22
View File
@@ -30,6 +30,7 @@ include_directories("${MONERO_PROJECT}/external/rapidjson/include")
include_directories("${MONERO_PROJECT_SRC}/")
include_directories("${MONERO_PROJECT_SRC}/wallet")
include_directories("${MONERO_PROJECT_SRC}/wallet/api")
include_directories("${MONERO_PROJECT_SRC}/hardforks")
include_directories("${MONERO_PROJECT_SRC}/crypto/crypto_ops_builder/include/")
set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/external-libs)
@@ -140,7 +141,7 @@ find_package(HIDAPI REQUIRED)
message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
add_definitions(-DHAVE_HIDAPI)
include_directories(${HIDAPI_INCLUDE_DIR})
#############
# Monero
#############
@@ -153,20 +154,26 @@ list(APPEND CMAKE_MODULE_PATH "${MONERO_PROJECT}/cmake")
add_library(wallet STATIC IMPORTED)
set_target_properties(wallet PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/lib/libwallet.a)
add_library(wallet_crypto STATIC IMPORTED)
set_target_properties(wallet_crypto PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/src/crypto/wallet/libwallet-crypto.a)
# libwallet-crypto.a provides x86_64 asm for some wallet functions
if (EXISTS ${MONERO_PROJECT_BUILD}/src/crypto/wallet/libwallet-crypto.a)
add_library(wallet_crypto_lib STATIC IMPORTED)
set_target_properties(wallet_crypto_lib PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/src/crypto/wallet/libwallet-crypto.a)
set(wallet_crypto wallet_crypto_lib)
endif()
add_library(lmdb STATIC IMPORTED)
set_target_properties(lmdb PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/external/db_drivers/liblmdb/liblmdb.a)
add_library(epee STATIC IMPORTED)
set_target_properties(epee PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/contrib/epee/src/libepee.a)
# Unbound
find_package(Unbound)
include_directories(${UNBOUND_INCLUDE_DIR})
if ("${UNBOUND_LIBRARIES}" MATCHES "libunbound")
message(STATUS "Using libunbound: ${UNBOUND_LIBRARIES}")
add_library(unbound SHARED IMPORTED)
@@ -177,7 +184,7 @@ endif()
add_library(rpc_base STATIC IMPORTED)
set_target_properties(rpc_base PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/src/rpc/librpc_base.a)
add_library(net STATIC IMPORTED)
set_target_properties(net PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/src/net/libnet.a)
@@ -194,6 +201,10 @@ add_library(cryptonote_core STATIC IMPORTED)
set_target_properties(cryptonote_core PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/src/cryptonote_core/libcryptonote_core.a)
add_library(cryptonote_protocol STATIC IMPORTED)
set_target_properties(cryptonote_protocol PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/src/cryptonote_protocol/libcryptonote_protocol.a)
add_library(cryptonote_basic STATIC IMPORTED)
set_target_properties(cryptonote_basic PROPERTIES IMPORTED_LOCATION
${MONERO_PROJECT_BUILD}/src/cryptonote_basic/libcryptonote_basic.a)
@@ -274,16 +285,13 @@ if (BUILD_LIBRARY)
target_link_libraries(monero-cpp
wallet
wallet_crypto
rpc_base
net
hardforks
lmdb
epee
unbound
easylogging
cryptonote_core
cryptonote_protocol
cryptonote_basic
cryptonote_format_utils_basic
mnemonics
@@ -299,7 +307,12 @@ if (BUILD_LIBRARY)
multisig
version
randomx
epee
hardforks
cncrypto
${wallet_crypto}
${UNBOUND_LIBRARIES}
${Boost_LIBRARIES}
${Protobuf_LIBRARY}
${LibUSB_LIBRARIES}
@@ -337,16 +350,12 @@ if (BUILD_SAMPLE)
target_link_libraries(sample_code
wallet
wallet_crypto
rpc_base
net
hardforks
lmdb
epee
unbound
easylogging
cryptonote_core
cryptonote_protocol
cryptonote_basic
cryptonote_format_utils_basic
mnemonics
@@ -363,7 +372,12 @@ if (BUILD_SAMPLE)
version
randomx
dl
epee
hardforks
cncrypto
${wallet_crypto}
${UNBOUND_LIBRARIES}
${Boost_LIBRARIES}
${Protobuf_LIBRARY}
${LibUSB_LIBRARIES}
@@ -385,16 +399,12 @@ if (BUILD_SCRATCHPAD)
target_link_libraries(scratchpad
wallet
wallet_crypto
rpc_base
net
hardforks
lmdb
epee
unbound
easylogging
cryptonote_core
cryptonote_protocol
cryptonote_basic
cryptonote_format_utils_basic
mnemonics
@@ -411,7 +421,12 @@ if (BUILD_SCRATCHPAD)
version
randomx
dl
epee
hardforks
cncrypto
${wallet_crypto}
${UNBOUND_LIBRARIES}
${Boost_LIBRARIES}
${Protobuf_LIBRARY}
${LibUSB_LIBRARIES}
+1 -1
View File
@@ -167,7 +167,7 @@ This project may be compiled as part of another application or built as a shared
For example, [monero-java](https://github.com/monero-ecosystem/monero-java) compiles this project to a shared library to support Java JNI bindings, while [monero-javascript](https://github.com/monero-ecosystem/monero-javascript) compiles this project to WebAssembly binaries.
1. Install [monero-project dependencies](https://github.com/monero-project/monero#dependencies) for your system<br>
Ubuntu: `sudo apt install git libboost-all-dev cmake g++ make libssl-dev libzmq3-dev libhidapi-dev libudev-dev libusb-1.0-0-dev libfox-1.6-dev`
Ubuntu: `sudo apt install git libboost-all-dev cmake g++ make libssl-dev libzmq3-dev libhidapi-dev libudev-dev libusb-1.0-0-dev libfox-1.6-dev protobuf-compiler`
2. If building this library standalone instead of as a submodule in another project, clone the project repository and update its submodules:
1. `git clone --recurse-submodules https://github.com/monero-ecosystem/monero-cpp.git`
2. `cd ./monero-cpp && ./bin/update_submodules.sh`