Skip to content

Commit

Permalink
fix zmq and sodium include dirs search and small adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
nsec1 committed Sep 6, 2024
1 parent 78c3f37 commit 334442a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "external/monero-project"]
path = external/monero-project
url = https://github.com/woodser/monero
url = https://github.com/nsec1/monero.git
branch = fixIncludePaths
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ set(BUILD_SAMPLE OFF)
set(BUILD_SCRATCHPAD OFF)
set(BUILD_TESTS OFF)

message(STATUS CMAKE_PREFIX_PATH : ${CMAKE_PREFIX_PATH})
option(STATIC "Build using static libraries")
if(STATIC)
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DZMQ_STATIC")
endif()


###################
# monero-project
Expand Down Expand Up @@ -103,7 +112,6 @@ endif()
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
message(STATUS "Using OpenSSL include dir at ${OPENSSL_INCLUDE_DIR}")
message(STATUS "Using OpenSSL lib version: ${OPENSSL_LIB_VERSION}")
message(STATUS "Using OpenSSL libs: ${OPENSSL_LIBRARIES}")
endif()

Expand Down Expand Up @@ -287,7 +295,12 @@ set(

if (BUILD_LIBRARY)

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
if(STATIC)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()

add_library(monero-cpp ${LIBRARY_SRC_FILES})

target_include_directories(monero-cpp PUBLIC
Expand Down
19 changes: 11 additions & 8 deletions bin/build_libmonero_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# build monero-project dependencies
cd ./external/monero-project/ || exit 1
git submodule update --init --force || exit 1
HOST_NCORES=$(nproc 2>/dev/null || shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
HOST_NCORES=${HOST_NCORES-$(nproc 2>/dev/null || shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)}
echo "HOST_NCORES=$HOST_NCORES in $0"
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH in $0"
export CMAKE_PREFIX_PATH
echo "OPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR in $0"
if [[ "$OSTYPE" == "msys" ]]; then
bit=$(getconf LONG_BIT)
Expand All @@ -18,17 +20,18 @@ elif [[ "$OSTYPE" == "cygwin" ]]; then
exit 1
else
# OS is not windows
test -d build/release || mkdir -p build/release
(cd build/release && \
cmake -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release\
-D OPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR -D CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH ../.. && \
make -j$HOST_NCORES wallet) || exit 1
MONERO_BUILD_DIR="build/release"
test -d $MONERO_BUILD_DIR || mkdir -p $MONERO_BUILD_DIR
(cd $MONERO_BUILD_DIR && \
cmake -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release \
-D OPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR \
../.. && make -j$HOST_NCORES wallet) || exit 1
fi
cd ../../

# build libmonero-cpp shared library
mkdir -p build &&
cd build &&
cmake -D OPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR -D CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH $@ .. &&
cmake $@ .. &&
cmake --build . &&
make .
make -j$HOST_NCORES .
2 changes: 1 addition & 1 deletion external/monero-project
Submodule monero-project updated 1 files
+9 −0 CMakeLists.txt

0 comments on commit 334442a

Please sign in to comment.