From 6ba6b59a7a9d0456219fccc8350cb36389eb9b76 Mon Sep 17 00:00:00 2001 From: Adrien Bertrand Date: Fri, 28 Apr 2023 14:41:12 +0200 Subject: [PATCH] fix cmake and ci for libusb branch --- .github/workflows/build.linux.workflow.yml | 4 ++-- .github/workflows/build.mac.workflow.yml | 4 ++-- .github/workflows/build.windows.workflow.yml | 2 +- gui/qt/CMakeLists.txt | 14 ++++++++++++++ gui/qt/CMakePresets.json | 4 ++++ gui/qt/vcpkg.json | 1 + 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.linux.workflow.yml b/.github/workflows/build.linux.workflow.yml index 2d28f3314..4790f4b4c 100644 --- a/.github/workflows/build.linux.workflow.yml +++ b/.github/workflows/build.linux.workflow.yml @@ -2,7 +2,7 @@ name: Build Linux on: push: - branches: [ master, feature/github-actions ] + branches: [ master, feature/github-actions, test/libusb ] pull_request: branches: [ master, feature/github-actions ] @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: | set -e - sudo apt install -y autoconf automake autoconf-archive '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libegl1-mesa-dev + sudo apt install -y autoconf automake autoconf-archive '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libegl1-mesa-dev libudev-dev libusb-1.0-0-dev - name: Install latest CMake uses: lukka/get-cmake@a70f1cfa1857a3eecfe0d34962269e1b1e8be56c # latest as of 2024-08-08 diff --git a/.github/workflows/build.mac.workflow.yml b/.github/workflows/build.mac.workflow.yml index 990176813..8228c78d6 100644 --- a/.github/workflows/build.mac.workflow.yml +++ b/.github/workflows/build.mac.workflow.yml @@ -2,7 +2,7 @@ name: Build macOS on: push: - branches: [ master, feature/github-actions ] + branches: [ master, feature/github-actions, test/libusb ] pull_request: branches: [ master, feature/github-actions ] @@ -38,7 +38,7 @@ jobs: - name: Install dependencies run: | set -e - brew install automake autoconf libtool + brew install automake autoconf libtool libusb - name: Install latest CMake uses: lukka/get-cmake@a70f1cfa1857a3eecfe0d34962269e1b1e8be56c # latest as of 2024-08-08 diff --git a/.github/workflows/build.windows.workflow.yml b/.github/workflows/build.windows.workflow.yml index 8fe8884a3..14d5b7aae 100644 --- a/.github/workflows/build.windows.workflow.yml +++ b/.github/workflows/build.windows.workflow.yml @@ -2,7 +2,7 @@ name: Build Windows on: push: - branches: [ master, feature/github-actions ] + branches: [ master, feature/github-actions, test/libusb ] pull_request: branches: [ master, feature/github-actions ] diff --git a/gui/qt/CMakeLists.txt b/gui/qt/CMakeLists.txt index 600197be8..bb8d4b565 100644 --- a/gui/qt/CMakeLists.txt +++ b/gui/qt/CMakeLists.txt @@ -139,6 +139,8 @@ set(CEmu_Sources ../../core/usb/disconnected.c ../../core/usb/dusb.c ../../core/usb/fotg210.h + ../../core/usb/msd.c + ../../core/usb/physical.c ../../core/usb/usb.c ../../core/usb/usb.h ../../core/vat.c ../../core/vat.h ../../tests/autotester/autotester.cpp ../../tests/autotester/autotester.h @@ -268,6 +270,18 @@ else() message(WARNING "No LibArchive found! CE Bundle extraction/transfer will not be available") endif() +if(PkgConfig_FOUND) + pkg_check_modules(LibUsb libusb-1.0>=1.0.16) + if(LibUsb_FOUND) + target_compile_definitions(CEmu PRIVATE "LIBUSB_SUPPORT") + target_include_directories(CEmu PRIVATE ${LibUsb_INCLUDE_DIRS}) + target_link_directories(CEmu PRIVATE ${LibUsb_LIBRARY_DIRS}) + target_link_libraries(CEmu PRIVATE ${LibUsb_LIBRARIES}) + else() + message(WARNING "No LibUsb found! Some USB things will not be available") + endif() +endif() + find_package(PNG QUIET) if(PNG_FOUND) target_compile_definitions(CEmu PRIVATE "PNG_SUPPORT") diff --git a/gui/qt/CMakePresets.json b/gui/qt/CMakePresets.json index 20783e6ca..fa337c586 100644 --- a/gui/qt/CMakePresets.json +++ b/gui/qt/CMakePresets.json @@ -25,6 +25,10 @@ "VCPKG_OVERLAY_TRIPLETS": { "type": "STRING", "value": "${sourceDir}/triplets" + }, + "VCPKG_INSTALL_OPTIONS": { + "type": "STRING", + "value": "--allow-unsupported" } } }, diff --git a/gui/qt/vcpkg.json b/gui/qt/vcpkg.json index e53b32d0f..f316e4300 100644 --- a/gui/qt/vcpkg.json +++ b/gui/qt/vcpkg.json @@ -6,6 +6,7 @@ "dependencies": [ "pkgconf", "libiconv", + "libusb", { "name": "libarchive", "default-features": false