Skip to content

Commit

Permalink
Windows build artifacts with Github Actions (signal11#414)
Browse files Browse the repository at this point in the history
- a straight-forward build matrix for Appveyor;
- MSBuild builds with Github Actions;
- Visual Studio 2022 support for `.sln` (toolset v143);
- gather Windows build artifacts with Github actions;
  • Loading branch information
Youw authored May 8, 2022
1 parent 5119684 commit 52fa873
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 56 deletions.
38 changes: 17 additions & 21 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,22 @@ environment:
arch: Win32
- BUILD_ENV: cygwin

install:
- cmd: if %BUILD_ENV%==cygwin (
C:\cygwin64\setup-x86_64.exe --quiet-mode --no-shortcuts --upgrade-also --packages autoconf,automake )
for:
-
matrix:
only:
- BUILD_ENV: msbuild

build_script:
- cmd: if %BUILD_ENV%==msbuild (
msbuild .\windows\hidapi.sln /p:Configuration=Release /p:Platform=%arch% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if %BUILD_ENV%==cygwin (
C:\cygwin64\bin\bash -exlc "cd $APPVEYOR_BUILD_FOLDER; ./bootstrap; ./configure; make" )
build_script:
- cmd: msbuild .\windows\hidapi.sln /p:Configuration=Release /p:Platform=%arch% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

artifacts:
# Win32 artifacts
- path: .\windows\Release\hidapi.dll
- path: .\windows\Release\hidapi.lib
- path: .\windows\Release\hidapi.pdb
- path: .\windows\Release\hidtest.exe
- path: .\windows\Release\hidtest.pdb
# x64 artifacts
- path: .\windows\x64\Release\hidapi.dll
- path: .\windows\x64\Release\hidapi.lib
- path: .\windows\x64\Release\hidapi.pdb
- path: .\windows\x64\Release\hidtest.exe
- path: .\windows\x64\Release\hidtest.pdb
-
matrix:
only:
- BUILD_ENV: cygwin

install:
- cmd: C:\cygwin64\setup-x86_64.exe --quiet-mode --no-shortcuts --upgrade-also --packages autoconf,automake

build_script:
- cmd: C:\cygwin64\bin\bash -exlc "cd $APPVEYOR_BUILD_FOLDER; ./bootstrap; ./configure; make"
97 changes: 62 additions & 35 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,72 +95,99 @@ jobs:
install/static/include/hidapi/hidapi_libusb.h"
allow_failure: true

windows-cmake-msvc:
windows-cmake:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
path: hidapisrc
- name: Configure CMake
- name: Configure CMake MSVC
shell: cmd
run: |
RMDIR /Q /S build install
cmake -B build -S hidapisrc -DCMAKE_INSTALL_PREFIX=install -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
- name: Build CMake
working-directory: build
cmake -B build\msvc -S hidapisrc -DCMAKE_INSTALL_PREFIX=install\msvc -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
- name: Build CMake MSVC
working-directory: build/msvc
run: cmake --build . --target install
- name: Check artifacts
- name: Check artifacts MSVC
uses: andstor/file-existence-action@v1
with:
files: "install/lib/hidapi.lib, install/bin/hidapi.dll, install/include/hidapi/hidapi.h, install/include/hidapi/hidapi_winapi.h"
files: "install/msvc/lib/hidapi.lib, \
install/msvc/bin/hidapi.dll, \
install/msvc/include/hidapi/hidapi.h, \
install/msvc/include/hidapi/hidapi_winapi.h"
allow_failure: true

windows-cmake-nmake:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
path: hidapisrc
- name: Configure CMake
- name: Configure CMake NMake
shell: cmd
run: |
RMDIR /Q /S build install
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -G"NMake Makefiles" -B build -S hidapisrc -DCMAKE_INSTALL_PREFIX=install -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
- name: Build CMake
working-directory: build
cmake -G"NMake Makefiles" -B build\nmake -S hidapisrc -DCMAKE_INSTALL_PREFIX=install\nmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
- name: Build CMake NMake
working-directory: build\nmake
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake install
- name: Check artifacts
- name: Check artifacts NMake
uses: andstor/file-existence-action@v1
with:
files: "install/nmake/lib/hidapi.lib, \
install/nmake/bin/hidapi.dll, \
install/nmake/include/hidapi/hidapi.h, \
install/nmake/include/hidapi/hidapi_winapi.h"
allow_failure: true

- name: Configure CMake MinGW
shell: cmd
run: |
cmake -G"MinGW Makefiles" -B build\mingw -S hidapisrc -DCMAKE_INSTALL_PREFIX=install\mingw -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%NIX_COMPILE_FLAGS%"
- name: Build CMake MinGW
working-directory: build\mingw
run: cmake --build . --target install
- name: Check artifacts MinGW
uses: andstor/file-existence-action@v1
with:
files: "install/lib/hidapi.lib, install/bin/hidapi.dll, install/include/hidapi/hidapi.h, install/include/hidapi/hidapi_winapi.h"
files: "install/mingw/lib/libhidapi.dll.a, \
install/mingw/bin/libhidapi.dll, \
install/mingw/include/hidapi/hidapi.h, \
install/mingw/include/hidapi/hidapi_winapi.h"
allow_failure: true

windows-cmake-mingw:
windows-msbuild:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: microsoft/[email protected]
- name: MSBuild x86
run: msbuild windows\hidapi.sln /p:Configuration=Release /p:Platform=Win32
- name: Check artifacts x86
uses: andstor/file-existence-action@v1
with:
path: hidapisrc
- name: Configure CMake
shell: cmd
run: |
RMDIR /Q /S build install
cmake -G"MinGW Makefiles" -B build -S hidapisrc -DCMAKE_INSTALL_PREFIX=install -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%NIX_COMPILE_FLAGS%"
- name: Build CMake
working-directory: build
run: cmake --build . --target install
- name: Check artifacts
files: "windows/Release/hidapi.dll, windows/Release/hidapi.lib, windows/Release/hidapi.pdb"
allow_failure: true
- name: MSBuild x64
run: msbuild windows\hidapi.sln /p:Configuration=Release /p:Platform=x64
- name: Check artifacts x64
uses: andstor/file-existence-action@v1
with:
files: "install/lib/libhidapi.dll.a, install/bin/libhidapi.dll, install/include/hidapi/hidapi.h, install/include/hidapi/hidapi_winapi.h"
files: "windows/x64/Release/hidapi.dll, windows/x64/Release/hidapi.lib, windows/x64/Release/hidapi.pdb"
allow_failure: true
- name: Gather artifacts
run: |
md artifacts
md artifacts\x86
md artifacts\x64
md artifacts\include
Copy-Item "windows\Release\hidapi.dll","windows\Release\hidapi.lib","windows\Release\hidapi.pdb" -Destination "artifacts\x86"
Copy-Item "windows\x64\Release\hidapi.dll","windows\x64\Release\hidapi.lib","windows\x64\Release\hidapi.pdb" -Destination "artifacts\x64"
Copy-Item "hidapi\hidapi.h","windows\hidapi_winapi.h" -Destination "artifacts\include"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: hidapi-win
path: artifacts/
retention-days: ${{ (github.event_name == 'pull_request' || github.ref_name != 'master') && 7 || 90 }}
4 changes: 4 additions & 0 deletions windows/hidapi.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
Expand All @@ -41,6 +42,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
Expand All @@ -51,6 +53,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand All @@ -60,6 +63,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down
4 changes: 4 additions & 0 deletions windows/hidtest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
Expand All @@ -40,6 +41,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
Expand All @@ -50,6 +52,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand All @@ -59,6 +62,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='14'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='17'">v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down

0 comments on commit 52fa873

Please sign in to comment.