Files
SEQUA-Engine/scripts/build-all.ps1
T
Ange-Marie MAURIN - A2M Systèmes da0d31385b build: arborescence bin/<plateforme>/<type> et build unifié (ADR 0010)
- platform/layout : racine sequa-root.json, chemins des composants, arguments et chemins en UTF-8.
- Règles install() : bin/windows-x64/{debug,release,asan}/ (core, render, studio + ui, engines).
- Le Core trouve sequa-render et les adaptateurs depuis la racine (--sequa-root, passé par
  Studio host à sa copie fantôme) : plus de render-unavailable depuis le panneau Rendu.
- L'adaptateur Godot cherche Godot et son projet à côté de lui (surcharge par --adapter-options) ;
  template_release pour le type release. Godot hébergé dans les presets debug et release.
- scripts/build-all.ps1 : Godot, C++, interface, arrêt des processus du dossier visé, install ;
  check.ps1 l'appelle (modification de l'ADR 0004).
- docs/installation/ : compiler, lancer, installer et désinstaller par plateforme.
2026-11-07 15:50:37 +01:00

159 lines
5.4 KiB
PowerShell

# SPDX-License-Identifier: MPL-2.0
# Messages en ASCII : compatible Windows PowerShell 5.1 sans BOM.
<#
.SYNOPSIS
Build unifie (ADR 0010) : Godot, C++, interface, puis bin\<plateforme>\<type>\.
.DESCRIPTION
Pour chaque type demande :
1. Godot (LibGodot) via build-godot.ps1, seulement si sa bibliotheque manque
(template_debug pour debug, template_release pour release, rien pour asan) ;
2. le preset CMake via build.ps1 (compilation et tests) ;
3. arret des processus SEQUA lances depuis bin\<plateforme>\<type>\ (Studio, Core,
rendu) : Windows refuse de remplacer un fichier en cours d'utilisation ;
4. cmake --install vers bin\<plateforme>\<type>\.
L'interface (studio\ui) est construite une fois, avant le premier type.
Lancer ensuite : bin\windows-x64\<type>\studio\sequa-studio.exe
.PARAMETER Type
debug (defaut), release, asan, ou all (les trois).
.PARAMETER NoTests
Compile sans lancer les tests.
.PARAMETER Godot
Reconstruit Godot meme si sa bibliotheque existe (apres une modification du fork).
.PARAMETER SkipGodot
Ne construit jamais Godot (echoue a la configuration s'il manque).
.PARAMETER SkipUi
Ne construit pas l'interface (installe studio\ui\dist s'il existe).
.PARAMETER NoStop
Echoue au lieu d'arreter les processus SEQUA qui tournent depuis le dossier vise.
.PARAMETER Clean
Supprime build\<preset> et bin\<plateforme>\<type> avant de construire.
.PARAMETER Help
Affiche cette aide.
.EXAMPLE
.\scripts\build-all.ps1
.EXAMPLE
.\scripts\build-all.ps1 -Type all -NoTests
#>
[CmdletBinding()]
param(
[ValidateSet("debug", "release", "asan", "all")]
[string]$Type = "debug",
[switch]$NoTests,
[switch]$Godot,
[switch]$SkipGodot,
[switch]$SkipUi,
[switch]$NoStop,
[switch]$Clean,
[Alias("h", "?")]
[switch]$Help
)
if ($Help) {
Get-Help $PSCommandPath -Detailed
exit 0
}
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$platform = "windows-x64"
$types = if ($Type -eq "all") { @("debug", "release", "asan") } else { @($Type) }
$presets = @{ debug = "windows-msvc-debug"; release = "windows-msvc-release"; asan = "windows-msvc-asan" }
$godotTargets = @{ debug = "template_debug"; release = "template_release"; asan = $null }
function Invoke-Step([string]$label, [scriptblock]$cmd) {
Write-Host "==> $label" -ForegroundColor Cyan
& $cmd
if ($LASTEXITCODE -ne 0) { throw "Echec : $label (code $LASTEXITCODE)" }
}
function Build-Ui {
$ui = Join-Path $root "studio\ui"
Push-Location $ui
try {
if (-not (Test-Path (Join-Path $ui "node_modules"))) {
Invoke-Step "studio\ui : npm ci" { npm ci }
}
Invoke-Step "studio\ui : npm run build" { npm run build }
}
finally {
Pop-Location
}
}
function Build-Godot([string]$target) {
$library = Join-Path $root "engines\godot\vendor\godot-src\bin\godot.windows.$target.x86_64.dll"
if ((Test-Path $library) -and -not $Godot) { return }
if ($SkipGodot) { return }
Write-Host "==> Godot $target (10 a 20 min la premiere fois)" -ForegroundColor Cyan
& (Join-Path $PSScriptRoot "build-godot.ps1") -Target $target
}
# Processus SEQUA lances depuis $dir : executable dans $dir, ou Core (copie fantome)
# dont la ligne de commande designe $dir par --sequa-root.
function Get-SequaProcesses([string]$dir) {
$prefix = [IO.Path]::GetFullPath($dir).TrimEnd('\') + '\'
Get-CimInstance Win32_Process -Filter "Name LIKE 'sequa-%'" | Where-Object {
($_.ExecutablePath -and $_.ExecutablePath.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) -or
($_.CommandLine -and $_.CommandLine.IndexOf($prefix.TrimEnd('\'), [StringComparison]::OrdinalIgnoreCase) -ge 0)
}
}
function Stop-SequaProcesses([string]$dir) {
$running = @(Get-SequaProcesses $dir)
if ($running.Count -eq 0) { return }
$names = ($running | ForEach-Object { "$($_.Name) (pid $($_.ProcessId))" }) -join ", "
if ($NoStop) { throw "Processus SEQUA en cours depuis $dir : $names (-NoStop)" }
Write-Host "==> arret : $names" -ForegroundColor Yellow
foreach ($process in $running) {
Stop-Process -Id $process.ProcessId -Force -ErrorAction SilentlyContinue
}
foreach ($process in $running) {
Wait-Process -Id $process.ProcessId -Timeout 10 -ErrorAction SilentlyContinue
}
}
$start = Get-Date
if (-not $SkipUi) { Build-Ui }
foreach ($t in $types) {
$preset = $presets[$t]
$bin = Join-Path $root "bin\$platform\$t"
$buildDir = Join-Path $root "build\$preset"
if ($godotTargets[$t]) { Build-Godot $godotTargets[$t] }
$buildArgs = @{ Preset = $preset }
if ($NoTests) { $buildArgs.NoTests = $true }
if ($Clean) { $buildArgs.Clean = $true }
& (Join-Path $PSScriptRoot "build.ps1") @buildArgs
Stop-SequaProcesses $bin
if ($Clean -and (Test-Path $bin)) { Remove-Item -Recurse -Force $bin }
# L'interface change de noms de fichiers a chaque build : pas de restes.
$uiBin = Join-Path $bin "studio\ui"
if (Test-Path $uiBin) { Remove-Item -Recurse -Force $uiBin }
# cmake est dans le PATH depuis build.ps1 (CMake de Visual Studio).
Invoke-Step "install $preset -> bin\$platform\$t" { cmake --install $buildDir --prefix $bin }
}
$elapsed = (Get-Date) - $start
Write-Host ("==> termine en {0:N1} min" -f $elapsed.TotalMinutes) -ForegroundColor Green
foreach ($t in $types) {
Write-Host " bin\$platform\$t\studio\sequa-studio.exe"
}