Skip to content

Conversation

@WSQS
Copy link
Owner

@WSQS WSQS commented Nov 9, 2025

Enable Cpp20Module

Summary by CodeRabbit

  • Infrastructure

    • Introduced CI/CD workflows for Linux and Windows builds with multi-compiler matrix testing.
    • Windows-specific CI workflow refined for targeted testing.
  • Build Updates

    • Updated CMake minimum version requirement to 3.30.
    • Enforced C++ standard compliance in build configuration.
    • Added graphics wrapper library dependency to build system.

@coderabbitai
Copy link

coderabbitai bot commented Nov 9, 2025

Walkthrough

This PR introduces a new C++ module library (sdl_wrapper) that wraps SDL GPU functionality, updates CMake to enforce C++23 and link the new module, creates a dedicated Linux CI workflow, refactors Windows CI to target Windows-only builds, and integrates the wrapper into the main application.

Changes

Cohort / File(s) Summary
CI Workflows
.github/workflows/cmake-linux.yml
New GitHub Actions workflow for Linux CI using Arch Linux container, building across Debug/Release and gcc/clang compilers, with Ninja Multi-Config and artifact upload.
CI Workflows
.github/workflows/cmake-windows.yml
Renamed workflow from "CMake on multiple platforms" to "CMake on Windows"; narrowed CI matrix to Windows-only, removed Ubuntu entries, eliminated cross-OS exclusion rules.
Build Configuration
CMakeLists.txt
Bumped CMake minimum from 3.20 to 3.30, enabled CMAKE_CXX_STANDARD_REQUIRED, added sdl_wrapper subdirectory, and linked it to SDL_TEST target.
SDL Wrapper Module
sdl_wrapper/CMakeLists.txt
New CMake module target (STATIC, C++23) with FILE_SET cxx_modules exposing two interface files and SDL3::SDL3 public linkage.
SDL Wrapper Module
sdl_wrapper/sdl_wrapper.ixx, sdl_wrapper/sdl_wrapper.buffer.ixx
New C++ module interface units: main module re-exports buffer submodule; buffer module defines sopho::BufferWrapper class with SDL_GPUBuffer* private field.
Application
main.cpp
Added module import statement and instantiated global sopho::BufferWrapper object.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

  • C++ module syntax and structure correctness (.ixx files follow standard patterns)
  • Verification that module export/re-export declarations are properly formed
  • CMake target configuration aligns with C++23 module file set expectations
  • CI workflow logic for matrix builds and artifact handling

Poem

🐰 Hop through modules, files aligned,
SDL wrapped in C++ design,
Linux builds dance, Windows stands tall,
A buffer born, we've wrapped it all!

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Cpp20module' is vague and lacks meaningful context about the actual changes implemented in the pull request. Consider a more descriptive title such as 'Add C++20 module support with SDL wrapper' or 'Implement C++20 modules for buffer management' to clearly convey the primary change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Docstrings were successfully generated.
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cpp20module

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.

@WSQS
Copy link
Owner Author

WSQS commented Nov 9, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Nov 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/cmake-windows.yml (1)

52-63: Remove dead code: Linux dependency installation.

This step installs Linux dependencies but will never execute because the workflow now only runs on windows-latest (line 26). The condition if: runner.os == 'Linux' (line 53) will never be true.

Apply this diff to remove the dead code:

-        
-    - name: Install SDL windowing deps (Linux)
-      if: runner.os == 'Linux'
-      run: |
-        sudo apt-get update
-        sudo apt-get install -y --no-install-recommends \
-          build-essential pkg-config cmake ninja-build \
-          libasound2-dev libpulse-dev libaudio-dev libjack-dev \
-          libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
-          libxkbcommon-dev libwayland-dev wayland-protocols \
-          libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev \
-          libdbus-1-dev libudev-dev
-        
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67da4af and ae4430d.

