Skip to content

Commit 24c9873

Browse files
authored
Integrate le2d, show ImGui demo window (#1)
* Add dotfiles, CMake presets * Vendor le2d * Create Context, show ImGui demo window * Add CI scripts
1 parent 578a7d8 commit 24c9873

File tree

16 files changed

+560
-0
lines changed

16 files changed

+560
-0
lines changed

.clang-format

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: LLVM
4+
AlwaysBreakTemplateDeclarations: Yes
5+
BreakBeforeBraces: Attach
6+
ColumnLimit: 160
7+
SpaceAfterTemplateKeyword: true
8+
Standard: c++20
9+
TabWidth: 4
10+
IndentWidth: 4
11+
UseTab: Always
12+
AllowShortEnumsOnASingleLine: true
13+
AllowShortCaseLabelsOnASingleLine: true
14+
AllowShortFunctionsOnASingleLine: All
15+
AllowShortLambdasOnASingleLine: All
16+
AllowShortBlocksOnASingleLine: Always
17+
AllowShortIfStatementsOnASingleLine: Always
18+
AllowShortLoopsOnASingleLine: true
19+
IndentRequires: true
20+
IncludeCategories:
21+
# Headers in <> with .h extension.
22+
- Regex: '<([A-Za-z0-9\/-_])+\.h>'
23+
Priority: 10
24+
# Headers in <> with .hpp extension.
25+
- Regex: '<([A-Za-z0-9\/-_])+\.hpp>'
26+
Priority: 20
27+
# Headers in <> without extension.
28+
- Regex: '<([A-Za-z0-9\/-_])+>'
29+
Priority: 30
30+
PointerAlignment: Left
31+
QualifierAlignment: Right

.clang-tidy

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
Checks: 'clang-analyzer-*,
3+
concurrency-*,
4+
cppcoreguidelines-*,
5+
-cppcoreguidelines-non-private-member-variables-in-classes,
6+
-cppcoreguidelines-avoid-magic-numbers,
7+
-cppcoreguidelines-avoid-const-or-ref-data-members,
8+
misc-*,
9+
-misc-non-private-member-variables-in-classes,
10+
-misc-no-recursion,
11+
modernize-*,
12+
-modernize-use-trailing-return-type,
13+
performance-*,
14+
portability-*,
15+
readability-*,
16+
-readability-identifier-length,
17+
-readability-implicit-bool-conversion,
18+
-readability-magic-numbers,
19+
-readability-redundant-member-init,
20+
-readability-uppercase-literal-suffix'
21+
...

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[*]
2+
insert_final_newline = true
3+
charset = utf-8
4+
indent_size = 4
5+
indent_style = tab
6+
# Optional: git will commit as lf, this will only affect local files
7+
end_of_line = lf
8+
9+
[*.{py,md,yml,sh,cmake,json}]
10+
indent_style = space
11+
indent_size = 2
12+
13+
[*.{py,md,yml,sh,cmake,json}.in]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[CMakeLists.txt]
18+
indent_style = space
19+
indent_size = 2

.github/format_check_diff.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
[[ ! $(git --version) ]] && exit 1
4+
5+
output=$(git diff)
6+
7+
if [[ "$output" != "" ]]; then
8+
echo -e "One or more source files are not formatted!\n\n$output\n"
9+
echo -e "Using $(clang-format --version)\n"
10+
exit 1
11+
fi
12+
13+
echo "All source files are formatted"
14+
exit

.github/workflows/ci.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: ci-pr
2+
on: [pull_request, workflow_dispatch]
3+
jobs:
4+
format-check:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: format code
9+
run: scripts/format_code.sh
10+
- name: check diff
11+
run: .github/format_check_diff.sh
12+
x64-linux-gcc:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: init
17+
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
18+
- name: configure
19+
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
20+
- name: build debug
21+
run: cmake --build build --config=Debug -- -v
22+
- name: build release
23+
run: cmake --build build --config=Release -- -v
24+
- name: test debug
25+
run: cd build && ctest -V -C Debug
26+
- name: test release
27+
run: cd build && ctest -V -C Release
28+
x64-linux-clang:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: init
33+
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
34+
- name: configure
35+
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
36+
- name: build debug
37+
run: cmake --build build --config=Debug -- -v
38+
- name: build release
39+
run: cmake --build build --config=Release -- -v
40+
- name: test debug
41+
run: cd build && ctest -V -C Debug
42+
- name: test release
43+
run: cd build && ctest -V -C Release
44+
arm64-linux-gcc:
45+
runs-on: ubuntu-24.04-arm
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: init
49+
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
50+
- name: configure
51+
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
52+
- name: build debug
53+
run: cmake --build build --config=Debug -- -v
54+
- name: build release
55+
run: cmake --build build --config=Release -- -v
56+
- name: test debug
57+
run: cd build && ctest -V -C Debug
58+
- name: test release
59+
run: cd build && ctest -V -C Release
60+
arm64-linux-clang:
61+
runs-on: ubuntu-24.04-arm
62+
steps:
63+
- uses: actions/checkout@v4
64+
- name: init
65+
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
66+
- name: configure
67+
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
68+
- name: build debug
69+
run: cmake --build build --config=Debug -- -v
70+
- name: build release
71+
run: cmake --build build --config=Release -- -v
72+
- name: test debug
73+
run: cd build && ctest -V -C Debug
74+
- name: test release
75+
run: cd build && ctest -V -C Release
76+
x64-windows-vs22:
77+
runs-on: windows-latest
78+
steps:
79+
- uses: actions/checkout@v4
80+
- name: configure
81+
run: cmake -S . --preset=vs22 -B build -DKVF_USE_FREETYPE=OFF
82+
- name: build debug
83+
run: cmake --build build --config=Debug --parallel
84+
- name: build release
85+
run: cmake --build build --config=Release --parallel
86+
- name: test debug
87+
run: cd build && ctest -V -C Debug
88+
- name: test release
89+
run: cd build && ctest -V -C Release
90+
x64-windows-clang:
91+
runs-on: windows-latest
92+
steps:
93+
- uses: actions/checkout@v4
94+
- name: init
95+
run: choco install ninja
96+
- name: configure
97+
run: cmake -S . --preset=ninja-clang -B build -DKVF_USE_FREETYPE=OFF
98+
- name: build debug
99+
run: cmake --build build --config=Debug -- -v
100+
- name: build release
101+
run: cmake --build build --config=Release -- -v
102+
- name: test debug
103+
run: cd build && ctest -V -C Debug
104+
- name: test release
105+
run: cd build && ctest -V -C Release

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
**/.vs/*
2+
**/.vscode/*
3+
build/*
4+
out/*
5+
.cache
6+
.DS_Store
7+
8+
CMakeSettings.json
9+
compile_commands.json
10+
/CMakeUserPresets.json
11+
12+
imgui.ini
13+
*debug.log

CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake_minimum_required(VERSION 3.24)
2+
3+
project(miracle VERSION 0.1.0)
4+
5+
set(CMAKE_CXX_STANDARD 23)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
set(CMAKE_CXX_EXTENSIONS OFF)
8+
set(CMAKE_DEBUG_POSTFIX "-d")
9+
10+
add_subdirectory(ext)
11+
12+
add_executable(${PROJECT_NAME})
13+
14+
target_link_libraries(${PROJECT_NAME} PRIVATE
15+
le2d
16+
)
17+
18+
target_include_directories(${PROJECT_NAME} PRIVATE
19+
src
20+
)
21+
22+
file(GLOB_RECURSE sources LIST_DIRECTORIES false "src/*.[hc]pp")
23+
target_sources(${PROJECT_NAME} PRIVATE
24+
${sources}
25+
)

0 commit comments

Comments
 (0)