mirror of https://github.com/libsdl-org/SDL
ci: Build SDL3 with libusb support on MSVC
This commit is contained in:
parent
9548bba63a
commit
628e083e02
|
@ -0,0 +1,70 @@
|
|||
name: 'Setup libusb for MSBC'
|
||||
description: 'Greet someone'
|
||||
inputs:
|
||||
version:
|
||||
description: 'libusb version'
|
||||
required: true
|
||||
default: '1.0.27'
|
||||
arch:
|
||||
description: "libusb architecture (x86 or x64)"
|
||||
rqeuired: true
|
||||
outputs:
|
||||
root:
|
||||
description: "libusb root directory"
|
||||
value: ${{ steps.final.outputs.root }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: 'Restore cached libusb-${{ inputs.version }}.7z'
|
||||
id: cache-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: 'C:\temp\libusb-${{ inputs.version }}.7z'
|
||||
key: libusb-msvc-${{ inputs.version }}
|
||||
- name: 'Download libusb ${{ inputs.version }}'
|
||||
if: ${{ !steps.cache-restore.outputs.cache-hit }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
Invoke-WebRequest "https://github.com/libusb/libusb/releases/download/v${{ inputs.version }}/libusb-${{ inputs.version }}.7z" -OutFile "C:\temp\libusb-${{ inputs.version }}.7z"
|
||||
- name: 'Cache libusb-${{ inputs.version }}.7z'
|
||||
if: ${{ !steps.cache-restore.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: 'C:\temp\libusb-${{ inputs.version }}.7z'
|
||||
key: libusb-msvc-${{ inputs.version }}
|
||||
- name: 'Extract libusb'
|
||||
shell: pwsh
|
||||
run: |
|
||||
7z "-oC:\temp\libusb-${{ inputs.version }}" x "C:\temp\libusb-${{ inputs.version }}.7z"
|
||||
- name: 'Set output vars'
|
||||
id: final
|
||||
shell: pwsh
|
||||
run: |
|
||||
if ('${{ inputs.arch }}' -eq 'x86') {
|
||||
$archdir = "MS32";
|
||||
} elseif ('${{ inputs.arch }}' -eq 'x64') {
|
||||
$archdir = "MS64";
|
||||
} else {
|
||||
write-host "Invalid arch=${{ inputs.arch }}"
|
||||
exit 1
|
||||
}
|
||||
$libusb_incdir = "C:\temp\libusb-${{ inputs.version }}\include";
|
||||
$libusb_libdir = "C:\temp\libusb-${{ inputs.version }}\VS2022\${archdir}\dll";
|
||||
|
||||
$libusb_header = "${libusb_incdir}\libusb.h";
|
||||
$libusb_implib = "${libusb_libdir}\libusb-1.0.lib";
|
||||
$libusb_dll = "${libusb_libdir}\libusb-1.0.dll";
|
||||
|
||||
if (!(Test-Path "${libusb_header}")) {
|
||||
write-host "${libusb_header} does not exist!"
|
||||
exit 1
|
||||
}
|
||||
if (!(Test-Path "${libusb_implib}")){
|
||||
write-host "${libusb_implib} does not exist!"
|
||||
exit 1
|
||||
}
|
||||
if (!(Test-Path "${libusb_dll}")) {
|
||||
write-host "${libusb_dll} does not exist!"
|
||||
exit 1
|
||||
}
|
||||
echo "root=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_OUTPUT
|
|
@ -15,8 +15,8 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', artifact: 'SDL-VC-x64' }
|
||||
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' }
|
||||
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', libusb-arch: 'x64', artifact: 'SDL-VC-x64' }
|
||||
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', libusb-arch: 'x86', artifact: 'SDL-VC-x86' }
|
||||
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64, artifact: 'SDL-clang-cl-x64' }
|
||||
- { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' }
|
||||
- { name: Windows (ARM), flags: -A ARM, artifact: 'SDL-VC-arm32', notests: true }
|
||||
|
@ -26,6 +26,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up libusb
|
||||
uses: ./.github/actions/setup-msvc-libusb-action
|
||||
if: ${{ matrix.platform.libusb-arch != '' }}
|
||||
id: libusb
|
||||
with:
|
||||
arch: ${{ matrix.platform.libusb-arch }}
|
||||
- name: Create CMake project using SDL as a subproject
|
||||
shell: python
|
||||
run: |
|
||||
|
@ -71,6 +77,7 @@ jobs:
|
|||
-DSDL_DISABLE_INSTALL_CPACK=OFF `
|
||||
-DSDL_DISABLE_INSTALL_DOCS=OFF `
|
||||
-DSDLTEST_PROCDUMP=ON `
|
||||
-DLibUSB_ROOT="${{ steps.libusb.outputs.root }}" `
|
||||
${{ matrix.platform.flags }} `
|
||||
-DCMAKE_INSTALL_PREFIX=prefix
|
||||
- name: Build (CMake)
|
||||
|
|
Loading…
Reference in New Issue