From 177933e212a6ef5974871b4663ac65abeaf225cd Mon Sep 17 00:00:00 2001 From: polar Date: Wed, 26 May 2021 20:03:53 +0100 Subject: [PATCH] Refactor hidapi submodule (#10346) Co-authored-by: Megamouse --- .gitmodules | 2 +- 3rdparty/CMakeLists.txt | 26 +------------------- 3rdparty/hidapi/CMakeLists.txt | 25 +++++++++++++++++++ 3rdparty/{ => hidapi}/hidapi | 0 3rdparty/{ => hidapi}/hidapi.vcxproj | 0 3rdparty/{ => hidapi}/hidapi.vcxproj.filters | 0 rpcs3.sln | 2 +- rpcs3/rpcs3.vcxproj | 4 +-- 8 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 3rdparty/hidapi/CMakeLists.txt rename 3rdparty/{ => hidapi}/hidapi (100%) rename 3rdparty/{ => hidapi}/hidapi.vcxproj (100%) rename 3rdparty/{ => hidapi}/hidapi.vcxproj.filters (100%) diff --git a/.gitmodules b/.gitmodules index 1cac210ca7..1f98eb06a5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -32,7 +32,7 @@ url = https://github.com/madler/zlib ignore = dirty [submodule "3rdparty/hidapi"] - path = 3rdparty/hidapi + path = 3rdparty/hidapi/hidapi url = https://github.com/RPCS3/hidapi branch = master ignore = dirty diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 8a93e5e618..2a24b68af6 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -79,31 +79,7 @@ endif() # hidapi -add_library(3rdparty_hidapi INTERFACE) -target_include_directories(3rdparty_hidapi INTERFACE hidapi/hidapi) - -if(APPLE) - add_subdirectory(hidapi/mac EXCLUDE_FROM_ALL) - target_include_directories(hidapi-mac PUBLIC hidapi/hidapi) - - target_link_libraries(3rdparty_hidapi INTERFACE hidapi-mac "-framework CoreFoundation" "-framework IOKit") -elseif(CMAKE_SYSTEM MATCHES "Linux") - add_subdirectory(hidapi/linux EXCLUDE_FROM_ALL) - target_include_directories(hidapi-hidraw PUBLIC hidapi/hidapi) - - target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hidraw udev) -elseif(WIN32) - add_subdirectory(hidapi/windows EXCLUDE_FROM_ALL) - target_include_directories(hidapi-hid PUBLIC hidapi/hidapi) - - target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hid Shlwapi.lib) -else() - add_subdirectory(hidapi/libusb EXCLUDE_FROM_ALL) - target_include_directories(hidapi-libusb PUBLIC hidapi/hidapi) - - target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb) -endif() - +add_subdirectory(hidapi) # yaml-cpp # We don't want to install yaml-cpp but its cmake file doesn't have option diff --git a/3rdparty/hidapi/CMakeLists.txt b/3rdparty/hidapi/CMakeLists.txt new file mode 100644 index 0000000000..da0a8e1907 --- /dev/null +++ b/3rdparty/hidapi/CMakeLists.txt @@ -0,0 +1,25 @@ +# hidapi +add_library(3rdparty_hidapi INTERFACE) +target_include_directories(3rdparty_hidapi INTERFACE hidapi/hidapi) + +if(APPLE) + add_subdirectory(hidapi/mac EXCLUDE_FROM_ALL) + target_include_directories(hidapi-mac PUBLIC hidapi/hidapi) + + target_link_libraries(3rdparty_hidapi INTERFACE hidapi-mac "-framework CoreFoundation" "-framework IOKit") +elseif(CMAKE_SYSTEM MATCHES "Linux") + add_subdirectory(hidapi/linux EXCLUDE_FROM_ALL) + target_include_directories(hidapi-hidraw PUBLIC hidapi/hidapi) + + target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hidraw udev) +elseif(WIN32) + add_subdirectory(hidapi/windows EXCLUDE_FROM_ALL) + target_include_directories(hidapi-hid PUBLIC hidapi/hidapi) + + target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hid Shlwapi.lib) +else() + add_subdirectory(hidapi/libusb EXCLUDE_FROM_ALL) + target_include_directories(hidapi-libusb PUBLIC hidapi/hidapi) + + target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb) +endif() diff --git a/3rdparty/hidapi b/3rdparty/hidapi/hidapi similarity index 100% rename from 3rdparty/hidapi rename to 3rdparty/hidapi/hidapi diff --git a/3rdparty/hidapi.vcxproj b/3rdparty/hidapi/hidapi.vcxproj similarity index 100% rename from 3rdparty/hidapi.vcxproj rename to 3rdparty/hidapi/hidapi.vcxproj diff --git a/3rdparty/hidapi.vcxproj.filters b/3rdparty/hidapi/hidapi.vcxproj.filters similarity index 100% rename from 3rdparty/hidapi.vcxproj.filters rename to 3rdparty/hidapi/hidapi.vcxproj.filters diff --git a/rpcs3.sln b/rpcs3.sln index ed11ef5095..1ef4be355f 100644 --- a/rpcs3.sln +++ b/rpcs3.sln @@ -58,7 +58,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxpro {349EE8F9-7D25-4909-AAF5-FF3FADE72187} = {349EE8F9-7D25-4909-AAF5-FF3FADE72187} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "3rdparty\hidapi.vcxproj", "{A107C21C-418A-4697-BB10-20C3AA60E2E4}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hidapi", "3rdparty\hidapi\hidapi.vcxproj", "{A107C21C-418A-4697-BB10-20C3AA60E2E4}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xxhash", "3rdparty\xxhash.vcxproj", "{939FE206-1182-ABC3-1234-FEAB88E98404}" EndProject diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index ed787388e9..e877b5ec10 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -62,12 +62,12 @@ true - ..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib + ..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib $(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) $(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) - ..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib + ..\3rdparty\7z\src;..\3rdparty\hidapi\hidapi\hidapi;.\;..\;..\3rdparty\asmjit\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\include;..\3rdparty\cereal\include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\XAudio2Redist\include;..\3rdparty\span\include;..\3rdparty\libpng\libpng;..\3rdparty\GL;..\3rdparty\stblib\include;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib