build(godot): extraction de l'API du fork pour godot-cpp
scripts/build-godot.ps1 -Target editor construit l'éditeur du fork (exécutable, pas LibGodot), seul à savoir faire --dump-extension-api, et écrit build/godot/extension_api.json. godot-cpp s'appuie ainsi sur l'API réelle du fork plutôt que sur la liste officielle 4.7 (identiques tant que le fork ne touche pas à l'API : 1036 classes).
This commit is contained in:
1 parent
203e9ed9b6
commit
9358bd404e
1 file changed
+31
-6
+31
-6
@@ -14,8 +14,13 @@
|
||||
|
||||
Sortie : engines/godot/vendor/godot-src/bin/godot.windows.<target>.x86_64.dll
|
||||
|
||||
-Target editor construit l'editeur du fork (executable, pas LibGodot) uniquement pour
|
||||
extraire la liste de l'API (--dump-extension-api, reserve aux builds editeur) dans
|
||||
build/godot/extension_api.json, que godot-cpp utilise a la place de la liste officielle.
|
||||
A relancer a chaque modification du fork qui touche l'API.
|
||||
|
||||
.PARAMETER Target
|
||||
template_debug (defaut) ou template_release.
|
||||
template_debug (defaut), template_release, ou editor (extraction de l'API).
|
||||
|
||||
.PARAMETER Jobs
|
||||
Nombre de compilations en parallele. Defaut : nombre de processeurs logiques.
|
||||
@@ -34,7 +39,7 @@
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet("template_debug", "template_release")]
|
||||
[ValidateSet("template_debug", "template_release", "editor")]
|
||||
[string]$Target = "template_debug",
|
||||
[int]$Jobs = [Environment]::ProcessorCount,
|
||||
[string]$Log,
|
||||
@@ -74,11 +79,12 @@ if ($LASTEXITCODE -ne 0) {
|
||||
$sconsArgs = @(
|
||||
"-m", "SCons", "-C", $godot, "-j", $Jobs,
|
||||
"platform=windows", "arch=x86_64", "target=$Target",
|
||||
"library_type=shared_library",
|
||||
"d3d12=no", "accesskit=no", "angle=no",
|
||||
# L'hote indique le projet a charger (--path), interdit par defaut dans les modeles 4.7.
|
||||
"disable_path_overrides=no"
|
||||
"d3d12=no", "accesskit=no", "angle=no"
|
||||
)
|
||||
if ($Target -ne "editor") {
|
||||
# L'hote indique le projet a charger (--path), interdit par defaut dans les modeles 4.7.
|
||||
$sconsArgs += @("library_type=shared_library", "disable_path_overrides=no")
|
||||
}
|
||||
|
||||
Write-Host "==> scons $($sconsArgs[4..($sconsArgs.Length - 1)] -join ' ')" -ForegroundColor Cyan
|
||||
$start = Get-Date
|
||||
@@ -95,3 +101,22 @@ if ($code -ne 0) { throw "Echec : scons (code $code) apres $([int]$elapsed.Total
|
||||
|
||||
Write-Host ("==> termine en {0:N1} min" -f $elapsed.TotalMinutes) -ForegroundColor Green
|
||||
Get-ChildItem (Join-Path $godot "bin") -Filter "godot.windows.$Target.x86_64*" | Select-Object Name, Length
|
||||
|
||||
if ($Target -eq "editor") {
|
||||
$apiDir = Join-Path $root "build\godot"
|
||||
New-Item -ItemType Directory -Force $apiDir | Out-Null
|
||||
$editor = Join-Path $godot "bin\godot.windows.editor.x86_64.console.exe"
|
||||
Write-Host "==> --dump-extension-api -> $apiDir\extension_api.json" -ForegroundColor Cyan
|
||||
Push-Location $apiDir
|
||||
try {
|
||||
& $editor --headless --dump-extension-api
|
||||
$code = $LASTEXITCODE
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
if ($code -ne 0 -or -not (Test-Path (Join-Path $apiDir "extension_api.json"))) {
|
||||
throw "Echec : extraction de l'API (code $code)"
|
||||
}
|
||||
Write-Host "==> API extraite : reconfigurer CMake pour regenerer godot-cpp" -ForegroundColor Green
|
||||
}
|
||||
Reference in new issue
Block a user