axmol/tools/ci/genbindings.ps1

48 lines
1.4 KiB
PowerShell
Raw Normal View History

2023-09-26 10:32:53 +08:00
$myRoot = $PSScriptRoot
2023-09-26 09:50:25 +08:00
$llvm_ver = '15.0.7'
2023-09-26 10:32:53 +08:00
$AX_ROOT = (Resolve-Path $myRoot/../..).Path
# ensure prebuilt lib downloaded
Push-Location $AX_ROOT
$build_script = Join-Path $AX_ROOT 'build.ps1'
2024-01-08 22:55:15 +08:00
&$build_script -c
Pop-Location
(Get-Command python.exe).Path
2023-02-14 23:30:44 +08:00
pip install PyYAML Cheetah3
2023-09-26 10:32:53 +08:00
## setup ndk
$setup_script = (Resolve-Path $AX_ROOT/setup.ps1).Path
2023-09-26 12:47:28 +08:00
echo "before setup py_ver: $(python -V), PATH=$env:PATH"
2023-09-26 12:52:00 +08:00
. $setup_script -p android
2023-09-26 12:47:28 +08:00
echo "after setup py_ver: $(python -V), PATH=$env:PATH"
2023-09-26 10:46:22 +08:00
2023-09-26 10:32:53 +08:00
echo "$ndk_root=$ndk_root"
$prefix = Join-Path $AX_ROOT 'tmp'
$llvm_out = Join-Path $prefix "llvmorg-$llvm_ver.zip"
2023-02-14 23:30:44 +08:00
## download win64 libclang.dll
2023-09-26 11:09:50 +08:00
$b1k.mkdirs($prefix)
2023-09-26 10:46:22 +08:00
download_and_expand -url "https://github.com/axmolengine/buildware/releases/download/llvmorg-$llvm_ver/llvmorg-$llvm_ver.zip" -out "$llvm_out" -dest $prefix
2023-09-26 10:32:53 +08:00
Copy-Item "$prefix/llvmorg-$llvm_ver/llvm/prebuilt/windows/x64/libclang.dll" -Destination "$AX_ROOT/tools/bindings-generator/libclang"
2023-06-12 10:26:08 +08:00
## ensure $env:AX_ROOT/core/axmolver.h exists
2023-09-26 10:32:53 +08:00
echo "AX_ROOT=$AX_ROOT"
if (!(Test-Path "$AX_ROOT/core/axmolver.h" -PathType Leaf)) {
$content = [System.IO.File]::ReadAllText("$AX_ROOT/core/axmolver.h.in")
$content = $content.Replace('@AX_GIT_PRESENT@', '0')
[System.IO.File]::WriteAllText("$AX_ROOT/core/axmolver.h")
2023-06-12 10:26:08 +08:00
}
## run genbindings.py
2023-09-26 10:32:53 +08:00
Push-Location $AX_ROOT/tools/tolua
2023-02-14 23:30:44 +08:00
2022-08-09 09:48:03 +08:00
python genbindings.py --ndk_root "$ndk_root"
2022-01-01 21:56:55 +08:00
2023-09-26 10:32:53 +08:00
Pop-Location