-
Notifications
You must be signed in to change notification settings - Fork 0
Cpp20module #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cpp20module #1
Conversation
WalkthroughThis PR introduces a new C++ module library ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this 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 conditionif: 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
📒 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_MODULESto 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_MODULESfunctionality 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 ONensures 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::BufferWrapperavailable throughimport 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#includedirectives and follows C++20 module syntax.However, note that the imported module is currently unused (see comment on line 53).
| # 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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| # 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{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
BufferWrapperclass 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.
| namespace sopho { | ||
| export class BufferWrapper { | ||
| SDL_GPUBuffer *vertexBuffer{}; | ||
|
|
||
| }; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
Caution Docstrings generation - FAILED No docstrings were generated. |
|
@coderabbitai configuration |
CodeRabbit configurationlanguage: 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: []
|
Enable Cpp20Module
Summary by CodeRabbit
Infrastructure
Build Updates