Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
nsec1 committed Sep 18, 2024
1 parent 988b870 commit 1f30f04
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
46 changes: 25 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
)
Expand Down Expand Up @@ -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}
)
Expand Down Expand Up @@ -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}
)
Expand Down Expand Up @@ -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}
)
Expand Down
6 changes: 4 additions & 2 deletions bin/build_libmonero_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -55,14 +57,14 @@ 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 ../../

# 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 .

0 comments on commit 1f30f04

Please sign in to comment.