Skip to content

Linux: add Linux support fixes#97

Open
0xKitKoi wants to merge 1 commit intoStudioCherno:masterfrom
0xKitKoi:linux-support
Open

Linux: add Linux support fixes#97
0xKitKoi wants to merge 1 commit intoStudioCherno:masterfrom
0xKitKoi:linux-support

Conversation

@0xKitKoi
Copy link

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

Walkthrough

This pull request adds Linux/Mac platform support to the Walnut framework while updating build configurations. Changes include implementing a Linux/Mac entry point in EntryPoint.h, adding platform-specific build filters for Windows and Linux, updating GLFW dependency paths across build files, and updating the GLFW submodule reference.

Changes

Cohort / File(s) Summary
Build Configuration Updates
Walnut/premake5.lua, WalnutExternal.lua, premake5.lua
Updated GLFW dependency paths from glfw to GLFW (case-sensitive) and added platform-specific Premake filters for Windows (systemversion, WL_PLATFORM_WINDOWS define, Vulkan linking) and Linux (Vulkan linking).
Platform Entry Point Implementation
Walnut/src/Walnut/EntryPoint.h
Added complete Linux/Mac entry point implementation including external CreateApplication declaration, global g_ApplicationRunning flag, Walnut::Main() function with application lifecycle loop, and platform main() entry function.
Vendor Dependency Update
vendor/GLFW
Updated GLFW submodule commit reference to a newer version.

Sequence Diagram

sequenceDiagram
    participant Platform as Platform (Linux/Mac)
    participant Main as Walnut::Main()
    participant Factory as CreateApplication()
    participant App as Application
    
    Platform->>Main: main(argc, argv)
    loop while g_ApplicationRunning
        Main->>Factory: CreateApplication(argc, argv)
        Factory-->>App: new Application()
        Main->>App: Run()
        App-->>Main: (completes)
        Main->>App: delete
    end
    Main-->>Platform: return status
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hop, hop, the framework grows,
Linux and Mac now in the flow!
Entry points dance, new platforms arise,
Build filters shimmer under open skies. 🌟
Walnut spreads wide, from Windows to free,
Cross-platform magic, happy as can be!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, making it impossible to evaluate whether the description relates to the changeset. Add a pull request description that explains the changes made, such as cross-platform entry point implementation and Linux/Windows build configuration updates.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Linux: add Linux support fixes' refers to the main objective of the PR to add Linux support, which aligns with the significant changes to EntryPoint.h and cross-platform build configuration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
Walnut/src/Walnut/EntryPoint.h (1)

43-53: Consider applying the namespace wrapper refactoring consistently across both platforms.

Both the Windows (line 5) and Linux/Mac (line 43) branches use identical qualified declarator syntax for CreateApplication. While this works in practice due to include ordering in consuming code (Walnut/Application.h included before EntryPoint.h), wrapping the declaration in namespace Walnut { ... } blocks—as suggested in the proposed diff—is cleaner and removes reliance on include order. Apply this refactoring to both branches for consistency, or keep both as-is if include order is already established as a requirement.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Walnut/src/Walnut/EntryPoint.h` around lines 43 - 53, The CreateApplication
declaration is currently written with a qualified declarator (extern
Walnut::Application* Walnut::CreateApplication(...)) which relies on include
ordering; update both platform branches to use a namespace wrapper for clarity
and consistency by moving the declaration inside a namespace Walnut { extern
Application* CreateApplication(int argc, char** argv); } and similarly ensure
the Main function and g_ApplicationRunning usage remain in the Walnut namespace
(e.g., int Main(int argc, char** argv) and bool g_ApplicationRunning) so both
Windows and Linux/Mac branches consistently declare CreateApplication inside
namespace Walnut rather than using the fully-qualified declarator.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@premake5.lua`:
- Around line 12-18: The global links entry in Walnut/premake5.lua is adding
%{Library.Vulkan} (a Windows-only vulkan-1.lib) unconditionally, breaking Linux
builds; move the Vulkan linking into the system filters instead: remove or stop
linking %{Library.Vulkan} from the global links block and add links {
"%{Library.Vulkan}" } inside the filter "system:windows", and ensure filter
"system:linux" uses links { "vulkan" } (update the existing filters
"system:windows" and "system:linux" in premake5.lua accordingly).

