From d66820c7bc7aae544e7d2d91c73afb60abae04dc Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 19 May 2020 13:40:31 -0400 Subject: [PATCH] build extra libraries for apple and windows without finding HIDAPI sample_code and scratchpad can build without library remove device/libdevice.a and device_trezor/libdevice_trezor.a add include and to monero_wallet.h --- CMakeLists.txt | 72 +++++++++++++++----------------------- bin/build_libmonero_cpp.sh | 4 +-- src/wallet/monero_wallet.h | 2 ++ 3 files changed, 33 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57d3af5..21edf0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,24 +33,24 @@ include_directories("${MONERO_CORE_SRC}/crypto/crypto_ops_builder/include/") set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/external-libs) message(STATUS EXTERNAL_LIBS_DIR : ${EXTERNAL_LIBS_DIR}) -# TODO: remove TRUEs, how are APPLE, DEPENDS, etc initialized? -if (TRUE OR HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED) - if (TRUE OR APPLE) - if(TRUE OR DEPENDS) - list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit") - else() - find_library(COREFOUNDATION CoreFoundation) - find_library(IOKIT IOKit) - list(APPEND EXTRA_LIBRARIES ${IOKIT}) - list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION}) - endif() - endif() - if (WIN32) - list(APPEND EXTRA_LIBRARIES setupapi) +#################### +# Extra libraries +#################### + +if (APPLE) + if (DEPENDS) + list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit") + else() + find_library(COREFOUNDATION CoreFoundation) + find_library(IOKIT IOKit) + list(APPEND EXTRA_LIBRARIES ${IOKIT}) + list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION}) endif() endif() +if (WIN32) + list(APPEND EXTRA_LIBRARIES setupapi) +endif() -#list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit") message(STATUS EXTRA_LIBRARIES: ${EXTRA_LIBRARIES}) ############ @@ -215,14 +215,6 @@ add_library(checkpoints STATIC IMPORTED) set_target_properties(checkpoints PROPERTIES IMPORTED_LOCATION ${MONERO_CORE_BUILD}/src/checkpoints/libcheckpoints.a) -add_library(device STATIC IMPORTED) -set_target_properties(device PROPERTIES IMPORTED_LOCATION - ${MONERO_CORE_BUILD}/src/device/libdevice.a) - -add_library(device_trezor STATIC IMPORTED) -set_target_properties(device_trezor PROPERTIES IMPORTED_LOCATION - ${MONERO_CORE_BUILD}/src/device_trezor/libdevice_trezor.a) - add_library(multisig STATIC IMPORTED) set_target_properties(multisig PROPERTIES IMPORTED_LOCATION ${MONERO_CORE_BUILD}/src/multisig/libmultisig.a) @@ -234,24 +226,24 @@ set_target_properties(version PROPERTIES IMPORTED_LOCATION add_library(randomx STATIC IMPORTED) set_target_properties(randomx PROPERTIES IMPORTED_LOCATION ${MONERO_CORE_BUILD}/external/randomx/librandomx.a) - + ######################## # Build c++ library ######################## +set( + LIBRARY_SRC_FILES + src/utils/gen_utils.cpp + src/utils/monero_utils.cpp + src/daemon/monero_daemon_model.cpp + src/daemon/monero_daemon.cpp + src/wallet/monero_wallet_model.cpp + src/wallet/monero_wallet_keys.cpp + src/wallet/monero_wallet_core.cpp +) + if (BUILD_LIBRARY) - set( - LIBRARY_SRC_FILES - src/utils/gen_utils.cpp - src/utils/monero_utils.cpp - src/daemon/monero_daemon_model.cpp - src/daemon/monero_daemon.cpp - src/wallet/monero_wallet_model.cpp - src/wallet/monero_wallet_keys.cpp - src/wallet/monero_wallet_core.cpp - ) - add_library(monero-cpp SHARED ${LIBRARY_SRC_FILES}) target_link_libraries(monero-cpp @@ -290,8 +282,6 @@ if (BUILD_LIBRARY) blockchain_db blocks checkpoints - device - device_trezor multisig version randomx @@ -307,7 +297,7 @@ endif() if (BUILD_SAMPLE) set(SAMPLE_CODE_SRC_FILES test/sample_code.cpp) - add_executable(sample_code ${SAMPLE_CODE_SRC_FILES} ${LIBRARY_SRC_FILES}) + add_executable(sample_code ${LIBRARY_SRC_FILES} ${SAMPLE_CODE_SRC_FILES}) target_link_libraries(sample_code @@ -345,8 +335,6 @@ if (BUILD_SAMPLE) blockchain_db blocks checkpoints - device - device_trezor multisig version randomx @@ -362,7 +350,7 @@ endif() if (BUILD_SCRATCHPAD) set(SCRATCHPAD_SRC_FILES test/scratchpad.cpp) - add_executable(scratchpad ${SCRATCHPAD_SRC_FILES} ${LIBRARY_SRC_FILES}) + add_executable(scratchpad ${LIBRARY_SRC_FILES} ${SCRATCHPAD_SRC_FILES}) target_link_libraries(scratchpad @@ -400,8 +388,6 @@ if (BUILD_SCRATCHPAD) blockchain_db blocks checkpoints - device - device_trezor multisig version randomx diff --git a/bin/build_libmonero_cpp.sh b/bin/build_libmonero_cpp.sh index 1f1a546..be622c6 100755 --- a/bin/build_libmonero_cpp.sh +++ b/bin/build_libmonero_cpp.sh @@ -1,10 +1,10 @@ #!/bin/sh -# Make libmonero-cpp.dylib +# build monero-core dependencies cd ./external/monero-core/ && make release-static -j8 && -# Make libmonero-cpp.dylib +# build libmonero-cpp shared library cd ../../ && mkdir -p build && cd build && diff --git a/src/wallet/monero_wallet.h b/src/wallet/monero_wallet.h index 5ba60d5..682dd2a 100644 --- a/src/wallet/monero_wallet.h +++ b/src/wallet/monero_wallet.h @@ -53,6 +53,8 @@ #pragma once #include "monero_wallet_model.h" +#include +#include using namespace monero;