mirror of
https://github.com/vtnerd/monero-lws.git
synced 2025-01-19 09:04:32 +00:00
Link static monerod build to monero-lws
This commit is contained in:
parent
3bf6fbaf3a
commit
7cee452db1
2 changed files with 109 additions and 11 deletions
118
CMakeLists.txt
118
CMakeLists.txt
|
@ -92,7 +92,7 @@ load_cache(${MONERO_BUILD_DIR} READ_WITH_PREFIX monero_
|
||||||
Boost_THREAD_LIBRARY_RELEASE
|
Boost_THREAD_LIBRARY_RELEASE
|
||||||
CMAKE_CXX_COMPILER
|
CMAKE_CXX_COMPILER
|
||||||
EXTRA_LIBRARIES
|
EXTRA_LIBRARIES
|
||||||
HIDAPI_LIBRARY
|
HIDAPI_INCLUDE_DIR
|
||||||
LMDB_INCLUDE
|
LMDB_INCLUDE
|
||||||
monero_SOURCE_DIR
|
monero_SOURCE_DIR
|
||||||
OPENSSL_CRYPTO_LIBRARY
|
OPENSSL_CRYPTO_LIBRARY
|
||||||
|
@ -115,10 +115,6 @@ if ("${monero_UNBOUND_LIBRARIES}" STREQUAL "UNBOUND_LIBRARIES-NOTFOUND")
|
||||||
unset(monero_UNBOUND_LIBRARIES)
|
unset(monero_UNBOUND_LIBRARIES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ("${monero_HIDAPI_LIBRARY}" STREQUAL "HIDAPI_LIBRARY-NOTFOUND")
|
|
||||||
unset(monero_HIDAPI_LIBRARY)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dependencies specific to monero-lws
|
# Dependencies specific to monero-lws
|
||||||
#
|
#
|
||||||
|
@ -126,7 +122,12 @@ endif()
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
# boost
|
||||||
set(Boost_NO_BOOST_CMAKE ON)
|
set(Boost_NO_BOOST_CMAKE ON)
|
||||||
|
if(STATIC)
|
||||||
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
set(Boost_USE_STATIC_RUNTIME ON)
|
||||||
|
endif()
|
||||||
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS chrono filesystem program_options regex serialization system thread)
|
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS chrono filesystem program_options regex serialization system thread)
|
||||||
|
|
||||||
if (NOT (Boost_THREAD_LIBRARY STREQUAL monero_Boost_THREAD_LIBRARY_RELEASE))
|
if (NOT (Boost_THREAD_LIBRARY STREQUAL monero_Boost_THREAD_LIBRARY_RELEASE))
|
||||||
|
@ -135,6 +136,103 @@ if (NOT (Boost_THREAD_LIBRARY STREQUAL monero_Boost_THREAD_LIBRARY_RELEASE))
|
||||||
message(FATAL_ERROR "Boost libraries for monero build differs from this project")
|
message(FATAL_ERROR "Boost libraries for monero build differs from this project")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# hidapi
|
||||||
|
# https://github.com/moneroexamples/openmonero/blob/18370af8fa51a0e9d05dfe678dcd5bcb7fad30f7/cmake/FindHIDAPI.cmake#L26-L60
|
||||||
|
find_library(HIDAPI_LIBRARY
|
||||||
|
NAMES hidapi hidapi-libusb)
|
||||||
|
|
||||||
|
find_path(HIDAPI_INCLUDE_DIR
|
||||||
|
NAMES hidapi.h
|
||||||
|
PATH_SUFFIXES
|
||||||
|
hidapi)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(HIDAPI
|
||||||
|
DEFAULT_MSG
|
||||||
|
HIDAPI_LIBRARY
|
||||||
|
HIDAPI_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(HIDAPI_FOUND)
|
||||||
|
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
|
||||||
|
if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux"))
|
||||||
|
find_library(LIBUSB-1.0_LIBRARY usb-1.0)
|
||||||
|
find_library(LIBUDEV_LIBRARY udev)
|
||||||
|
if(LIBUSB-1.0_LIBRARY)
|
||||||
|
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUSB-1.0_LIBRARY}")
|
||||||
|
if(LIBUDEV_LIBRARY)
|
||||||
|
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUDEV_LIBRARY}")
|
||||||
|
else()
|
||||||
|
message(WARNING "libudev library not found, binaries may fail to link.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "libusb-1.0 library not found, binaries may fail to link.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY)
|
||||||
|
|
||||||
|
if (NOT (HIDAPI_INCLUDE_DIR STREQUAL monero_HIDAPI_INCLUDE_DIR))
|
||||||
|
message(STATUS "Found HIDAPI_INCLUDE_DIR: ${HIDAPI_INCLUDE_DIR}")
|
||||||
|
message(STATUS "Found monero_HIDAPI_INCLUDE_DIR: ${monero_HIDAPI_INCLUDE_DIR}")
|
||||||
|
message(FATAL_ERROR "hidapi libraries for monero build differs from this project")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# openssl
|
||||||
|
if (STATIC)
|
||||||
|
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||||
|
endif()
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
|
if (NOT (OPENSSL_CRYPTO_LIBRARY STREQUAL monero_OPENSSL_CRYPTO_LIBRARY))
|
||||||
|
message(STATUS "Found OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}")
|
||||||
|
message(STATUS "Found monero_OPENSSL_CRYPTO_LIBRARY: ${monero_OPENSSL_CRYPTO_LIBRARY}")
|
||||||
|
message(FATAL_ERROR "openssl libraries for monero build differs from this project")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# zmq
|
||||||
|
# https://github.com/monero-project/monero/blob/9aab19f349433687c7aaf2c1cbc5751e5912c0aa/CMakeLists.txt#L1171-L1199
|
||||||
|
if(STATIC)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DZMQ_STATIC")
|
||||||
|
endif()
|
||||||
|
find_path(ZMQ_INCLUDE_PATH zmq.h)
|
||||||
|
find_library(ZMQ_LIB zmq)
|
||||||
|
find_library(PGM_LIBRARY pgm)
|
||||||
|
find_library(NORM_LIBRARY norm)
|
||||||
|
find_library(GSSAPI_LIBRARY gssapi_krb5)
|
||||||
|
find_library(PROTOLIB_LIBRARY protolib)
|
||||||
|
find_library(SODIUM_LIBRARY sodium)
|
||||||
|
|
||||||
|
if(NOT ZMQ_INCLUDE_PATH)
|
||||||
|
message(FATAL_ERROR "Could not find required header zmq.h")
|
||||||
|
endif()
|
||||||
|
if(NOT ZMQ_LIB)
|
||||||
|
message(FATAL_ERROR "Could not find required libzmq")
|
||||||
|
endif()
|
||||||
|
if(PGM_LIBRARY)
|
||||||
|
set(ZMQ_LIB "${ZMQ_LIB};${PGM_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if(NORM_LIBRARY)
|
||||||
|
set(ZMQ_LIB "${ZMQ_LIB};${NORM_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if(GSSAPI_LIBRARY)
|
||||||
|
set(ZMQ_LIB "${ZMQ_LIB};${GSSAPI_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if(PROTOLIB_LIBRARY)
|
||||||
|
set(ZMQ_LIB "${ZMQ_LIB};${PROTOLIB_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if(SODIUM_LIBRARY)
|
||||||
|
set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT (ZMQ_INCLUDE_PATH STREQUAL monero_ZMQ_INCLUDE_PATH))
|
||||||
|
message(STATUS "Found ZMQ_INCLUDE_PATH: ${ZMQ_INCLUDE_PATH}")
|
||||||
|
message(STATUS "Found monero_ZMQ_INCLUDE_PATH: ${monero_ZMQ_INCLUDE_PATH}")
|
||||||
|
message(FATAL_ERROR "zmq libraries for monero build differs from this project")
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach (LIB ${MONERO_LIBRARIES})
|
foreach (LIB ${MONERO_LIBRARIES})
|
||||||
find_library(LIB_PATH NAMES "${LIB}" PATHS ${MONERO_BUILD_DIR} PATH_SUFFIXES "/src/${LIB}" "external/${LIB}" ${MONERO_SEARCH_PATHS} NO_DEFAULT_PATH)
|
find_library(LIB_PATH NAMES "${LIB}" PATHS ${MONERO_BUILD_DIR} PATH_SUFFIXES "/src/${LIB}" "external/${LIB}" ${MONERO_SEARCH_PATHS} NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
@ -157,6 +255,9 @@ add_library(monero::libraries INTERFACE IMPORTED)
|
||||||
set_property(TARGET monero::libraries PROPERTY
|
set_property(TARGET monero::libraries PROPERTY
|
||||||
INTERFACE_INCLUDE_DIRECTORIES
|
INTERFACE_INCLUDE_DIRECTORIES
|
||||||
${Boost_INCLUDE_DIR}
|
${Boost_INCLUDE_DIR}
|
||||||
|
${HIDAPI_INCLUDE_DIRS}
|
||||||
|
${OPENSSL_INCLUDE_DIR}
|
||||||
|
${ZMQ_INCLUDE_PATH}
|
||||||
"${MONERO_BUILD_DIR}/generated_include"
|
"${MONERO_BUILD_DIR}/generated_include"
|
||||||
"${MONERO_SOURCE_DIR}/contrib/epee/include"
|
"${MONERO_SOURCE_DIR}/contrib/epee/include"
|
||||||
"${MONERO_SOURCE_DIR}/external/easylogging++"
|
"${MONERO_SOURCE_DIR}/external/easylogging++"
|
||||||
|
@ -173,9 +274,8 @@ set_property(TARGET monero::libraries PROPERTY
|
||||||
${Boost_SERIALIZATION_LIBRARY}
|
${Boost_SERIALIZATION_LIBRARY}
|
||||||
${Boost_SYSTEM_LIBRARY}
|
${Boost_SYSTEM_LIBRARY}
|
||||||
${Boost_THREAD_LIBRARY}
|
${Boost_THREAD_LIBRARY}
|
||||||
${monero_HIDAPI_LIBRARY}
|
${HIDAPI_LIBRARIES}
|
||||||
${monero_OPENSSL_CRYPTO_LIBRARY}
|
${OPENSSL_LIBRARIES}
|
||||||
${monero_OPENSSL_SSL_LIBRARY}
|
|
||||||
${monero_SODIUM_LIBRARY}
|
${monero_SODIUM_LIBRARY}
|
||||||
${monero_UNBOUND_LIBRARIES}
|
${monero_UNBOUND_LIBRARIES}
|
||||||
${CMAKE_DL_LIBS}
|
${CMAKE_DL_LIBS}
|
||||||
|
@ -183,8 +283,6 @@ set_property(TARGET monero::libraries PROPERTY
|
||||||
|
|
||||||
set(LMDB_INCLUDE "${monero_LMDB_INCLUDE}")
|
set(LMDB_INCLUDE "${monero_LMDB_INCLUDE}")
|
||||||
set(LMDB_LIB_PATH "monero::lmdb")
|
set(LMDB_LIB_PATH "monero::lmdb")
|
||||||
set(ZMQ_LIB "${monero_ZMQ_LIB}")
|
|
||||||
set(ZMQ_INCLUDE_PATH "${monero_ZMQ_INCLUDE_PATH}")
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -53,8 +53,8 @@ target_link_libraries(monero-lws-daemon
|
||||||
monero-lws-util
|
monero-lws-util
|
||||||
monero-lws-wire-json
|
monero-lws-wire-json
|
||||||
${Boost_CHRONO_LIBRARY}
|
${Boost_CHRONO_LIBRARY}
|
||||||
${Boost_FILESYSTEM_LIBRARY}
|
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||||
|
${Boost_FILESYSTEM_LIBRARY}
|
||||||
${Boost_THREAD_LIBRARY}
|
${Boost_THREAD_LIBRARY}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${EXTRA_LIBRARIES}
|
${EXTRA_LIBRARIES}
|
||||||
|
|
Loading…
Reference in a new issue