Skip to content

Commit

Permalink
Ledger build (#597)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Tagirov <[email protected]>
  • Loading branch information
Mikhail Tagirov authored Feb 16, 2022
1 parent 8fb01b2 commit 24d8b4d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 26 deletions.
8 changes: 1 addition & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif (CCACHE_FOUND)


set(
CMAKE_TOOLCHAIN_FILE
"${CMAKE_SOURCE_DIR}/cmake/toolchain/cxx17.cmake"
Expand Down Expand Up @@ -119,13 +118,8 @@ include_directories(
deps/libsecp256k1/include
)

if (APPLE)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
endif ()

add_subdirectory(core)
add_subdirectory(libs)
add_subdirectory(core)


if (TESTING)
Expand Down
5 changes: 0 additions & 5 deletions libs/cpp-ledger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,5 @@
# SPDX-License-Identifier: Apache-2.0
#

if (APPLE)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
endif ()

add_subdirectory(ledger)
add_subdirectory(filecoin)
21 changes: 10 additions & 11 deletions libs/cpp-ledger/ledger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# SPDX-License-Identifier: Apache-2.0
#

find_library(HIDAPI_LIB
NAMES hidapi hidapi-libusb)

find_path(HIDAPI_INCLUDE_DIR
NAMES hidapi.h
PATH_SUFFIXES
hidapi)

add_library(ledger_device
apdu_wrapper.cpp
device_hid_info.cpp
Expand All @@ -12,14 +20,5 @@ add_library(ledger_device
utils.cpp
)

if (APPLE)
target_link_libraries(ledger_device
hidapi
)
endif ()

if (UNIX AND NOT APPLE)
target_link_libraries(ledger_device
hidapi-libusb
)
endif ()
target_include_directories(ledger_device PRIVATE ${HIDAPI_INCLUDE_DIR})
target_link_libraries(ledger_device ${HIDAPI_LIB})
2 changes: 1 addition & 1 deletion libs/cpp-ledger/ledger/device_hid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#pragma once

#include <hidapi/hidapi.h>
#include <hidapi.h>
#include <functional>
#include <memory>
#include <mutex>
Expand Down
2 changes: 1 addition & 1 deletion libs/cpp-ledger/ledger/device_hid_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "cpp-ledger/ledger/device_hid_info.hpp"

#include <hidapi/hidapi.h>
#include <hidapi.h>
#include <iomanip>
#include <sstream>
#include "cpp-ledger/ledger/utils.hpp"
Expand Down
1 change: 0 additions & 1 deletion test/libs/cpp-ledger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ addtest(cpp_ledger_test
ledger_filecoin_test.cpp
)
target_link_libraries(cpp_ledger_test
ledger_device
ledger_filecoin
)

0 comments on commit 24d8b4d

Please sign in to comment.