forked from neatchee/chiaki-builds
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (145 loc) · 8.15 KB
/
build-visual_studio.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Build Chiaki with Visual Studio
on:
workflow_call:
jobs:
build-win_x64: # only win_x64 so far :)
name: Build Chiaki win_x64 (VC)
runs-on: windows-2022
defaults:
run:
shell: powershell
steps:
- name: Clean Workspace Action
uses: yumis-coconudge/[email protected]
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Setup NASM
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -UseBasicParsing -Uri "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip" -OutFile ".\nasm-2.15.05-win64.zip"
Expand-Archive -LiteralPath "nasm-2.15.05-win64.zip" -DestinationPath "."
Rename-Item "nasm-2.15.05" "nasm"
Write-Output "${{ github.workspace }}\nasm" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Setup ffmpeg
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n5.1-latest-win64-gpl-shared-5.1.zip" -OutFile ".\ffmpeg-n5.1-latest-win64-gpl-shared-5.1.zip"
Expand-Archive -LiteralPath "ffmpeg-n5.1-latest-win64-gpl-shared-5.1.zip" -DestinationPath "."
Rename-Item "ffmpeg-n5.1-latest-win64-gpl-shared-5.1" "ffmpeg"
Write-Output "${{ github.workspace }}\ffmpeg" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
- name: Setup Protoc
uses: arduino/setup-protoc@v1
- name: Setup nanopb
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -UseBasicParsing -Uri "https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.6-windows-x86.zip" -OutFile ".\nanopb-0.4.6-windows-x86.zip"
Expand-Archive -LiteralPath "nanopb-0.4.6-windows-x86.zip" -DestinationPath "."
Rename-Item "nanopb-0.4.6-windows-x86" "nanopb"
- name: Setup OpenSSL
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -UseBasicParsing -Uri "https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1w.zip" -OutFile ".\openssl-1.1.1w.zip"
Expand-Archive -LiteralPath "openssl-1.1.1w.zip" -DestinationPath "."
Rename-Item "openssl-1.1" "openssl"
Write-Output "${{ github.workspace }}\openssl" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
- name: Setup SDL2
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -UseBasicParsing -Uri "https://www.libsdl.org/release/SDL2-devel-2.28.4-VC.zip" -OutFile ".\SDL2-devel-2.28.4-VC.zip"
Expand-Archive -LiteralPath "SDL2-devel-2.28.4-VC.zip" -DestinationPath "."
Rename-Item "SDL2-2.28.4" "SDL2"
$nix_path = "${{ github.workspace }}" -replace "\\", "/"
Write-Output "SDL2_DIR=${{ github.workspace }}\SDL2" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Set-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'set(TARGET_NAME SDL2::SDL2)'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'add_library(${TARGET_NAME} SHARED IMPORTED)'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'set_target_properties(${TARGET_NAME} PROPERTIES'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}"'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' INTERFACE_INCLUDE_DIRECTORIES "$ENV{SDL2_DIR}/include"'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' INTERFACE_LINK_LIBRARIES "$ENV{SDL2_DIR}/lib/x64/SDL2.lib;$ENV{SDL2_DIR}/lib/x64/SDL2main.lib"'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' IMPORTED_LINK_INTERFACE_LANGUAGES "C"'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ')'
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "$ENV{SDL2_DIR}/lib/x64/SDL2.lib")'
Get-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake"
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
architecture: "x64"
- name: Install pip dependencies
run: |
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
python3 -c 'import google.protobuf; print(google.protobuf.__file__)'
- name: Setup Qt
uses: jurplel/install-qt-action@v2
with:
arch: win64_msvc2019_64
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: "x86_64"
toolset: "14"
- name: Configure & Build Opus
run: |
git clone https://github.com/xiph/opus.git
cd opus
mkdir build
cmake `
-S . `
-B build `
-G "Visual Studio 17 2022" -A x64 `
-DCMAKE_C_COMPILER=cl `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\opus-prefix"
cmake --build build --config Release
cmake --install build
- name: Configure Chiaki
working-directory: chiaki
run: |
cmake `
-S . `
-B build `
-G "Visual Studio 17 2022" -A x64 `
-DCMAKE_C_COMPILER=cl `
-DCMAKE_C_FLAGS="-we4013" `
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCHIAKI_ENABLE_CLI=OFF `
-DCHIAKI_GUI_ENABLE_SDL_GAMECONTROLLER=ON `
-DPYTHON_EXECUTABLE="${{ env.pythonLocation }}\python.exe" `
-DCMAKE_PREFIX_PATH="${{ github.workspace }}\nanopb;${{ github.workspace }}\ffmpeg;${{ github.workspace }}\opus-prefix;${{ github.workspace }}\openssl\x64;${{ github.workspace }}\SDL2;${{ env.Qt5_Dir }}"
- name: Build Chiaki
working-directory: chiaki
run: |
cmake --build build --config Release --clean-first --target chiaki
- name: Prepare Qt deployment package
working-directory: chiaki
run: |
mkdir Chiaki-VC
cp build\gui\Release\chiaki.exe Chiaki-VC
cp "${{ github.workspace }}\openssl\x64\bin\libcrypto-1_1-x64.dll" Chiaki-VC
cp "${{ github.workspace }}\openssl\x64\bin\libssl-1_1-x64.dll" Chiaki-VC
cp "${{ github.workspace }}\SDL2\lib\x64\SDL2.dll" Chiaki-VC
cp "${{ github.workspace }}\ffmpeg\bin\swresample-4.dll" Chiaki-VC
cp "${{ github.workspace }}\ffmpeg\bin\avcodec-59.dll" Chiaki-VC
cp "${{ github.workspace }}\ffmpeg\bin\avutil-57.dll" Chiaki-VC
windeployqt.exe --no-translations Chiaki-VC\chiaki.exe
- name: Package Chiaki
working-directory: chiaki
run: |
$CHIAKI_VERSION_MAJOR = (Select-String -Path .\CMakeLists.txt -Pattern 'set\(CHIAKI_VERSION_MAJOR ([0-9]+)\)') | %{$_.Matches.Groups[1].value}
$CHIAKI_VERSION_MINOR = (Select-String -Path .\CMakeLists.txt -Pattern 'set\(CHIAKI_VERSION_MINOR ([0-9]+)\)') | %{$_.Matches.Groups[1].value}
$CHIAKI_VERSION_PATCH = (Select-String -Path .\CMakeLists.txt -Pattern 'set\(CHIAKI_VERSION_PATCH ([0-9]+)\)') | %{$_.Matches.Groups[1].value}
$RELEASE_PACKAGE_FILE = "Chiaki-win_x64-VC-$CHIAKI_VERSION_MAJOR.$CHIAKI_VERSION_MINOR.$CHIAKI_VERSION_PATCH.zip"
Compress-Archive Chiaki-VC $RELEASE_PACKAGE_FILE
$release_filepath = Get-ChildItem $RELEASE_PACKAGE_FILE | %{$_[0].FullName}
echo "RELEASE_PACKAGE_PATH=$release_filepath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Upload Chiaki Artifact
uses: actions/upload-artifact@v3
with:
name: Chiaki-win_x64-VC-Release
path: ${{ env.RELEASE_PACKAGE_PATH }}
if-no-files-found: error
retention-days: 1