aboutsummaryrefslogtreecommitdiff
path: root/src/device_trezor/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/device_trezor/CMakeLists.txt')
-rw-r--r--src/device_trezor/CMakeLists.txt42
1 files changed, 12 insertions, 30 deletions
diff --git a/src/device_trezor/CMakeLists.txt b/src/device_trezor/CMakeLists.txt
index c555e9fcd..b27c843b6 100644
--- a/src/device_trezor/CMakeLists.txt
+++ b/src/device_trezor/CMakeLists.txt
@@ -63,37 +63,20 @@ set(trezor_sources
set(trezor_private_headers)
-include(FindProtobuf)
-find_package(Protobuf) # REQUIRED
-
-# Test for HAVE_PROTOBUF from the parent
-if(Protobuf_FOUND AND HAVE_PROTOBUF)
- if ("$ENV{PYTHON3}" STREQUAL "")
- set(PYTHON3 "python3")
- else()
- set(PYTHON3 "$ENV{PYTHON3}" CACHE INTERNAL "Copied from environment variable")
- endif()
-
- execute_process(COMMAND ${PYTHON3} tools/build_protob.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/trezor RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
- if(RET)
- message(WARNING "Trezor protobuf messages could not be regenerated (err=${RET}, python ${PYTHON})."
- "OUT: ${OUT}, ERR: ${ERR}."
- "Please read src/device_trezor/trezor/tools/README.md")
- else()
- message(STATUS "Trezor protobuf messages regenerated ${OUT}")
- set(TREZOR_PROTOBUF_GENERATED 1)
- endif()
-endif()
-
-
-if(TREZOR_PROTOBUF_GENERATED)
+# Protobuf and LibUSB processed by CheckTrezor
+if(DEVICE_TREZOR_READY)
message(STATUS "Trezor support enabled")
add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)
+ set(TREZOR_LIBUSB_LIBRARIES "")
+ if(LibUSB_COMPILE_TEST_PASSED)
+ list(APPEND TREZOR_LIBUSB_LIBRARIES ${LibUSB_LIBRARIES})
+ message(STATUS "Trezor compatible LibUSB found at: ${LibUSB_INCLUDE_DIRS}")
+ endif()
+
monero_private_headers(device_trezor
- ${device_private_headers}
- ${PROTOBUF_INCLUDE_DIR})
+ ${device_private_headers})
monero_add_library(device_trezor
${trezor_sources}
@@ -109,14 +92,13 @@ if(TREZOR_PROTOBUF_GENERATED)
common
${SODIUM_LIBRARY}
${Boost_CHRONO_LIBRARY}
- ${PROTOBUF_LIBRARY}
+ ${Protobuf_LIBRARY}
+ ${TREZOR_LIBUSB_LIBRARIES}
PRIVATE
${EXTRA_LIBRARIES})
- # set(WITH_DEVICE_TREZOR 1 PARENT_SCOPE)
- # add_definitions(-DWITH_DEVICE_TREZOR=1)
-
else()
+ message(STATUS "Trezor support disabled")
monero_private_headers(device_trezor)
monero_add_library(device_trezor device_trezor.cpp)
target_link_libraries(device_trezor PUBLIC cncrypto)