Skip to content

Integrate le2d, show ImGui demo window #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

Merged
merged 4 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
Language: Cpp
BasedOnStyle: LLVM
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Attach
ColumnLimit: 160
SpaceAfterTemplateKeyword: true
Standard: c++20
TabWidth: 4
IndentWidth: 4
UseTab: Always
AllowShortEnumsOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortBlocksOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: Always
AllowShortLoopsOnASingleLine: true
IndentRequires: true
IncludeCategories:
# Headers in <> with .h extension.
- Regex: '<([A-Za-z0-9\/-_])+\.h>'
Priority: 10
# Headers in <> with .hpp extension.
- Regex: '<([A-Za-z0-9\/-_])+\.hpp>'
Priority: 20
# Headers in <> without extension.
- Regex: '<([A-Za-z0-9\/-_])+>'
Priority: 30
PointerAlignment: Left
QualifierAlignment: Right
21 changes: 21 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
Checks: 'clang-analyzer-*,
concurrency-*,
cppcoreguidelines-*,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-const-or-ref-data-members,
misc-*,
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,
modernize-*,
-modernize-use-trailing-return-type,
performance-*,
portability-*,
readability-*,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-redundant-member-init,
-readability-uppercase-literal-suffix'
...
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[*]
insert_final_newline = true
charset = utf-8
indent_size = 4
indent_style = tab
# Optional: git will commit as lf, this will only affect local files
end_of_line = lf

[*.{py,md,yml,sh,cmake,json}]
indent_style = space
indent_size = 2

[*.{py,md,yml,sh,cmake,json}.in]
indent_style = space
indent_size = 2

[CMakeLists.txt]
indent_style = space
indent_size = 2
14 changes: 14 additions & 0 deletions .github/format_check_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

[[ ! $(git --version) ]] && exit 1

output=$(git diff)

if [[ "$output" != "" ]]; then
echo -e "One or more source files are not formatted!\n\n$output\n"
echo -e "Using $(clang-format --version)\n"
exit 1
fi

echo "All source files are formatted"
exit
105 changes: 105 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: ci-pr
on: [pull_request, workflow_dispatch]
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: format code
run: scripts/format_code.sh
- name: check diff
run: .github/format_check_diff.sh
x64-linux-gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: init
run: uname -m; sudo apt update -yqq && sudo apt install -yqq ninja-build mesa-common-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
- name: configure
run: cmake -S . --preset=ninja-gcc -B build -DKVF_USE_FREETYPE=OFF -DGLFW_BUILD_X11=OFF -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
- name: build debug
run: cmake --build build --config=Debug -- -v
- name: build release
run: cmake --build build --config=Release -- -v
- name: test debug
run: cd build && ctest -V -C Debug
- name: test release
run: cd build && ctest -V -C Release
x64-linux-clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: init
run: uname -m; sudo apt update -yqq && sudo apt install -yqq ninja-build clang-19 mesa-common-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
- name: configure
run: cmake -S . --preset=ninja-clang -B build -DKVF_USE_FREETYPE=OFF -DGLFW_BUILD_X11=OFF -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19
- name: build debug
run: cmake --build build --config=Debug -- -v
- name: build release
run: cmake --build build --config=Release -- -v
- name: test debug
run: cd build && ctest -V -C Debug
- name: test release
run: cd build && ctest -V -C Release
arm64-linux-gcc:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: init
run: uname -m; sudo apt update -yqq && sudo apt install -yqq ninja-build mesa-common-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
- name: configure
run: cmake -S . --preset=ninja-gcc -B build -DKVF_USE_FREETYPE=OFF -DGLFW_BUILD_X11=OFF -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
- name: build debug
run: cmake --build build --config=Debug -- -v
- name: build release
run: cmake --build build --config=Release -- -v
- name: test debug
run: cd build && ctest -V -C Debug
- name: test release
run: cd build && ctest -V -C Release
arm64-linux-clang:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: init
run: uname -m; sudo apt update -yqq && sudo apt install -yqq ninja-build clang-19 mesa-common-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
- name: configure
run: cmake -S . --preset=ninja-clang -B build -DKVF_USE_FREETYPE=OFF -DGLFW_BUILD_X11=OFF -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19
- name: build debug
run: cmake --build build --config=Debug -- -v
- name: build release
run: cmake --build build --config=Release -- -v
- name: test debug
run: cd build && ctest -V -C Debug
- name: test release
run: cd build && ctest -V -C Release
x64-windows-vs22:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: configure
run: cmake -S . --preset=vs22 -B build -DKVF_USE_FREETYPE=OFF
- name: build debug
run: cmake --build build --config=Debug --parallel
- name: build release
run: cmake --build build --config=Release --parallel
- name: test debug
run: cd build && ctest -V -C Debug
- name: test release
run: cd build && ctest -V -C Release
x64-windows-clang:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: init
run: choco install ninja
- name: configure
run: cmake -S . --preset=ninja-clang -B build -DKVF_USE_FREETYPE=OFF
- name: build debug
run: cmake --build build --config=Debug -- -v
- name: build release
run: cmake --build build --config=Release -- -v
- name: test debug
run: cd build && ctest -V -C Debug
- name: test release
run: cd build && ctest -V -C Release
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**/.vs/*
**/.vscode/*
build/*
out/*
.cache
.DS_Store

CMakeSettings.json
compile_commands.json
/CMakeUserPresets.json

imgui.ini
*debug.log
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.24)

project(miracle VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_DEBUG_POSTFIX "-d")

add_subdirectory(ext)

add_executable(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE
le2d
)

target_include_directories(${PROJECT_NAME} PRIVATE
src
)

file(GLOB_RECURSE sources LIST_DIRECTORIES false "src/*.[hc]pp")
target_sources(${PROJECT_NAME} PRIVATE
${sources}
)
Loading