1. 一键安装包 (build-release.ps1) - 打包 pcc.exe + 标准头文件 + Windows 头文件 + 运行时库 - 生成 pcc.bat 启动器,自动设置 include/lib 路径 - 输出: release/pcc-0.9.28-win32.zip (594 KB) 2. GUI 程序支持验证 - -Wl,-subsystem=windows 正确生成 GUI 程序 (PE Subsystem=2) - MessageBox 弹窗测试通过 3. VS Code 插件 (vscode-extension/) - C 语法高亮 (TextMate grammar) - PCC: Build (Ctrl+Shift+B) / PCC: Build & Run (Ctrl+F5) - 可配置 include/lib 路径和 pcc 可执行文件位置 4. Windows API 头文件验证 - 系统信息/时间/注册表/控制台/文件 API 编译运行正常 - PE 导入表格式正确 (kernel32.dll, msvcrt.dll) 5. 测试套件验证 - tests2 基础测试 48/53 通过 - 其余为测试框架差异 (stderr 合并/参数传递),非编译器 bug
99 行
3.8 KiB
PowerShell
99 行
3.8 KiB
PowerShell
# build-release.ps1 - one-click packaging of PCC Windows toolchain
|
|
$ErrorActionPreference = "Stop"
|
|
$root = "F:\Paze C Compiler"
|
|
$win32 = Join-Path $root "win32"
|
|
$version = "0.9.28"
|
|
$outDir = Join-Path $root "release"
|
|
$pkgName = "pcc-$version-win32"
|
|
$pkgDir = Join-Path $outDir $pkgName
|
|
|
|
Write-Host "=== PCC Windows toolchain packaging ==="
|
|
Write-Host "Version: $version"
|
|
Write-Host ""
|
|
|
|
if (Test-Path $pkgDir) { Remove-Item $pkgDir -Recurse -Force }
|
|
New-Item -ItemType Directory -Path $pkgDir -Force | Out-Null
|
|
|
|
Write-Host "[1/6] Copy core programs..."
|
|
Copy-Item (Join-Path $win32 "pcc.exe") $pkgDir
|
|
if (Test-Path (Join-Path $win32 "libpcc.dll")) {
|
|
Copy-Item (Join-Path $win32 "libpcc.dll") $pkgDir
|
|
}
|
|
|
|
Write-Host "[2/6] Copy standard headers..."
|
|
$destInc = Join-Path $pkgDir "include"
|
|
New-Item -ItemType Directory -Path $destInc -Force | Out-Null
|
|
Get-ChildItem (Join-Path $root "include") -File | Copy-Item -Destination $destInc
|
|
|
|
Write-Host "[3/6] Copy Windows headers..."
|
|
$destWinInc = Join-Path $pkgDir "win32\include"
|
|
New-Item -ItemType Directory -Path $destWinInc -Force | Out-Null
|
|
Get-ChildItem (Join-Path $win32 "include") -Recurse -File | ForEach-Object {
|
|
$rel = $_.FullName.Substring((Join-Path $win32 "include").Length + 1)
|
|
$target = Join-Path $destWinInc $rel
|
|
New-Item -ItemType Directory -Path (Split-Path $target) -Force | Out-Null
|
|
Copy-Item $_.FullName $target
|
|
}
|
|
|
|
Write-Host "[4/6] Copy runtime libs..."
|
|
$destLib = Join-Path $pkgDir "lib"
|
|
New-Item -ItemType Directory -Path $destLib -Force | Out-Null
|
|
Get-ChildItem (Join-Path $win32 "lib") -File | Where-Object { $_.Extension -in ".a",".def" } | Copy-Item -Destination $destLib -ErrorAction SilentlyContinue
|
|
# also place libs where -B can find them (tcc layout: <bindir>/lib/)
|
|
$winDestLib = Join-Path $pkgDir "win32\lib"
|
|
New-Item -ItemType Directory -Path $winDestLib -Force | Out-Null
|
|
Get-ChildItem (Join-Path $win32 "lib") -File | Where-Object { $_.Extension -in ".a",".def" } | Copy-Item -Destination $winDestLib -ErrorAction SilentlyContinue
|
|
|
|
Write-Host "[5/6] Copy examples and docs..."
|
|
$destEx = Join-Path $pkgDir "examples"
|
|
New-Item -ItemType Directory -Path $destEx -Force | Out-Null
|
|
Get-ChildItem (Join-Path $win32 "examples") -File | Copy-Item -Destination $destEx -ErrorAction SilentlyContinue
|
|
Copy-Item (Join-Path $win32 "pcc-win32.txt") $pkgDir -ErrorAction SilentlyContinue
|
|
|
|
Write-Host "[6/6] Create README and wrapper..."
|
|
$readme = @"
|
|
PCC - Paze C Compiler $version (Windows)
|
|
========================================
|
|
|
|
Usage:
|
|
pcc.bat hello.c -o hello.exe compile C program (auto paths)
|
|
pcc.bat -run hello.c compile and run directly
|
|
pcc.exe --version show version
|
|
|
|
Structure:
|
|
pcc.exe compiler main program
|
|
pcc.bat launcher with auto include/lib paths
|
|
libpcc.dll embeddable compiler library (optional)
|
|
include\ standard C headers
|
|
win32\include\ Windows API headers
|
|
lib\ runtime and import libs
|
|
examples\ example programs
|
|
|
|
Notes:
|
|
- Add this directory to PATH to use pcc globally
|
|
- pcc is fully self-contained, no GCC/MinGW needed
|
|
|
|
License: MIT
|
|
"@
|
|
$readme | Out-File (Join-Path $pkgDir "README.txt") -Encoding ascii
|
|
|
|
# pcc.bat launcher: automatically sets -B, -I and -L relative to itself
|
|
$bat = @"
|
|
@echo off
|
|
setlocal
|
|
set "PCCDIR=%~dp0"
|
|
"%PCCDIR%pcc.exe" -B "%PCCDIR%win32" -I "%PCCDIR%include" -L "%PCCDIR%lib" %*
|
|
exit /b %errorlevel%
|
|
"@
|
|
$bat | Out-File (Join-Path $pkgDir "pcc.bat") -Encoding ascii
|
|
|
|
Write-Host ""
|
|
Write-Host "Zipping..."
|
|
$zipFile = Join-Path $outDir "$pkgName.zip"
|
|
if (Test-Path $zipFile) { Remove-Item $zipFile -Force }
|
|
Compress-Archive -Path $pkgDir -DestinationPath $zipFile -CompressionLevel Optimal
|
|
|
|
$size = [math]::Round((Get-Item $zipFile).Length / 1KB, 1)
|
|
Write-Host ""
|
|
Write-Host "OK: $zipFile ($size KB)"
|
|
Write-Host "Extract and use directly, no install needed." |