Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ x64
/out
/CMakeUserPresets.json
/build/vcpkg_installed
/build/*.exe
43 changes: 25 additions & 18 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21
},
"configurePresets": [
{
"name": "base",
Expand All @@ -10,14 +14,15 @@
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}"
},

{
"name": "x64",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": { "DIRECTX_ARCH": "x64" },
"cacheVariables": {
"DIRECTX_ARCH": "x64"
},
"hidden": true
},
{
Expand All @@ -26,7 +31,9 @@
"value": "x86",
"strategy": "external"
},
"cacheVariables": { "DIRECTX_ARCH": "x86" },
"cacheVariables": {
"DIRECTX_ARCH": "x86"
},
"hidden": true
},
{
Expand All @@ -35,7 +42,9 @@
"value": "arm64",
"strategy": "external"
},
"cacheVariables": { "DIRECTX_ARCH": "arm64" },
"cacheVariables": {
"DIRECTX_ARCH": "arm64"
},
"hidden": true
},
{
Expand All @@ -44,29 +53,30 @@
"value": "arm64ec",
"strategy": "external"
},
"cacheVariables": { "DIRECTX_ARCH": "arm64ec" },
"cacheVariables": {
"DIRECTX_ARCH": "arm64ec"
},
"environment": {
"CFLAGS": "/arm64EC",
"CXXFLAGS": "/arm64EC"
},
"hidden": true
},

{
"name": "Debug",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" },
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"hidden": true
},
{
"name": "Release",
"cacheVariables":
{
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": true
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": true
},
"hidden": true
},

{
"name": "MSVC",
"hidden": true,
Expand Down Expand Up @@ -116,7 +126,6 @@
"strategy": "external"
}
},

{
"name": "Win8",
"cacheVariables": {
Expand Down Expand Up @@ -197,19 +206,16 @@
"strategy": "external"
}
},

{
"name": "Analyze",
"cacheVariables":
{
"cacheVariables": {
"ENABLE_CODE_ANALYSIS": true
},
"hidden": true
},
{
"name": "Coverage",
"cacheVariables":
{
"cacheVariables": {
"BUILD_TOOLS": false,
"ENABLE_CODE_COVERAGE": true
},
Expand Down Expand Up @@ -313,6 +319,7 @@
{ "name": "x64-Coverage-Clang", "description": "Clang/LLVM for x64 (Debug) with DX12 w/ Code Coverage", "inherits": [ "base", "x64", "Debug", "Clang", "Coverage" ] },
{ "name": "x64-Fuzzing" , "description": "MSVC for x64 (Release) with ASan", "inherits": [ "base", "x64", "Release", "MSVC", "Fuzzing" ] }
],

"testPresets": [
{ "name": "x64-Debug" , "configurePreset": "x64-Debug" },
{ "name": "x64-Release" , "configurePreset": "x64-Release" },
Expand Down
138 changes: 138 additions & 0 deletions build/downloadbuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<#

.NOTES
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.

.SYNOPSIS
Downloads build artifacts from Azure DevOps for DirectXMesh.

.DESCRIPTION
This script is used as part of the internal release process for DirectXMesh.

.PARAMETER BuildId
This is the specific build to get artifacts from.

.PARAMETER PAT
Requires an ADO PAT with 'Build > Read' scope. Can be provided via the ADO_PERSONAL_ACCESS_TOKEN environment variable or as a parameter.

.LINK
https://github.com/microsoft/DirectXMesh/wiki

#>

param(
[Parameter(Mandatory)]
[int]$BuildId,
[string]$PAT = ""
)

# Parse PAT
if ($PAT.Length -eq 0) {
$PAT = $env:ADO_PERSONAL_ACCESS_TOKEN

if ($PAT.Length -eq 0) {
Write-Error "##[error]This script requires a valid ADO Personal Access Token!" -ErrorAction Stop
}
}

# Initial REST query
$headers = @{
"Content-Type" = "application/json"
Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$PAT"))
}

$uriFormat = "https://dev.azure.com/MSCodeHub/c083e54b-cdc7-4b8b-8bf6-0d874500b610/_apis/build/builds/{0}/artifacts?artifactName={1}&api-version=7.1"

$uriarm64 = $uriFormat -f $BuildId, "DirectXMesh_Binaries_Release_ARM64"
$uriamd64 = $uriFormat -f $BuildId, "DirectXMesh_Binaries_Release_x64"

try
{
Write-Host "Checking if build and artifacts exist..."
$responseamd64 = Invoke-RestMethod -Uri $uriamd64 -Method Get -Headers $headers
$responsearm64 = Invoke-RestMethod -Uri $uriarm64 -Method Get -Headers $headers
}
catch
{
Write-Error "##[error]Build $BuildId not found!" -ErrorAction Continue
}

$ProgressPreference = 'SilentlyContinue'

$tempFolderPath = Join-Path $Env:Temp $(New-Guid)
New-Item -Type Directory -Path $tempFolderPath | Out-Null

Write-Host $tempFolderPath

$headers = @{
Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$PAT"))
Accept = "application/zip"
}

Add-Type -A System.IO.Compression.FileSystem

# Download artifacts for ARM64
foreach ($artifact in $responsearm64) {
$artifactName = $artifact.name
$downloadUrl = $artifact.resource.downloadUrl
$outputFile = Join-Path $tempFolderPath "$artifactName.zip"

try
{
Write-Host "Downloading $artifactName to $outputFile..."
Invoke-WebRequest -Uri $downloadUrl -Headers $headers -OutFile $outputFile
}
catch
{
Write-Error "##[error]Failed to download $artifactName!" -ErrorAction Continue
}

try
{
Write-Host "Extracting $artifactName..."
[IO.Compression.ZipFile]::ExtractToDirectory($outputFile, $tempFolderPath)
}
catch
{
Write-Error "##[error]Failed to extract $artifactName!" -ErrorAction Continue
}
}

# Download artifacts for X64
foreach ($artifact in $responseamd64) {
$artifactName = $artifact.name
$downloadUrl = $artifact.resource.downloadUrl
$outputFile = Join-Path $tempFolderPath "$artifactName.zip"

try
{
Write-Host "Downloading $artifactName to $outputFile..."
Invoke-WebRequest -Uri $downloadUrl -Headers $headers -OutFile $outputFile
}
catch
{
Write-Error "##[error]Failed to download $artifactName!" -ErrorAction Continue
}

try
{
Write-Host "Extracting $artifactName..."
[IO.Compression.ZipFile]::ExtractToDirectory($outputFile, $tempFolderPath)
}
catch
{
Write-Error "##[error]Failed to extract $artifactName!" -ErrorAction Continue
}
}

# Extract command-line tool binary
$exe = "Meshconvert"

$binPath = Join-Path $tempFolderPath "DirectXMesh_Binaries_Release_ARM64"
$srcPath = "{0}\{1}\Bin\Desktop_2022_Win10\ARM64\Release\{1}_arm64.exe" -f $binPath, $exe
Copy-Item -Path $srcPath -Destination "." -ErrorAction Stop

$binPath = Join-Path $tempFolderPath "DirectXMesh_Binaries_Release_x64"
$srcPath = "{0}\{1}\Bin\Desktop_2022\x64\Release\{1}.exe" -f $binPath, $exe
Copy-Item -Path $srcPath -Destination "." -ErrorAction Stop
Loading
Loading