-
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
Changes from all commits
2a098c0
8d7b7ac
c3f32f9
918ad24
c3bae73
ffa9a35
5d00b23
ae4430d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. | ||
| # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml | ||
| name: CMake on Linux | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "**" ] | ||
| pull_request: | ||
| branches: [ "**" ] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: archlinux:latest | ||
| options: --user root | ||
|
|
||
| strategy: | ||
| # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. | ||
| fail-fast: false | ||
|
|
||
| # 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> | ||
| # | ||
| # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. | ||
| matrix: | ||
| build_type: [Debug, Release] | ||
| c_compiler: [gcc, clang] | ||
| include: | ||
| - c_compiler: gcc | ||
| cpp_compiler: g++ | ||
| - c_compiler: clang | ||
| cpp_compiler: clang++ | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set reusable strings | ||
| # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | ||
| id: strings | ||
| shell: bash | ||
| run: | | ||
| echo "build-output-dir=$GITHUB_WORKSPACE/build" >> "$GITHUB_OUTPUT" | ||
| echo "install-dir=$GITHUB_WORKSPACE/install/archlinux-latest-${{ matrix.c_compiler }}-${{ matrix.build_type }}" >> "$GITHUB_OUTPUT" | ||
| - name: Install SDL windowing deps (Linux) | ||
| run: | | ||
| pacman -Syu --noconfirm | ||
| pacman -S --noconfirm --needed \ | ||
| base-devel cmake ninja pkgconf gcc clang git python3\ | ||
| alsa-lib jack libpulse \ | ||
| xorgproto libx11 libxext libxrandr libxcursor libxfixes libxi libxss libxtst \ | ||
| libxkbcommon wayland wayland-protocols \ | ||
| libdrm mesa mesa-utils | ||
| - name: Configure CMake | ||
| # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | ||
| # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | ||
| run: > | ||
| cmake -B ${{ steps.strings.outputs.build-output-dir }} | ||
| -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | ||
| -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | ||
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | ||
| -S $GITHUB_WORKSPACE | ||
| -G "Ninja Multi-Config" | ||
| - name: Build | ||
| # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
| run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | ||
|
|
||
| - name: Test | ||
| working-directory: ${{ steps.strings.outputs.build-output-dir }} | ||
| # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | ||
| # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
| run: ctest --build-config ${{ matrix.build_type }} | ||
|
|
||
| - name: Install | ||
| run: > | ||
| cmake --install ${{ steps.strings.outputs.build-output-dir }} | ||
| --config ${{ matrix.build_type }} | ||
| --prefix "${{ steps.strings.outputs.install-dir }}" | ||
| - name: Upload install folder | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: archlinux-latest-${{ matrix.c_compiler }}-${{ matrix.build_type }}-install-${{ github.sha }} | ||
| path: ${{ steps.strings.outputs.install-dir }}/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ | |
| #include <SDL3/SDL.h> | ||
| #include <SDL3/SDL_main.h> | ||
|
|
||
| import sdl_wrapper; | ||
|
|
||
| // the vertex input layout | ||
| struct Vertex { | ||
| float x, y, z; //vec3 position | ||
|
|
@@ -48,6 +50,8 @@ void main() | |
| FragColor = v_color; | ||
| })WSQ"; | ||
|
|
||
| sopho::BufferWrapper BufferWrapper{}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused BufferWrapper instance. The global Additionally, the variable name Consider one of the following:
🤖 Prompt for AI Agents |
||
|
|
||
| SDL_Window *window; | ||
| SDL_GPUDevice *device; | ||
| SDL_GPUBuffer *vertexBuffer; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| cmake_minimum_required(VERSION 3.30) | ||
| project(sdl_wrapper LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 23) | ||
| add_library(sdl_wrapper STATIC) | ||
|
|
||
| target_sources(sdl_wrapper | ||
| PUBLIC | ||
| FILE_SET cxx_modules TYPE CXX_MODULES FILES | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/sdl_wrapper.ixx | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/sdl_wrapper.buffer.ixx | ||
| ) | ||
|
|
||
| target_link_libraries(sdl_wrapper PUBLIC SDL3::SDL3) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // Created by sophomore on 11/8/25. | ||
| // | ||
|
|
||
| export module sdl_wrapper:buffer; | ||
| #include "SDL3/SDL_gpu.h" | ||
|
|
||
| namespace sopho { | ||
| export class BufferWrapper { | ||
| SDL_GPUBuffer *vertexBuffer{}; | ||
|
|
||
| }; | ||
| } | ||
|
Comment on lines
+8
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BufferWrapper is unused and provides no functionality. The Consider one of the following:
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // | ||
| // Created by sophomore on 11/7/25. | ||
| // | ||
|
|
||
| export module sdl_wrapper; | ||
| export import :buffer; |
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:
📝 Committable suggestion
🤖 Prompt for AI Agents