📒 Files selected for processing (7)
  • .github/workflows/cmake-linux.yml (1 hunks)
  • .github/workflows/cmake-windows.yml (3 hunks)
  • CMakeLists.txt (2 hunks)
  • main.cpp (2 hunks)
  • sdl_wrapper/CMakeLists.txt (1 hunks)
  • sdl_wrapper/sdl_wrapper.buffer.ixx (1 hunks)
  • sdl_wrapper/sdl_wrapper.ixx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build (windows-latest, Release, clang)
  • GitHub Check: build (windows-latest, Release, cl)
  • GitHub Check: build (Debug, gcc)
  • GitHub Check: build (Release, clang)
  • GitHub Check: build (windows-latest, Debug, clang)
  • GitHub Check: build (windows-latest, Release, gcc)
  • GitHub Check: build (Release, gcc)
  • GitHub Check: build (Debug, clang)
🔇 Additional comments (12)
.github/workflows/cmake-linux.yml (3)

5-16: LGTM!

The workflow trigger configuration and container setup are appropriate. Using Arch Linux provides access to the latest compiler toolchains, and running as root is necessary for package installation.


49-57: LGTM!

The dependency installation is comprehensive and includes all necessary packages for building SDL3 applications on Linux with both audio backends (ALSA, Jack, PulseAudio) and windowing systems (X11, Wayland).


59-68: No issue with CMake version.

CMake 4.1.2-1 is available in Arch Linux and exceeds the required CMake 3.30 minimum. Since CMake maintains backward compatibility across major versions, the workflow will function correctly.

sdl_wrapper/CMakeLists.txt (2)

1-5: LGTM!

The project configuration correctly requires CMake 3.30 (necessary for C++20 modules) and sets C++23 as the standard. The parent CMakeLists.txt sets CMAKE_CXX_STANDARD_REQUIRED ON, which propagates here.


7-14: LGTM!

The module file set configuration correctly uses FILE_SET cxx_modules TYPE CXX_MODULES to expose the module interface files. Public linkage to SDL3 is appropriate since the module exports types that depend on SDL headers.

CMakeLists.txt (3)

1-1: CMake 3.30 requirement is appropriate for C++20 modules.

The version bump from 3.20 to 3.30 is necessary to support C++20 modules reliably. CMake 3.28+ provides the required FILE_SET CXX_MODULES functionality used in the sdl_wrapper library.

Note: This is a significant version requirement that may not be available in all environments. The Linux CI workflow should verify this version is available (see comment on cmake-linux.yml).


4-4: Essential addition for enforcing C++23.

Setting CMAKE_CXX_STANDARD_REQUIRED ON ensures that the build fails if the compiler doesn't support C++23, rather than silently falling back to an older standard. This is critical for C++20 module support.


95-98: LGTM!

The integration of the sdl_wrapper library is correct: the subdirectory is added before the executable target, and the library is properly linked with PRIVATE visibility, which is appropriate for an executable target.

.github/workflows/cmake-windows.yml (2)

3-3: LGTM!

The workflow name and matrix have been correctly updated to reflect Windows-only builds. This separation from Linux builds (now in cmake-linux.yml) improves clarity and maintainability.

Also applies to: 26-26


29-38: LGTM!

The matrix include section has been correctly updated to only include Windows compiler configurations, consistent with the os matrix change.

sdl_wrapper/sdl_wrapper.ixx (1)

5-6: LGTM!

The module interface correctly declares the primary module and re-exports the buffer partition, making sopho::BufferWrapper available through import sdl_wrapper;. The implementation follows C++20 module best practices.

main.cpp (1)

12-12: Module import syntax is correct.

The import sdl_wrapper; statement is correctly placed after traditional #include directives and follows C++20 module syntax.

However, note that the imported module is currently unused (see comment on line 53).

Comment on lines +22 to +25
# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update outdated matrix comments.

The comments describe a Windows/Linux multi-platform matrix, but this workflow only builds on Linux (Arch Linux container) with gcc and clang.

Apply this diff to fix the comments:

