1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-24 13:20:13 +00:00
DirectXTex/build/DirectXTex-GitHub-MinGW.yml

314 lines
12 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
# Builds the library and test suite using the MinGW compiler.
schedules:
- cron: "0 5 * * *"
displayName: 'Nightly build'
branches:
include:
- main
trigger:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
pr:
branches:
include:
- main
paths:
exclude:
- '*.md'
- LICENSE
- '.github/*'
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
drafts: false
resources:
repositories:
- repository: self
type: git
ref: refs/heads/main
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
pool:
vmImage: windows-2022
variables:
Codeql.Enabled: false
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'
CompileShadersOutput: $(Build.BinariesDirectory)\Shaders
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
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
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
}
workingDirectory: $(Build.SourcesDirectory)
- task: BatchScript@1
displayName: CompileShaders
inputs:
filename: DirectXTex/Shaders/CompileShaders.cmd
workingFolder: $(Build.SourcesDirectory)\DirectXTex\Shaders
- task: BatchScript@1
displayName: HLSL
inputs:
filename: DDSView/hlsl.cmd
workingFolder: $(Build.SourcesDirectory)\DDSView
- 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
call .\vcpkg install directx-headers
@if ERRORLEVEL 1 goto error
call .\vcpkg install openexr
@if ERRORLEVEL 1 goto error
call .\vcpkg install libpng
@if ERRORLEVEL 1 goto error
call .\vcpkg install libjpeg-turbo
@if ERRORLEVEL 1 goto error
: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:
cwd: '$(Build.SourcesDirectory)'
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 -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW32) Build
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out
- task: CMake@1
displayName: CMake (MinGW32) w/ OpenEXR
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: -B out2 -DCMAKE_BUILD_TYPE="Debug" -DENABLE_OPENEXR_SUPPORT=ON -DBUILD_TESTING=OFF -DDIRECTX_ARCH=x86 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW32) Build w/ OpenEXR
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out2
- task: CMake@1
displayName: CMake (MinGW32) w/ libjpeg
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: -B out3 -DCMAKE_BUILD_TYPE="Debug" -DENABLE_LIBJPEG_SUPPORT=ON -DBUILD_TESTING=OFF -DDIRECTX_ARCH=x86 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW32) Build w/ libjpeg
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out3
- task: CMake@1
displayName: CMake (MinGW32) w/ libpng
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: -B out4 -DCMAKE_BUILD_TYPE="Debug" -DENABLE_LIBPNG_SUPPORT=ON -DBUILD_TESTING=OFF -DDIRECTX_ARCH=x86 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW32) Build w/ libpng
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out4
- 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
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Fetch Tests
inputs:
script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxtextest.git Tests
- 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
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: BatchScript@1
displayName: CompileShaders.cmd
inputs:
filename: DirectXTex/Shaders/CompileShaders.cmd
workingFolder: $(Build.SourcesDirectory)\DirectXTex\Shaders
- task: BatchScript@1
displayName: HLSL
inputs:
filename: DDSView/hlsl.cmd
workingFolder: $(Build.SourcesDirectory)\DDSView
- 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
call .\vcpkg install directx-headers
@if ERRORLEVEL 1 goto error
call .\vcpkg install openexr
@if ERRORLEVEL 1 goto error
call .\vcpkg install libpng
@if ERRORLEVEL 1 goto error
call .\vcpkg install libjpeg-turbo
@if ERRORLEVEL 1 goto error
: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:
cwd: '$(Build.SourcesDirectory)'
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 -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW-W64) Build
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out
- task: CMake@1
displayName: CMake (MinGW-W64) w/ OpenEXR
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: -B out2 -DCMAKE_BUILD_TYPE="Debug" -DENABLE_OPENEXR_SUPPORT=ON -DBUILD_TESTING=OFF -DDIRECTX_ARCH=x64 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW-W64) Build w/ OpenEXR
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out2
- task: CMake@1
displayName: CMake (MinGW-W64) w/ libjpeg
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: -B out3 -DCMAKE_BUILD_TYPE="Debug" -DENABLE_LIBJPEG_SUPPORT=ON -DBUILD_TESTING=OFF -DDIRECTX_ARCH=x64 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW-W64) Build w/ libjpeg
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out3
- task: CMake@1
displayName: CMake (MinGW-W64) w/ libpng
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: -B out4 -DCMAKE_BUILD_TYPE="Debug" -DENABLE_LIBPNG_SUPPORT=ON -DBUILD_TESTING=OFF -DDIRECTX_ARCH=x64 -DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)" -DCMAKE_CXX_COMPILER="g++.exe" -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DUSE_PREBUILT_SHADERS=ON -DCOMPILED_SHADERS=$(Build.BinariesDirectory)\Shaders
- task: CMake@1
displayName: CMake (MinGW-W64) Build w/ libpng
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out4