From 48ff15602e89ee2b7946310dd343859d56795a67 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Thu, 9 Jul 2020 14:56:56 +0000 Subject: [PATCH 1/3] cmake: pass libusb include directory as well In file included from src/input_common/gcadapter/gc_adapter.cpp:8: src/./input_common/gcadapter/gc_adapter.h:11:10: fatal error: 'libusb.h' file not found #include ^~~~~~~~~~ --- CMakeLists.txt | 1 + src/input_common/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd40e5cfed..eb51d09dc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -333,6 +333,7 @@ endif() find_package(LibUSB) if (NOT LIBUSB_FOUND) add_subdirectory(externals/libusb) + set(LIBUSB_INCLUDE_DIR "") set(LIBUSB_LIBRARIES usb) endif() diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 3bd76dd238..1d7e19a663 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt @@ -30,6 +30,7 @@ if(SDL2_FOUND) target_compile_definitions(input_common PRIVATE HAVE_SDL2) endif() +target_include_directories(input_common SYSTEM PUBLIC ${LIBUSB_INCLUDE_DIR}) target_link_libraries(input_common PUBLIC ${LIBUSB_LIBRARIES}) create_target_directory_groups(input_common) From 883fab2fff5ff9bdad38eee4e55bacc520ce0cc9 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 13 Jul 2020 18:48:19 +0000 Subject: [PATCH 2/3] input_common: make libusb private to gc_adapter --- src/input_common/CMakeLists.txt | 4 ++-- src/input_common/gcadapter/gc_adapter.cpp | 1 + src/input_common/gcadapter/gc_adapter.h | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 1d7e19a663..317c25bade 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt @@ -30,8 +30,8 @@ if(SDL2_FOUND) target_compile_definitions(input_common PRIVATE HAVE_SDL2) endif() -target_include_directories(input_common SYSTEM PUBLIC ${LIBUSB_INCLUDE_DIR}) -target_link_libraries(input_common PUBLIC ${LIBUSB_LIBRARIES}) +target_include_directories(input_common SYSTEM PRIVATE ${LIBUSB_INCLUDE_DIR}) +target_link_libraries(input_common PRIVATE ${LIBUSB_LIBRARIES}) create_target_directory_groups(input_common) target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index 6d9f4d9eb0..c031fc22ad 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "common/logging/log.h" #include "input_common/gcadapter/gc_adapter.h" diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h index b1c2a1958b..1337c260e8 100644 --- a/src/input_common/gcadapter/gc_adapter.h +++ b/src/input_common/gcadapter/gc_adapter.h @@ -8,10 +8,13 @@ #include #include #include -#include #include "common/common_types.h" #include "common/threadsafe_queue.h" +struct libusb_context; +struct libusb_device; +struct libusb_device_handle; + namespace GCAdapter { enum { From b284c433850053dca46d2e2381b16b17d38cd048 Mon Sep 17 00:00:00 2001 From: Ameer Date: Tue, 14 Jul 2020 01:46:54 +0000 Subject: [PATCH 3/3] input_common: drop unused libusb.h include Remnant of an early implementation. --- src/input_common/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index fd0af10193..b9d5d0ec35 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp @@ -4,7 +4,6 @@ #include #include -#include #include "common/param_package.h" #include "input_common/analog_from_button.h" #include "input_common/gcadapter/gc_adapter.h"