Skip to content

Commit 6afbc38

Browse files
committed
Init repo
0 parents  commit 6afbc38

23 files changed

+574
-0
lines changed

.clang-format

+31
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: 80
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

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
performance-*,
13+
portability-*,
14+
readability-*,
15+
-readability-identifier-length,
16+
-readability-magic-numbers,
17+
-readability-redundant-member-init,
18+
-readability-uppercase-literal-suffix'
19+
...

.editorconfig

+19
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

+14
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

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: ci-push
2+
on: [push]
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 install -yqq ninja-build
18+
- name: configure
19+
run: export CXX=g++-14; cmake -S . --preset=default -B build
20+
- name: build debug
21+
run: cmake --build build --config=Debug
22+
- name: build release
23+
run: cmake --build build --config=Release
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 install -yqq ninja-build
34+
- name: configure
35+
run: cmake -S . --preset=ninja-clang -B build
36+
- name: build debug
37+
run: cmake --build build --config=Debug
38+
- name: build release
39+
run: cmake --build build --config=Release
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
50+
- name: configure
51+
run: export CXX=g++-14; cmake -S . --preset=default -B build
52+
- name: build debug
53+
run: cmake --build build --config=Debug
54+
- name: build release
55+
run: cmake --build build --config=Release
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
66+
- name: configure
67+
run: cmake -S . --preset=ninja-clang -B build
68+
- name: build debug
69+
run: cmake --build build --config=Debug
70+
- name: build release
71+
run: cmake --build build --config=Release
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
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 clang
98+
- name: build debug
99+
run: cmake --build clang --config=Debug
100+
- name: build release
101+
run: cmake --build clang --config=Release
102+
- name: test debug
103+
run: cd clang && ctest -V -C Debug
104+
- name: test release
105+
run: cd clang && ctest -V -C Release

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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

CMakeLists.txt

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cmake_minimum_required(VERSION 3.24)
2+
3+
project(learn-vk)
4+
5+
# set C++ options
6+
set(CMAKE_CXX_STANDARD 23)
7+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
set(CMAKE_CXX_EXTENSIONS OFF)
9+
10+
# set other CMake options
11+
set(CMAKE_DEBUG_POSTFIX "-d")
12+
set(BUILD_SHARED_LIBS OFF)
13+
14+
# declare executable target
15+
add_executable(${PROJECT_NAME})
16+
17+
# setup precompiled header
18+
target_precompile_headers(${PROJECT_NAME} PRIVATE
19+
)
20+
21+
# enable including headers in 'src/'
22+
target_include_directories(${PROJECT_NAME} PRIVATE
23+
src
24+
)
25+
26+
# add all source files in 'src/' to target
27+
file(GLOB_RECURSE sources LIST_DIRECTORIES false "src/*.[hc]pp")
28+
target_sources(${PROJECT_NAME} PRIVATE
29+
${sources}
30+
)
31+
32+
# setup compiler warnings
33+
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
34+
target_compile_options(${PROJECT_NAME} PRIVATE
35+
-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type
36+
$<$<NOT:$<CONFIG:Debug>>:-Werror> # warnings as errors if not Debug
37+
)
38+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
39+
target_compile_options(${PROJECT_NAME} PRIVATE
40+
$<$<NOT:$<CONFIG:Debug>>:/WX> # warnings as errors if not Debug
41+
)
42+
endif()

CMakePresets.json

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"version": 2,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 20,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "default",
11+
"description": "Build configuration using Ninja Multi-config",
12+
"generator": "Ninja Multi-Config",
13+
"binaryDir": "${sourceDir}/out/default",
14+
"cacheVariables": {
15+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
16+
}
17+
},
18+
{
19+
"name": "ninja-clang",
20+
"description": "Build configuration using Ninja Multi-config / clang",
21+
"inherits": "default",
22+
"binaryDir": "${sourceDir}/out/clang",
23+
"cacheVariables": {
24+
"CMAKE_C_COMPILER": "clang",
25+
"CMAKE_CXX_COMPILER": "clang++"
26+
}
27+
},
28+
{
29+
"name": "ninja-ubsan",
30+
"description": "UBSan build configuration using Ninja Multi-config",
31+
"inherits": "default",
32+
"binaryDir": "${sourceDir}/out/ubsan",
33+
"cacheVariables": {
34+
"CMAKE_C_FLAGS": "-fsanitize=undefined",
35+
"CMAKE_CXX_FLAGS": "-fsanitize=undefined"
36+
}
37+
},
38+
{
39+
"name": "ninja-asan",
40+
"description": "ASan build configuration using Ninja Multi-config",
41+
"inherits": "default",
42+
"binaryDir": "${sourceDir}/out/asan",
43+
"cacheVariables": {
44+
"CMAKE_C_FLAGS": "-fsanitize=address",
45+
"CMAKE_CXX_FLAGS": "-fsanitize=address"
46+
}
47+
},
48+
{
49+
"name": "ninja-tsan",
50+
"description": "TSan build configuration using Ninja Multi-config",
51+
"inherits": "default",
52+
"binaryDir": "${sourceDir}/out/tsan",
53+
"cacheVariables": {
54+
"CMAKE_C_FLAGS": "-fsanitize=thread",
55+
"CMAKE_CXX_FLAGS": "-fsanitize=thread"
56+
}
57+
},
58+
{
59+
"name": "vs22",
60+
"description": "Build configuration using Visual Studio 17 (2022)",
61+
"generator": "Visual Studio 17 2022",
62+
"binaryDir": "${sourceDir}/out/vs",
63+
"architecture": {
64+
"value": "x64",
65+
"strategy": "external"
66+
}
67+
}
68+
],
69+
"buildPresets": [
70+
{
71+
"name": "Debug",
72+
"configurePreset": "default",
73+
"configuration": "Debug"
74+
},
75+
{
76+
"name": "Release",
77+
"configurePreset": "default",
78+
"configuration": "Release"
79+
},
80+
{
81+
"name": "RelWithDebInfo",
82+
"configurePreset": "default",
83+
"configuration": "RelWithDebInfo"
84+
},
85+
{
86+
"name": "UBSan Debug",
87+
"configurePreset": "ninja-ubsan",
88+
"configuration": "Debug"
89+
}
90+
],
91+
"testPresets": [
92+
{
93+
"name": "Debug",
94+
"configurePreset": "default",
95+
"configuration": "Debug",
96+
"inheritConfigureEnvironment": true
97+
},
98+
{
99+
"name": "Release",
100+
"configurePreset": "default",
101+
"configuration": "Release",
102+
"inheritConfigureEnvironment": true
103+
},
104+
{
105+
"name": "RelWithDebInfo",
106+
"configurePreset": "default",
107+
"configuration": "RelWithDebInfo",
108+
"inheritConfigureEnvironment": true
109+
},
110+
{
111+
"name": "UBSan Debug",
112+
"configurePreset": "ninja-ubsan",
113+
"configuration": "Debug",
114+
"inheritConfigureEnvironment": true
115+
}
116+
]
117+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Karn Kaul and contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Learn Vulkan
2+
3+
[![Build status](https://github.com/cpp-gamedev/learn-vulkan/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-gamedev/learn-vulkan/actions/workflows/ci.yml)

guide/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

0 commit comments

Comments
 (0)