39 lines
1.3 KiB
PowerShell
39 lines
1.3 KiB
PowerShell
# Setup clangd for this UE project (Windows PowerShell)
|
|
# Usage: .\setup_clangd.ps1 <path_to_ue_engine>
|
|
# Example: .\setup_clangd.ps1 "C:\Program Files\Epic Games\UE_5.7"
|
|
|
|
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$UEPath
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$ProjectFile = Join-Path $ScriptDir "ggj26_heron.uproject"
|
|
$BuildScript = Join-Path $UEPath "Engine\Build\BatchFiles\Build.bat"
|
|
|
|
if (-not (Test-Path $BuildScript)) {
|
|
Write-Error "Error: Build script not found at $BuildScript`nPlease check your UE engine path"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Generating compile_commands.json for Win64..."
|
|
& $BuildScript -mode=GenerateClangDatabase -project="$ProjectFile" ggj26_heronEditor Win64 Development
|
|
|
|
$CompileDB = Join-Path $UEPath "compile_commands.json"
|
|
$TargetLink = Join-Path $ScriptDir "compile_commands.json"
|
|
|
|
if (Test-Path $CompileDB) {
|
|
# Remove existing file/link
|
|
if (Test-Path $TargetLink) {
|
|
Remove-Item $TargetLink -Force
|
|
}
|
|
# Create symlink (requires admin or developer mode)
|
|
New-Item -ItemType SymbolicLink -Path $TargetLink -Target $CompileDB
|
|
Write-Host "Done! compile_commands.json linked to project root."
|
|
} else {
|
|
Write-Error "Error: compile_commands.json was not generated"
|
|
exit 1
|
|
}
|