From 1f30f04cfef907126d242ce30eae817df6fe4f5b Mon Sep 17 00:00:00 2001 From: nsec1 <167650977+nsec1@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:06:34 -0300 Subject: [PATCH] fix build --- CMakeLists.txt | 46 +++++++++++++++++++++----------------- bin/build_libmonero_cpp.sh | 6 +++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5112dbb8..59cd2c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,22 +130,34 @@ endif() ############ find_library(SODIUM_LIBRARY sodium REQUIRED) -message(STATUS "Using libsodium library at ${SODIUM_LIBRARY}") +if(SODIUM_LIBRARY) + message(STATUS "Using libsodium library at ${SODIUM_LIBRARY}") + find_path(SODIUM_INCLUDE_PATH sodium/crypto_verify_32.h) + if (SODIUM_INCLUDE_PATH) + message(STATUS "SODIUM_INCLUDE_PATH: ${SODIUM_INCLUDE_PATH}") + else() + message(FATAL_ERROR "Could not find required sodium/crypto_verify_32.h") + endif() +endif() + ############ # HIDAPI ############ -if(APPLE) - include_directories(SYSTEM /usr/include/malloc) - if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) +option(USE_DEVICE_TREZOR "Trezor hardware wallet suport" ON) +if (USE_DEVICE_TREZOR) + if(APPLE) + include_directories(SYSTEM /usr/include/malloc) + if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) + endif() endif() -endif() -find_package(HIDAPI REQUIRED) -message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") -add_definitions(-DHAVE_HIDAPI) + find_package(HIDAPI REQUIRED) + message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") + add_definitions(-DHAVE_HIDAPI) +endif() ############# # Monero @@ -315,12 +327,10 @@ if (BUILD_LIBRARY) "${MONERO_PROJECT_SRC}/wallet/api" "${MONERO_PROJECT_SRC}/hardforks" "${MONERO_PROJECT_SRC}/crypto" - "${MONERO_PROJECT_SRC}/crypto/crypto_ops_builder/include/" + ${SODIUM_INCLUDE_PATH} ${Protobuf_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} - external/libsodium/include/sodium - external/openssl-sdk/include ${HIDAPI_INCLUDE_DIR} ${UNBOUND_INCLUDE_DIR} ) @@ -408,12 +418,10 @@ if (BUILD_SAMPLE) "${MONERO_PROJECT_SRC}/wallet/api" "${MONERO_PROJECT_SRC}/hardforks" "${MONERO_PROJECT_SRC}/crypto" - "${MONERO_PROJECT_SRC}/crypto/crypto_ops_builder/include/" + ${SODIUM_INCLUDE_PATH} ${Protobuf_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} - external/libsodium/include/sodium - external/openssl-sdk/include ${HIDAPI_INCLUDE_DIR} ${UNBOUND_INCLUDE_DIR} ) @@ -479,12 +487,10 @@ if (BUILD_SCRATCHPAD) "${MONERO_PROJECT_SRC}/wallet/api" "${MONERO_PROJECT_SRC}/hardforks" "${MONERO_PROJECT_SRC}/crypto" - "${MONERO_PROJECT_SRC}/crypto/crypto_ops_builder/include/" + ${SODIUM_INCLUDE_PATH} ${Protobuf_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} - external/libsodium/include/sodium - external/openssl-sdk/include ${HIDAPI_INCLUDE_DIR} ${UNBOUND_INCLUDE_DIR} ) @@ -550,12 +556,10 @@ if (BUILD_TESTS) "${MONERO_PROJECT_SRC}/wallet/api" "${MONERO_PROJECT_SRC}/hardforks" "${MONERO_PROJECT_SRC}/crypto" - "${MONERO_PROJECT_SRC}/crypto/crypto_ops_builder/include/" + ${SODIUM_INCLUDE_PATH} ${Protobuf_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} - external/libsodium/include/sodium - external/openssl-sdk/include ${HIDAPI_INCLUDE_DIR} ${UNBOUND_INCLUDE_DIR} ) diff --git a/bin/build_libmonero_cpp.sh b/bin/build_libmonero_cpp.sh index b7d378aa..70e44fd0 100755 --- a/bin/build_libmonero_cpp.sh +++ b/bin/build_libmonero_cpp.sh @@ -5,9 +5,11 @@ BUILD_DIR="$(pwd)/build" INSTALL_DIR="$BUILD_DIR/install" export CMAKE_PREFIX_PATH=$INSTALL_DIR${CMAKE_PREFIX_PATH+:$CMAKE_PREFIX_PATH} export OPENSSL_ROOT_DIR=$INSTALL_DIR +USE_DEVICE_TREZOR=${USE_DEVICE_TREZOR-ON} echo "HOST_NCORES=$HOST_NCORES in $0" echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH in $0" echo "OPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR in $0" +echo "USE_DEVICE_TREZOR=$USE_DEVICE_TREZOR in $0" [ -d $INSTALL_DIR ] || mkdir -p $INSTALL_DIR @@ -55,7 +57,7 @@ else (cd $MONERO_BUILD_DIR && \ cmake -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release \ -D OPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR \ - -D USE_DEVICE_TREZOR=OFF \ + -D USE_DEVICE_TREZOR=${USE_DEVICE_TREZOR} \ ../.. && make -j$HOST_NCORES wallet) || exit 1 fi cd ../../ @@ -63,6 +65,6 @@ cd ../../ # build libmonero-cpp shared library mkdir -p build && cd build && -cmake $@ .. && +cmake -D USE_DEVICE_TREZOR=${USE_DEVICE_TREZOR} $@ .. && cmake --build . && make -j$HOST_NCORES .