-      # Set up a matrix to run the following 3 configurations:
-      # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
-      # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
-      # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
+      # Set up a matrix to run the following configurations on Arch Linux:
+      # 1. <Linux, Debug/Release, latest GCC compiler toolchain>
+      # 2. <Linux, Debug/Release, latest Clang compiler toolchain>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
# Set up a matrix to run the following configurations on Arch Linux:
# 1. <Linux, Debug/Release, latest GCC compiler toolchain>
# 2. <Linux, Debug/Release, latest Clang compiler toolchain>
🤖 Prompt for AI Agents
In .github/workflows/cmake-linux.yml around lines 22 to 25, the matrix comments
are outdated (they reference Windows and a multi-platform matrix) but the
workflow only runs on Linux with GCC and Clang; update the comment text to
accurately describe the current matrix: state that the job runs on an Arch Linux
container and lists two Linux configurations using GCC and Clang in Release
mode, and remove any references to Windows, MSVC, or default generator.

FragColor = v_color;
})WSQ";

sopho::BufferWrapper BufferWrapper{};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused BufferWrapper instance.

The global BufferWrapper instance is declared but never used. The existing code continues to use the separate SDL_GPUBuffer *vertexBuffer (line 57) directly throughout the application.

Additionally, the variable name BufferWrapper shadows the class name sopho::BufferWrapper, which can cause confusion.

Consider one of the following:

  • If this is a skeleton for future refactoring, add a TODO comment explaining the migration plan.
  • If you'd like to properly integrate the wrapper, I can help refactor the code to use the BufferWrapper class instead of the raw pointer.
  • Otherwise, remove both the import (line 12) and this declaration to keep the code clean.
🤖 Prompt for AI Agents
In main.cpp around line 53, the global sopho::BufferWrapper instance named
BufferWrapper is unused and shadows the type name; remove this declaration and
any corresponding unused include at line 12, or if you intend to migrate to the
wrapper add a one-line TODO above the declaration describing the refactor plan
and rename the variable to avoid shadowing (e.g., bufferWrapperInstance) and
replace uses of SDL_GPUBuffer* with sopho::BufferWrapper methods; if you choose
removal, also delete the unused include to keep the file clean.

Comment on lines +8 to +13
namespace sopho {
export class BufferWrapper {
SDL_GPUBuffer *vertexBuffer{};

};
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

BufferWrapper is unused and provides no functionality.

The BufferWrapper class is declared with a private vertexBuffer member but has no public interface, constructor, or destructor. The global instance declared in main.cpp (line 53) is never used, and the existing code continues to use the separate global SDL_GPUBuffer *vertexBuffer (main.cpp line 57) directly.

Consider one of the following:

  • If this is a skeleton for future work, add a TODO comment explaining the intended functionality.
  • If you want to proceed with the wrapper pattern, would you like me to help design a proper RAII wrapper that manages the buffer lifecycle?
  • If this code serves no purpose yet, consider removing it to keep the codebase clean.
🤖 Prompt for AI Agents
In sdl_wrapper/sdl_wrapper.buffer.ixx around lines 8 to 13, the BufferWrapper
class declares a private SDL_GPUBuffer* vertexBuffer but has no public API or
lifecycle management and the global instance is unused; either remove the class
to clean up dead code, or implement it as a proper RAII wrapper: add
constructor(s) that create/accept a buffer, a destructor that frees/releases the
SDL_GPUBuffer, and public accessors/mutators (or move/copy semantics) so
existing code can use the wrapper instead of the raw global pointer; if you
intend to leave it as a placeholder, add a clear TODO comment explaining
intended functionality and link to a follow-up task.

@WSQS WSQS merged commit bd019a2 into dynamic_vertice Nov 9, 2025
21 checks passed
@WSQS WSQS deleted the cpp20module branch November 9, 2025 04:39
@coderabbitai
Copy link

coderabbitai bot commented Nov 9, 2025

Caution

Docstrings generation - FAILED

No docstrings were generated.

@coderabbitai coderabbitai bot mentioned this pull request Nov 9, 2025
@WSQS
Copy link
Owner Author

WSQS commented Nov 9, 2025

@coderabbitai configuration

@coderabbitai
Copy link

coderabbitai bot commented Nov 9, 2025

CodeRabbit configuration
language: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
  profile: chill
  request_changes_workflow: false
  high_level_summary: true
  high_level_summary_placeholder: '@coderabbitai summary'
  high_level_summary_in_walkthrough: false
  auto_title_placeholder: '@coderabbitai'
  auto_title_instructions: ''
  review_status: true
  commit_status: true
  fail_commit_status: false
  collapse_walkthrough: false
  changed_files_summary: true
  sequence_diagrams: true
  estimate_code_review_effort: true
  assess_linked_issues: true
  related_issues: true
  related_prs: true
  suggested_labels: true
  labeling_instructions: []
  auto_apply_labels: false
  suggested_reviewers: true
  auto_assign_reviewers: false
  in_progress_fortune: true
  poem: true
  path_filters: []
  path_instructions: []
  abort_on_close: true
  disable_cache: false
  auto_review:
    enabled: true
    auto_incremental_review: true
    ignore_title_keywords: []
    labels: []
    drafts: false
    base_branches: []
    ignore_usernames: []
  finishing_touches:
    docstrings:
      enabled: true
    unit_tests:
      enabled: true
  pre_merge_checks:
    docstrings:
      mode: warning
      threshold: 80
    title:
      mode: warning
      requirements: ''
    description:
      mode: warning
    issue_assessment:
      mode: warning
    custom_checks: []
  tools:
    ast-grep:
      rule_dirs: []
      util_dirs: []
      essential_rules: true
      packages: []
    shellcheck:
      enabled: true
    ruff:
      enabled: true
    markdownlint:
      enabled: true
    github-checks:
      enabled: true
      timeout_ms: 90000
    languagetool:
      enabled: true
      enabled_rules: []
      disabled_rules: []
      enabled_categories: []
      disabled_categories: []
      enabled_only: false
      level: default
    biome:
      enabled: true
    hadolint:
      enabled: true
    swiftlint:
      enabled: true
    phpstan:
      enabled: true
      level: default
    phpmd:
      enabled: true
    phpcs:
      enabled: true
    golangci-lint:
      enabled: true
    yamllint:
      enabled: true
    gitleaks:
      enabled: true
    checkov:
      enabled: true
    detekt:
      enabled: true
    eslint:
      enabled: true
    flake8:
      enabled: true
    rubocop:
      enabled: true
    buf:
      enabled: true
    regal:
      enabled: true
    actionlint:
      enabled: true
    pmd:
      enabled: true
    clang:
      enabled: true
    cppcheck:
      enabled: true
    semgrep:
      enabled: true
    circleci:
      enabled: true
    clippy:
      enabled: true
    sqlfluff:
      enabled: true
    prismaLint:
      enabled: true
    pylint:
      enabled: true
    oxc:
      enabled: true
    shopifyThemeCheck:
      enabled: true
    luacheck:
      enabled: true
    brakeman:
      enabled: true
    dotenvLint:
      enabled: true
    htmlhint:
      enabled: true
    checkmake:
      enabled: true
    osvScanner:
      enabled: true
chat:
  art: true
  auto_reply: true
  integrations:
    jira:
      usage: auto
    linear:
      usage: auto
knowledge_base:
  opt_out: false
  web_search:
    enabled: true
  code_guidelines:
    enabled: true
    filePatterns: []
  learnings:
    scope: auto
  issues:
    scope: auto
  jira:
    usage: auto
    project_keys: []
  linear:
    usage: auto
    team_keys: []
  pull_requests:
    scope: auto
  mcp:
    usage: auto
    disabled_servers: []
code_generation:
  docstrings:
    language: en-US
    path_instructions: []
  unit_tests:
    path_instructions: []

This was referenced Nov 9, 2025
@coderabbitai coderabbitai bot mentioned this pull request Nov 26, 2025
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.

2 participants