---

Nitpick comments:
In `@Walnut/src/Walnut/EntryPoint.h`:
- Around line 43-53: The CreateApplication declaration is currently written with
a qualified declarator (extern Walnut::Application*
Walnut::CreateApplication(...)) which relies on include ordering; update both
platform branches to use a namespace wrapper for clarity and consistency by
moving the declaration inside a namespace Walnut { extern Application*
CreateApplication(int argc, char** argv); } and similarly ensure the Main
function and g_ApplicationRunning usage remain in the Walnut namespace (e.g.,
int Main(int argc, char** argv) and bool g_ApplicationRunning) so both Windows
and Linux/Mac branches consistently declare CreateApplication inside namespace
Walnut rather than using the fully-qualified declarator.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3aab22c0-5d8f-4dae-8d3c-319b2511c0f5

📥 Commits

Reviewing files that changed from the base of the PR and between 3b8e414 and 405dece.

📒 Files selected for processing (5)
  • Walnut/premake5.lua
  • Walnut/src/Walnut/EntryPoint.h
  • WalnutExternal.lua
  • premake5.lua
  • vendor/GLFW

Comment on lines +12 to +18
filter "system:windows"
systemversion "latest"
defines { "WL_PLATFORM_WINDOWS" }
links { "%{Library.Vulkan}" }

filter "system:linux"
links { "vulkan" }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify Vulkan link token definition and usage across premake files.
# Expected: detect Windows-specific token definition and unconditional usage sites.

rg -n -C2 'Library\["Vulkan"\]|vulkan-1\.lib' --type lua
rg -n -C2 '%{Library\.Vulkan}' --type lua
rg -n -C2 'filter\s*"system:(windows|linux)"|links\s*\{[^}]*"vulkan"[^}]*\}' --type lua

Repository: StudioCherno/Walnut

Length of output: 1280


🏁 Script executed:

# Search for Vulkan-related content in Walnut/premake5.lua specifically
fd -n "premake5.lua" | while read f; do
  echo "=== File: $f ==="
  rg -n "Vulkan|vulkan|Library" "$f" -C1
done

Repository: StudioCherno/Walnut

Length of output: 293


🏁 Script executed:

# Read the full Walnut/premake5.lua to see the complete context
cat -n Walnut/premake5.lua

Repository: StudioCherno/Walnut

Length of output: 1434


Move Vulkan linking to system-specific filters in Walnut/premake5.lua.

Walnut/premake5.lua unconditionally links %{Library.Vulkan} (line 27), which resolves to vulkan-1.lib from WalnutExternal.lua—a Windows-only library. This breaks Linux builds even though the root premake5.lua correctly filters Vulkan by system. Move the Vulkan link from the global links block to per-system filters:

Proposed fix
--- a/Walnut/premake5.lua
+++ b/Walnut/premake5.lua
@@ -24,8 +24,6 @@
    {
        "ImGui",
        "GLFW",
-
-       "%{Library.Vulkan}",
    }
 
    targetdir ("bin/" .. outputdir .. "/%{prj.name}")
@@ -33,6 +31,7 @@
    filter "system:windows"
       systemversion "latest"
       defines { "WL_PLATFORM_WINDOWS" }
+      links { "%{Library.Vulkan}" }
+
+   filter "system:linux"
+      links { "vulkan" }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@premake5.lua` around lines 12 - 18, The global links entry in
Walnut/premake5.lua is adding %{Library.Vulkan} (a Windows-only vulkan-1.lib)
unconditionally, breaking Linux builds; move the Vulkan linking into the system
filters instead: remove or stop linking %{Library.Vulkan} from the global links
block and add links { "%{Library.Vulkan}" } inside the filter "system:windows",
and ensure filter "system:linux" uses links { "vulkan" } (update the existing
filters "system:windows" and "system:linux" in premake5.lua accordingly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant