Add build-windows.bat file for managing the Windows builds and update CI to use it
This commit is contained in:
parent
10797f049c
commit
c02da4066c
2 changed files with 146 additions and 111 deletions
176
.gitlab-ci.yml
176
.gitlab-ci.yml
|
|
@ -411,61 +411,7 @@ before_script:
|
|||
- .shared_windows_runners
|
||||
stage: build
|
||||
script:
|
||||
- $esc = "$([char]27)"
|
||||
- $count = 0
|
||||
- function _unix_tmsec_ { [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds }
|
||||
- function _fold_start_ { param( [string]$TEXT_TAG ) $t=_unix_tmsec_; $global:count += 1; Write-Host -NoNewLine "`r`n`r`nsection_start:${t}:sect_${count}`r${esc}[0K${esc}[33m${TEXT_TAG}${esc}[39m`r`n"; }
|
||||
- function _fold_final_ { $t=_unix_tmsec_; Write-Host -NoNewLine "`r`n`r`nsection_end:${t}:sect_${count}`r${esc}[0K`r`n" ; }
|
||||
|
||||
|
||||
- _fold_start_ 'configuring the msvc environment variables'
|
||||
- Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Auxiliary/Build"
|
||||
- '& cmd.exe /C "vcvarsall.bat x86 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }'
|
||||
- Pop-Location
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'downloading precompiled versions of qtbase, qttools (for windeployqt) and jom (for a more parallel nmake)'
|
||||
- mkdir _qt
|
||||
- mkdir _qt_download
|
||||
- Push-Location _qt_download
|
||||
- curl.exe -LJ -o qt-base.7z 'https://gitlab.com/OpenRGBDevelopers/openrgb-linux-ci-deb-builder/-/package_files/55610076/download'
|
||||
- curl.exe -LJ -o qt-tools.7z 'https://gitlab.com/OpenRGBDevelopers/openrgb-linux-ci-deb-builder/-/package_files/55610097/download'
|
||||
- curl.exe -LJ -o qt-jom.zip 'https://gitlab.com/OpenRGBDevelopers/openrgb-linux-ci-deb-builder/-/package_files/55610138/download'
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'extracting the downloaded qt binaries'
|
||||
- 7z x qt-base.7z '-o../_qt' -y
|
||||
- 7z x qt-tools.7z '-o../_qt' -y
|
||||
- 7z x qt-jom.zip '-o../_qt' -y
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'turn the qt install from enterprise to foss; remove the licensing checks'
|
||||
- ${qconfig-pri-folder} = '..\_qt\5.15.0\msvc2019\mkspecs\qconfig.pri'
|
||||
- (Get-Content ${qconfig-pri-folder}).replace('QT_EDITION = Enterprise', 'QT_EDITION = OpenSource') | Set-Content ${qconfig-pri-folder}
|
||||
- (Get-Content ${qconfig-pri-folder}).replace('QT_LICHECK = licheck.exe', '') | Set-Content ${qconfig-pri-folder}
|
||||
- Pop-Location
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'run qmake and generate the msvc nmake makefile'
|
||||
- mkdir _build; cd _build
|
||||
- ..\_qt\5.15.0\msvc2019\bin\qmake ..\OpenRGB.pro
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'start the actual build with jom instead of nmake; for speed'
|
||||
- ..\_qt\jom
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'run windeployqt to automatically copy the needed dll files'
|
||||
- ..\_qt\5.15.0\msvc2019\bin\windeployqt --no-angle --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime --no-webkit2 .\release\
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'Moving results for upload'
|
||||
- mv release ../'OpenRGB Windows 32-bit'
|
||||
- _fold_final_
|
||||
# cache:
|
||||
# key: same-key
|
||||
# paths:
|
||||
# - C:\vcpkg\installed\
|
||||
- scripts\build-windows.bat 5.15.0 2019 32
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_Windows_32_${CI_COMMIT_SHORT_SHA}"
|
||||
paths:
|
||||
|
|
@ -477,6 +423,26 @@ before_script:
|
|||
rules:
|
||||
- !reference [.upstream_rules, rules]
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Windows (32-bit) Qt6 Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
"Windows 32 Qt6":
|
||||
extends:
|
||||
- .shared_windows_runners
|
||||
stage: build
|
||||
script:
|
||||
- scripts\build-windows.bat 6.8.3 2022 32
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_Windows_32_Qt6_${CI_COMMIT_SHORT_SHA}"
|
||||
paths:
|
||||
- 'OpenRGB Windows 32-bit'
|
||||
exclude:
|
||||
- 'OpenRGB Windows 32-bit\*.qm'
|
||||
expire_in: 30 days
|
||||
|
||||
rules:
|
||||
- !reference [.upstream_rules, rules]
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Windows (64-bit) Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
|
|
@ -485,61 +451,7 @@ before_script:
|
|||
- .shared_windows_runners
|
||||
stage: build
|
||||
script:
|
||||
- $esc = "$([char]27)"
|
||||
- $count = 0
|
||||
- function _unix_tmsec_ { [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds }
|
||||
- function _fold_start_ { param( [string]$TEXT_TAG ) $t=_unix_tmsec_; $global:count += 1; Write-Host -NoNewLine "`r`n`r`nsection_start:${t}:sect_${count}`r${esc}[0K${esc}[33m${TEXT_TAG}${esc}[39m`r`n"; }
|
||||
- function _fold_final_ { $t=_unix_tmsec_; Write-Host -NoNewLine "`r`n`r`nsection_end:${t}:sect_${count}`r${esc}[0K`r`n" ; }
|
||||
|
||||
|
||||
- _fold_start_ 'configuring the msvc environment variables'
|
||||
- Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Auxiliary/Build"
|
||||
- '& cmd.exe /C "vcvarsall.bat x64 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }'
|
||||
- Pop-Location
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'downloading precompiled versions of qtbase, qttools (for windeployqt) and jom (for a more parallel nmake)'
|
||||
- mkdir _qt
|
||||
- mkdir _qt_download
|
||||
- Push-Location _qt_download
|
||||
- curl.exe -LJ -o qt-base.7z 'https://gitlab.com/OpenRGBDevelopers/openrgb-linux-ci-deb-builder/-/package_files/55610116/download'
|
||||
- curl.exe -LJ -o qt-tools.7z 'https://gitlab.com/OpenRGBDevelopers/openrgb-linux-ci-deb-builder/-/package_files/55610131/download'
|
||||
- curl.exe -LJ -o qt-jom.zip 'https://gitlab.com/OpenRGBDevelopers/openrgb-linux-ci-deb-builder/-/package_files/55610138/download'
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'extracting the downloaded qt binaries'
|
||||
- 7z x qt-base.7z '-o../_qt' -y
|
||||
- 7z x qt-tools.7z '-o../_qt' -y
|
||||
- 7z x qt-jom.zip '-o../_qt' -y
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'turn the qt install from enterprise to foss; remove the licensing checks'
|
||||
- ${qconfig-pri-folder} = '..\_qt\5.15.0\msvc2019_64\mkspecs\qconfig.pri'
|
||||
- (Get-Content ${qconfig-pri-folder}).replace('QT_EDITION = Enterprise', 'QT_EDITION = OpenSource') | Set-Content ${qconfig-pri-folder}
|
||||
- (Get-Content ${qconfig-pri-folder}).replace('QT_LICHECK = licheck.exe', '') | Set-Content ${qconfig-pri-folder}
|
||||
- Pop-Location
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'run qmake and generate the msvc nmake makefile'
|
||||
- mkdir _build; cd _build
|
||||
- ..\_qt\5.15.0\msvc2019_64\bin\qmake ..\OpenRGB.pro
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'start the actual build with jom instead of nmake; for speed'
|
||||
- ..\_qt\jom
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'run windeployqt to automatically copy the needed dll files'
|
||||
- ..\_qt\5.15.0\msvc2019_64\bin\windeployqt --no-angle --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime --no-webkit2 .\release\
|
||||
- _fold_final_
|
||||
|
||||
- _fold_start_ 'Moving results for upload'
|
||||
- mv release ../'OpenRGB Windows 64-bit'
|
||||
- _fold_final_
|
||||
# cache:
|
||||
# key: same-key
|
||||
# paths:
|
||||
# - C:\vcpkg\installed\
|
||||
- scripts\build-windows.bat 5.15.0 2019 64
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_Windows_64_${CI_COMMIT_SHORT_SHA}"
|
||||
paths:
|
||||
|
|
@ -561,7 +473,49 @@ before_script:
|
|||
"Windows 64 (gitlab.com runner)":
|
||||
extends: "Windows 64 Base"
|
||||
before_script:
|
||||
choco install visualstudio2019-workload-vctools -y # gitlab provides vs2022, so add vs2019
|
||||
- git clone https://gitlab.com/OpenRGBDevelopers/OpenRGB-Qt-Packages
|
||||
- cd OpenRGB-Qt-Packages
|
||||
- .\install-chocolatey.bat
|
||||
- cd ..
|
||||
rules:
|
||||
- !reference [.fork_gitlab_runner_rules, rules]
|
||||
tags:
|
||||
- "saas-windows-medium-amd64"
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Windows (64-bit) Qt6 Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
"Windows 64 Qt6 Base":
|
||||
extends:
|
||||
- .shared_windows_runners
|
||||
stage: build
|
||||
script:
|
||||
- scripts\build-windows.bat 6.8.3 2022 64
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_Windows_64_Qt6_${CI_COMMIT_SHORT_SHA}"
|
||||
paths:
|
||||
- 'OpenRGB Windows 64-bit'
|
||||
exclude:
|
||||
- 'OpenRGB Windows 64-bit\*.qm'
|
||||
expire_in: 30 days
|
||||
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push"
|
||||
when: never
|
||||
|
||||
|
||||
"Windows 64 Qt6":
|
||||
extends: "Windows 64 Qt6 Base"
|
||||
rules:
|
||||
- !reference [.fork_local_runner_rules, rules]
|
||||
|
||||
"Windows 64 Qt6 (gitlab.com runner)":
|
||||
extends: "Windows 64 Qt6 Base"
|
||||
before_script:
|
||||
- git clone https://gitlab.com/OpenRGBDevelopers/OpenRGB-Qt-Packages
|
||||
- cd OpenRGB-Qt-Packages
|
||||
- .\install-chocolatey.bat
|
||||
- cd ..
|
||||
rules:
|
||||
- !reference [.fork_gitlab_runner_rules, rules]
|
||||
tags:
|
||||
|
|
|
|||
81
scripts/build-windows.bat
Normal file
81
scripts/build-windows.bat
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
::---------------------------------------------------------::
|
||||
:: OpenRGB Windows Build Script ::
|
||||
:: ::
|
||||
:: Sets up build environment for desired Qt version and ::
|
||||
:: build architecture, then builds OpenRGB ::
|
||||
:: ::
|
||||
:: Prerequisites: ::
|
||||
:: * Microsoft Visual Studio Build Tools ::
|
||||
:: * OpenRGB Qt Packages ::
|
||||
:: ::
|
||||
:: Adam Honse (calcprogrammer1@gmail.com) 18 Apr 2025 ::
|
||||
::---------------------------------------------------------::
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Parse arguments ::
|
||||
:: Format: build-windows.bat QT_VER MSVC_VER BITS ::
|
||||
:: Example: build-windows.bat 6.3.8 2022 64 ::
|
||||
::---------------------------------------------------------::
|
||||
@SET QT_VER=%1
|
||||
@SET MSVC_VER=%2
|
||||
@SET BITS=%3
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Set variables based on bits value ::
|
||||
::---------------------------------------------------------::
|
||||
@if %BITS% == 32 goto bits_32
|
||||
@if %BITS% == 64 goto bits_64
|
||||
|
||||
:bits_32
|
||||
@SET MSVC_ARCH=x86
|
||||
@SET QT_PATH=
|
||||
goto bits_done
|
||||
|
||||
:bits_64
|
||||
@SET MSVC_ARCH=x64
|
||||
@SET QT_PATH=_64
|
||||
goto bits_done
|
||||
|
||||
:bits_done
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Add desired Qt version to PATH ::
|
||||
::---------------------------------------------------------::
|
||||
@SET "PATH=%PATH%;C:\Qt\%QT_VER%\msvc%MSVC_VER%%QT_PATH%\bin"
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Add jom to PATH ::
|
||||
::---------------------------------------------------------::
|
||||
@SET "PATH=%PATH%;C:\Qt\jom"
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Run vcvarsall ::
|
||||
::---------------------------------------------------------::
|
||||
@call "C:\Program Files (x86)\Microsoft Visual Studio\%MSVC_VER%\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" %MSVC_ARCH%
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Re-create build directory and cd into it ::
|
||||
::---------------------------------------------------------::
|
||||
::rm -r build
|
||||
::mkdir build
|
||||
::cd build
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Run qmake to configure the build ::
|
||||
::---------------------------------------------------------::
|
||||
qmake OpenRGB.pro CONFIG-=debug_and_release CONFIG+=release
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Run jom to execute the build ::
|
||||
::---------------------------------------------------------::
|
||||
jom
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Run windeployqt to copy the Qt dll files ::
|
||||
::---------------------------------------------------------::
|
||||
windeployqt --no-patchqt --no-quick-import --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-opengl-sw --no-network .\release\
|
||||
|
||||
::---------------------------------------------------------::
|
||||
:: Rename the release folder ::
|
||||
::---------------------------------------------------------::
|
||||
move "release" "OpenRGB Windows %BITS%-bit"
|
||||
Loading…
Add table
Add a link
Reference in a new issue