From ec43d3ce9f4d98a195962a03a68fedc3cad2bc87 Mon Sep 17 00:00:00 2001 From: imi415 Date: Sat, 28 May 2022 22:38:57 +0800 Subject: [PATCH] Modified for standard Linux environment. --- CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ include/lpcusbsio.h | 4 ++++ 2 files changed, 38 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e69de29..38dbda5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.10) + +project(usbsio) + +set(USBSIO_SRCS + "src/lpcusbsio.c" +) + +if(WIN32) + set(USBSIO_HIDAPI_SRCS "src/hid_api/win/hid.c") +elseif(APPLE) + set(USBSIO_HIDAPI_SRCS "src/hid_api/mac/hid.c") +else() + set(USBSIO_HIDAPI_SRCS "src/hid_api/linux/hid.c") +endif() + +set(USBSIO_PRIVATE_INCS + "src/hid_api/hidapi" +) + +set(USBSIO_INTERFACE_INCS + "include" +) + +set(USBSIO_LIBRARIES + "udev" +) + +add_library(${PROJECT_NAME} ${USBSIO_SRCS} ${USBSIO_HIDAPI_SRCS}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${USBSIO_LIBRARIES}) +target_include_directories(${PROJECT_NAME} + PRIVATE ${USBSIO_PRIVATE_INCS} + PUBLIC ${USBSIO_INTERFACE_INCS} +) \ No newline at end of file diff --git a/include/lpcusbsio.h b/include/lpcusbsio.h index b1463fe..4cd1a44 100644 --- a/include/lpcusbsio.h +++ b/include/lpcusbsio.h @@ -20,6 +20,10 @@ #define LPCUSBSIO_API #endif +#ifndef _WIN32 +typedef int wchar_t; +#endif + #if defined(_MSC_VER) /* Windows version requires the setupapi library */ #pragma comment(lib,"setupapi.lib")