From 01cd6981aca22b9a4a27fc864663342f642ef9e3 Mon Sep 17 00:00:00 2001 From: Rapturate Date: Mon, 19 Oct 2026 19:26:47 -0400 Subject: [PATCH] more minor changes to fix compilation issues --- README.md | 4 ++-- main.cpp | 8 ++++---- scripts/build.ps1 | 10 +++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 667b0ea..ecaf4f2 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ From the repository root, run: .\scripts\build.ps1 ``` -This builds the Release executable. To build Debug or choose a different build directory, use: +This builds the Release executable and refreshes the root `compile_commands.json` for clangd. To build Debug or choose a different build directory, use: ```powershell .\scripts\build.ps1 -Configuration Debug .\scripts\build.ps1 -BuildDirectory build-custom ``` -By default, the executable is written to `build\bin\release\LumberJack.exe`. +By default, the executable is written to `build-ninja\bin\release\LumberJack.exe`. ## Other platforms diff --git a/main.cpp b/main.cpp index 01eeddf..679c42c 100644 --- a/main.cpp +++ b/main.cpp @@ -209,14 +209,14 @@ int main() { // ── 4. Setup-screen components ──────────────────────────────────────────── - Component input_log = Input(&log_file_path, "Enter path to log file..."); - Component input_mmdb = Input(&mmdb_path, "Enter path to MaxMind MMDB..."); - Component submit_button = Button(" Start Log Monitor ", run_log_parsing, ButtonOption::Animated()); + auto input_log = Input(&log_file_path, "Enter path to log file..."); + auto input_mmdb = Input(&mmdb_path, "Enter path to MaxMind MMDB..."); + auto submit_button = Button(" Start Log Monitor ", run_log_parsing, ButtonOption::Animated()); auto setup_container = Container::Vertical({input_log, input_mmdb, submit_button}); // ── 5. Search input (dashboard) ─────────────────────────────────────────── - Component search_input = Input(&search_query, "Type to filter records (IP, request, status, etc.)..."); + auto search_input = Input(&search_query, "Type to filter records (IP, request, status, etc.)..."); // ── 6. Main renderer ────────────────────────────────────────────────────── auto main_components = Container::Vertical({ diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 7f4fc77..9974554 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -1,7 +1,7 @@ param( [ValidateSet("Debug", "Release")] [string]$Configuration = "Release", - [string]$BuildDirectory = "build" + [string]$BuildDirectory = "build-ninja" ) $ErrorActionPreference = "Stop" @@ -31,6 +31,13 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } +$compilationDatabase = Join-Path $buildPath "compile_commands.json" +if (-not (Test-Path $compilationDatabase)) { + Write-Error "CMake did not generate compile_commands.json at '$compilationDatabase'." + exit 1 +} +Copy-Item -LiteralPath $compilationDatabase -Destination (Join-Path $sourceDirectory "compile_commands.json") -Force + & cmake --build $buildPath --config $Configuration if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE @@ -38,3 +45,4 @@ if ($LASTEXITCODE -ne 0) { $outputPath = Join-Path $buildPath "bin\$($Configuration.ToLowerInvariant())\LumberJack.exe" Write-Host "Build complete: $outputPath" +Write-Host "Updated compile_commands.json for clangd."