UVAtlas/build/UVAtlas-GitHub-MinGW.yml

223 lines
7.3 KiB
YAML
Raw Normal View History

2022-12-08 02:09:41 +00:00
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkID=512686
# Builds the library and test suite using the MinGW compiler.
schedules:
- cron: "30 4 * * *"
displayName: 'Nightly build'
branches:
include:
- main
trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.json
- build/*.props
- build/*.mdb
- build/*.ps1
pr:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.json
- build/*.props
- build/*.mdb
- build/*.ps1
drafts: false
2022-12-08 02:09:41 +00:00
resources:
repositories:
- repository: self
type: git
ref: refs/heads/main
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
pool:
vmImage: windows-2022
variables:
2024-05-14 19:59:10 +00:00
Codeql.Enabled: false
2022-12-08 02:09:41 +00:00
VCPKG_CMAKE_DIR: '$(VCPKG_ROOT)/scripts/buildsystems/vcpkg.cmake'
GITHUB_PAT: $(GITHUBPUBLICTOKEN)
WIN11_SDK: '10.0.22000.0'
URL_MINGW32: https://github.com/brechtsanders/winlibs_mingw/releases/download/12.2.0-14.0.6-10.0.0-ucrt-r2/winlibs-i686-posix-dwarf-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2.zip
HASH_MINGW32: 'fcd1e11b896190da01c83d5b5fb0d37b7c61585e53446c2dab0009debc3915e757213882c35e35396329338de6f0222ba012e23a5af86932db45186a225d1272'
jobs:
- job: MINGW32_BUILD
displayName: 'Minimalist GNU for Windows (MinGW32)'
steps:
- checkout: self
clean: true
fetchTags: false
- task: CmdLine@2
# We can use the preinstalled vcpkg instead of the latest when MS Hosted updates their vcpkg to the newer DirectX-Headers
displayName: Fetch VCPKG
inputs:
script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git
2022-12-08 02:09:41 +00:00
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: VCPKG Bootstrap
inputs:
script: |
call bootstrap-vcpkg.bat
echo ##vso[task.setvariable variable=VCPKG_DEFAULT_TRIPLET;]x86-mingw-static
echo ##vso[task.setvariable variable=VCPKG_DEFAULT_HOST_TRIPLET;]x86-mingw-static
workingDirectory: $(Build.SourcesDirectory)\vcpkg
- task: PowerShell@2
displayName: Install MinGW32 and setup for Windows 11 SDK
2022-12-08 02:09:41 +00:00
inputs:
targetType: inline
script: |
$ProgressPreference = 'SilentlyContinue'
Write-Host "Downloading winlibs..."
Invoke-WebRequest -Uri "$(URL_MINGW32)" -OutFile "gw32.zip"
Write-Host "Downloaded."
$fileHash = Get-FileHash -Algorithm SHA512 gw32.zip | ForEach { $_.Hash} | Out-String
$filehash = $fileHash.Trim()
Write-Host "##[debug]SHA512: " $fileHash
if ($fileHash -ne '$(HASH_MINGW32)') {
Write-Error -Message "##[error]Computed hash does not match!" -ErrorAction Stop
}
Write-Host "Extracting winlibs..."
Expand-Archive -LiteralPath 'gw32.zip'
Write-Host "Extracted."
Write-Host "Added to path: $env:BUILD_SOURCESDIRECTORY\gw32\mingw32\bin"
Write-Host "##vso[task.prependpath]$env:BUILD_SOURCESDIRECTORY\gw32\mingw32\bin"
$sdkroot = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' | Select-Object -ExpandProperty KitsRoot10
$windows11sdk = "{0}bin\$(WIN11_SDK)\" -f $sdkroot
if (Test-Path "$windows11sdk") {
Write-Host "##vso[task.setvariable variable=WindowsSdkVerBinPath;]$windows11sdk"
}
else {
Write-Error -Message "##[error]Can't find Windows SDK ($(WIN11_SDK))" -ErrorAction Stop
}
2022-12-08 02:09:41 +00:00
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: GCC version
inputs:
script: g++ --version
- task: CmdLine@2
displayName: VCPKG install headers
inputs:
script: |
call vcpkg install directxmath
@if ERRORLEVEL 1 goto error
2022-12-08 02:09:41 +00:00
call vcpkg install directx-headers
@if ERRORLEVEL 1 goto error
2022-12-08 02:09:41 +00:00
:finish
@echo --- VCPKG COMPLETE ---
exit /b 0
:error
@echo --- ERROR: VCPKG FAILED ---
exit /b 1
workingDirectory: $(Build.SourcesDirectory)\vcpkg
- task: CMake@1
displayName: CMake (MinGW32)
inputs:
2022-12-08 09:14:26 +00:00
cwd: '$(Build.SourcesDirectory)'
2022-12-08 02:09:41 +00:00
cmakeArgs: -B out -DCMAKE_BUILD_TYPE="Debug" -DDIRECTX_ARCH=x86 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x86-mingw-static
- task: CMake@1
displayName: CMake (MinGW32) Build
inputs:
2022-12-08 09:14:26 +00:00
cwd: '$(Build.SourcesDirectory)'
2022-12-08 02:09:41 +00:00
cmakeArgs: --build out
- job: MINGW64_BUILD
displayName: 'Minimalist GNU for Windows (MinGW-W64) BUILD_TESTING=ON'
steps:
- checkout: self
clean: true
fetchTags: false
- task: CmdLine@2
displayName: Fetch VCPKG
inputs:
script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git
2022-12-08 02:09:41 +00:00
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Fetch Tests
inputs:
script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/uvatlastest.git Tests
2022-12-08 02:09:41 +00:00
- task: CmdLine@2
displayName: VCPKG Bootstrap
inputs:
script: |
call bootstrap-vcpkg.bat
echo ##vso[task.setvariable variable=VCPKG_DEFAULT_TRIPLET;]x64-mingw-static
echo ##vso[task.setvariable variable=VCPKG_DEFAULT_HOST_TRIPLET;]x64-mingw-static
workingDirectory: $(Build.SourcesDirectory)\vcpkg
- task: PowerShell@2
displayName: Setup for Shader Compilation
2022-12-08 02:09:41 +00:00
inputs:
targetType: inline
script: |
$ProgressPreference = 'SilentlyContinue'
$sdkroot = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' | Select-Object -ExpandProperty KitsRoot10
$windows11sdk = "{0}bin\$(WIN11_SDK)\" -f $sdkroot
$windows11x64sdk = "{0}bin\$(WIN11_SDK)\x64" -f $sdkroot
if (Test-Path "$windows11sdk") {
Write-Host "##vso[task.setvariable variable=WindowsSdkVerBinPath;]$windows11sdk"
Write-Host "##vso[task.prependpath]$windows11x64sdk"
}
else {
Write-Error -Message "##[error]Can't find Windows SDK ($(WIN11_SDK))" -ErrorAction Stop
}
- task: CmdLine@2
displayName: GCC version
inputs:
script: g++ --version
- task: CmdLine@2
displayName: VCPKG install headers
inputs:
script: |
call vcpkg install directxmath
@if ERRORLEVEL 1 goto error
2022-12-08 02:09:41 +00:00
call vcpkg install directx-headers
@if ERRORLEVEL 1 goto error
2022-12-08 02:09:41 +00:00
call vcpkg install directxmesh
@if ERRORLEVEL 1 goto error
2022-12-08 02:09:41 +00:00
call vcpkg install directxtex
@if ERRORLEVEL 1 goto error
2022-12-08 02:09:41 +00:00
:finish
@echo --- VCPKG COMPLETE ---
exit /b 0
:error
@echo --- ERROR: VCPKG FAILED ---
exit /b 1
workingDirectory: $(Build.SourcesDirectory)\vcpkg
- task: CMake@1
displayName: CMake (MinGW-W64)
inputs:
2022-12-08 09:14:26 +00:00
cwd: '$(Build.SourcesDirectory)'
2022-12-08 02:09:41 +00:00
cmakeArgs: -B out -DCMAKE_BUILD_TYPE="Debug" -DDIRECTX_ARCH=x64 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static
- task: CMake@1
displayName: CMake (MinGW-W64) Build
inputs:
2022-12-08 09:14:26 +00:00
cwd: '$(Build.SourcesDirectory)'
2022-12-08 02:09:41 +00:00
cmakeArgs: --build out