windows/llvm: add build script (build_nyash_llvm.ps1); fix nyash.toml LLVM task paths; add screenshots dir placeholder; add which dep
This commit is contained in:
@ -124,6 +124,7 @@ log = "0.4"
|
||||
env_logger = "0.11"
|
||||
libloading = { version = "0.8", optional = true }
|
||||
toml = "0.8"
|
||||
which = "6"
|
||||
|
||||
# 日時処理
|
||||
chrono = "0.4"
|
||||
|
||||
1
docs/assets/screenshots/windows/.gitkeep
Normal file
1
docs/assets/screenshots/windows/.gitkeep
Normal file
@ -0,0 +1 @@
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
Phase 15 — Self-Hosting (Cranelift AOT) 準備メモ
|
||||
|
||||
注意: Phase 15 の正本ドキュメントは `docs/development/roadmap/phases/phase-15/` 配下です。全体の入口は `INDEX.md` を参照してください。
|
||||
→ docs/development/roadmap/phases/phase-15/INDEX.md
|
||||
|
||||
目的
|
||||
- Nyash → MIR → Cranelift AOT(C ABI)→ オブジェクト → リンク → EXE の最小パイプライン確立。
|
||||
- 本ブランチでは「影響小・再現性高い」準備(設計/仕様/スモーク雛形)に限定し、実装は別ブランチで行う。
|
||||
|
||||
現状ステータス(このブランチ)
|
||||
- 設計ノート: docs/backend-cranelift-aot-design.md
|
||||
- インタフェース草案: docs/interfaces/cranelift-aot-box.md
|
||||
- LinkerBox 仕様: docs/interfaces/linker-box.md
|
||||
- AOTスモーク仕様(擬似出力): docs/tests/aot_smoke_cranelift.md
|
||||
- スモーク雛形(DRYRUN 既定):
|
||||
- tools/aot_smoke_cranelift.sh(Unix/WSL)
|
||||
- tools/aot_smoke_cranelift.ps1(Windows)
|
||||
|
||||
ハンドオフ
|
||||
- 引き継ぎの全体像と運用メモは docs/handoff/phase-15-handoff.md を参照。
|
||||
|
||||
次ブランチで実装する項目(phase-15/self-host-aot-cranelift)
|
||||
- CraneliftAotBox: `compile_stub_ny_main_i64` → `.o/.obj` を出力。
|
||||
- LinkerBox: `.o/.obj` + NyRT(libnyrt)で EXE にリンク(Windows優先)。
|
||||
- CLI統合: `--backend cranelift-aot` と PoC フラグ(`--poc-const`)。
|
||||
- スモーク実行: apps/ny-hello → EXE 生成・起動確認。
|
||||
|
||||
合否基準(P0)
|
||||
- `ny_main` を定義するオブジェクトを生成できる。
|
||||
- NyRT とリンクして EXE を生成できる。
|
||||
- 実行し、既知の値(例: `Result: 42`)を出力。
|
||||
|
||||
補足
|
||||
- Windowsを先行サポートし、Linux/macOS は後続対応。
|
||||
- 実出力やビルドログは `tools/codex-async-notify.sh` のログ参照運用を継続。
|
||||
@ -414,13 +414,13 @@ ny_plugins = [
|
||||
build_llvm = "LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) cargo build --release --features llvm"
|
||||
|
||||
# ny-llvm-smoke を .o に出力(NYASH_LLVM_OBJ_OUTを使う)
|
||||
smoke_obj_array = "NYASH_LLVM_OBJ_OUT={root}/nyash_llvm_temp.o ./target/release/nyash --backend llvm apps/ny-llvm-smoke/main.nyash && ls -l {root}/nyash_llvm_temp.o"
|
||||
smoke_obj_array = "NYASH_LLVM_OBJ_OUT={root}/nyash_llvm_temp.o ./target/release/nyash --backend llvm apps/tests/ny-llvm-smoke/main.nyash && ls -l {root}/nyash_llvm_temp.o"
|
||||
|
||||
# ny-echo-lite を .o に出力(標準入力1行→そのまま出力)
|
||||
smoke_obj_echo = "NYASH_LLVM_OBJ_OUT={root}/nyash_llvm_temp.o ./target/release/nyash --backend llvm apps/ny-echo-lite/main.nyash"
|
||||
smoke_obj_echo = "NYASH_LLVM_OBJ_OUT={root}/nyash_llvm_temp.o ./target/release/nyash --backend llvm apps/tests/ny-echo-lite/main.nyash"
|
||||
|
||||
# ny-llvm-smoke をEXEまで(NyRTリンク)
|
||||
build_exe_array = "tools/build_llvm.sh apps/ny-llvm-smoke/main.nyash -o app_llvm"
|
||||
build_exe_array = "tools/build_llvm.sh apps/tests/ny-llvm-smoke/main.nyash -o app_llvm"
|
||||
|
||||
# EXE実行
|
||||
run_exe_array = "./app_llvm"
|
||||
|
||||
44
tools/windows/build_nyash_llvm.ps1
Normal file
44
tools/windows/build_nyash_llvm.ps1
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env pwsh
|
||||
param(
|
||||
[Parameter(Mandatory=$false)][switch]$EnsureLLVM,
|
||||
[Parameter(Mandatory=$false)][switch]$SetPermanentEnv,
|
||||
[Parameter(Mandatory=$false)][string]$Profile = "release",
|
||||
[Parameter(Mandatory=$false)][string]$Target,
|
||||
[Parameter(Mandatory=$false)][string]$App,
|
||||
[Parameter(Mandatory=$false)][string]$Out = "app.exe"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
function Info($m){ Write-Host "[build-nyash-llvm] $m" -ForegroundColor Cyan }
|
||||
function Warn($m){ Write-Host "[build-nyash-llvm] WARN: $m" -ForegroundColor Yellow }
|
||||
function Err($m){ Write-Host "[build-nyash-llvm] ERROR: $m" -ForegroundColor Red; exit 1 }
|
||||
|
||||
# Move to repo root for stable paths
|
||||
Set-Location (Split-Path -Parent $PSCommandPath) | Out-Null
|
||||
Set-Location (Resolve-Path ..\..) | Out-Null
|
||||
|
||||
if ($EnsureLLVM) {
|
||||
$args = @()
|
||||
if ($SetPermanentEnv) { $args += "-SetPermanent" }
|
||||
& tools\windows\ensure-llvm18.ps1 @args
|
||||
}
|
||||
|
||||
Info "Building nyash (features=llvm, profile=$Profile)"
|
||||
$cargoArgs = @('build')
|
||||
if ($Profile -eq 'release') { $cargoArgs += '--release' }
|
||||
elseif ($Profile -ne 'debug') { Warn "Unknown profile '$Profile', using release"; $cargoArgs += '--release' }
|
||||
$cargoArgs += @('--features','llvm')
|
||||
if ($Target) { $cargoArgs += @('--target', $Target) }
|
||||
& cargo @cargoArgs
|
||||
if ($LASTEXITCODE -ne 0) { Err "cargo build failed (llvm). Ensure LLVM_SYS_180/181_PREFIX are set and LLVM 18 is installed." }
|
||||
|
||||
if ($App) {
|
||||
if (-not (Test-Path $App)) { Err "App file not found: $App" }
|
||||
Info "Linking EXE via LLVM AOT: $App → $Out"
|
||||
& tools\build_llvm.ps1 $App -Out $Out
|
||||
if ($LASTEXITCODE -ne 0) { Err "link failed: $Out not produced" }
|
||||
Info "OK: built $Out"
|
||||
}
|
||||
|
||||
Info "Done"
|
||||
|
||||
Reference in New Issue
Block a user