aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-16 16:51:28 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-16 16:51:28 +0100
commitc6c700c159d731d16ec050d39896e0e8ae41937d (patch)
treea628314519c7f9dce92479d69fd4552d41629d08
parentea3032027552d9f00a87e65b6a6399a07f1c5738 (diff)
parentdc63e51bd6bf71559829f61030b94c1bfdbf4401 (diff)
downloadlibnitrokey-c6c700c159d731d16ec050d39896e0e8ae41937d.tar.gz
libnitrokey-c6c700c159d731d16ec050d39896e0e8ae41937d.tar.bz2
Merge branch 'osx_build'
-rw-r--r--CMakeLists.txt14
-rw-r--r--NitrokeyManager.cc7
-rw-r--r--device.cc4
m---------hidapi0
4 files changed, 20 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46405a9..1dcffb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,7 +62,10 @@ set(SOURCE_FILES
NK_C_API.cc
DeviceCommunicationExceptions.cpp)
-IF(UNIX)
+IF(APPLE)
+ #include_directories(hidapi/hidapi)
+ #add_library(hidapi-libusb STATIC hidapi/mac/hid.c )
+ELSEIF(UNIX)
# add_library(hidapi-libusb STATIC hidapi/libusb/hid.c )
ELSEIF(WIN32)
include_directories(hidapi/hidapi)
@@ -80,8 +83,11 @@ ELSE()
add_library(nitrokey-static-log STATIC ${SOURCE_FILES})
SET(LIBNAME nitrokey-static)
ENDIF()
-target_link_libraries(${LIBNAME} hidapi-libusb)
-target_link_libraries(${LIBNAME}-log hidapi-libusb)
+
+IF(NOT APPLE)
+ target_link_libraries(${LIBNAME} hidapi-libusb)
+ target_link_libraries(${LIBNAME}-log hidapi-libusb)
+ENDIF()
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_DEFINITIONS "NO_LOG")
@@ -124,4 +130,4 @@ include (InstallRequiredSystemLibraries)
set (CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
-include (CPack) \ No newline at end of file
+include (CPack)
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 140d4d3..12f4671 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -15,6 +15,13 @@ namespace nitrokey{
std::mutex mex_dev_com;
+ /**
+ * Copies string from pointer to fixed size C-style array. Src needs to be a valid C-string - eg. ended with '\0'.
+ * Throws when source is bigger than destination.
+ * @tparam T type of destination array
+ * @param dest fixed size destination array
+ * @param src pointer to source c-style valid string
+ */
template <typename T>
void strcpyT(T& dest, const char* src){
diff --git a/device.cc b/device.cc
index 66877da..4cb492d 100644
--- a/device.cc
+++ b/device.cc
@@ -49,10 +49,12 @@ bool Device::_disconnect() {
hid_close(mp_devhandle);
mp_devhandle = nullptr;
+#ifndef __APPLE__
if (instances_count == 1){
LOG(std::string("Calling hid_exit"), Loglevel::DEBUG_L2);
hid_exit();
}
+#endif
return true;
}
@@ -204,4 +206,4 @@ std::string Device::ErrorCounters::get_as_string() {
p(receiving_error);
return ss.str();
}
-#undef p \ No newline at end of file
+#undef p
diff --git a/hidapi b/hidapi
-Subproject 69c45b083821037667a9409b952282f9cb4dcca
+Subproject b24dd9c36c4aacfd5ba7b1f0277d98bbbee43f1