Initial commit

This commit is contained in:
shrukan
2022-12-22 21:40:39 -08:00
commit 9f47776564
23 changed files with 11061 additions and 0 deletions

73
.clang-format Normal file
View File

@ -0,0 +1,73 @@
# We'll use defaults from the Google style, but with 4 columns indentation.
BasedOnStyle: Google
IndentWidth: 4
TabWidth: 4
UseTab: Always
---
Language: Cpp
DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Left
SpaceBeforeAssignmentOperators: true
SpacesInParentheses: false
AllowAllArgumentsOnNextLine: false
BreakBeforeBraces: Attach
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
BreakAfterJavaFieldAnnotations: true
BreakBeforeInheritanceComma: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
CompactNamespaces: false
PackConstructorInitializers: CurrentLine
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
SpaceBeforeCpp11BracedList: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
FixNamespaceComments: true
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceAfterTemplateKeyword: true
SpaceBeforeInheritanceColon: true
SortUsingDeclarations: true
SortIncludes: true

1
.clang-format-ignore Normal file
View File

@ -0,0 +1 @@
subprojects/**

2
.gitea/template Normal file
View File

@ -0,0 +1,2 @@
**.build
**.md

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
build/
builddir/
subprojects/**
!subprojects/*.wrap
!subprojects/.clang-format

16
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "c++20",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}

33
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,33 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test/TestMain",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"preLaunchTask": "Make debug",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}

65
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,65 @@
{
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"semaphore": "cpp"
}
}

85
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,85 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Make all",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
}
},
{
"label": "Make debug",
"type": "shell",
"command": "make debug",
"group": {
"kind": "build",
}
},
{
"label": "Make release",
"type": "shell",
"command": "make release",
"group": {
"kind": "build",
}
},
{
"label": "Make test",
"type": "shell",
"command": "make test",
"group": {
"kind": "test",
}
},
{
"label": "Make coverage",
"type": "shell",
"command": "make coverage",
"group": {
"kind": "test",
}
},
{
"label": "Make docs",
"type": "shell",
"command": "make docs/html",
"group": {
"kind": "build",
}
},
{
"label": "Make clean",
"type": "shell",
"command": "make clean",
"group": {
"kind": "build",
}
},
{
"label": "Make spotless",
"type": "shell",
"command": "make spotless",
"group": {
"kind": "build",
}
},
{
"label": "Make scan",
"type": "shell",
"command": "make scan-build",
"group": {
"kind": "build",
}
},
{
"label": "Make sanitize",
"type": "shell",
"command": "make sanitize",
"group": {
"kind": "build",
}
},
]
}

77
Makefile Normal file
View File

@ -0,0 +1,77 @@
###############################################################################
# Simple Makefile to prevent the need to interact with Meson directly.
#
# While Meson and Ninja are many things, intuitive is not one of them when it
# comes to the command line. This is easily rectified with a simple make file
# to hide the details and present a simple and familiar interface. This will
# allow Meson and Ninja to do their thing with a few options:
#
# - BUILD_PREFIX = The build directory, defaults to ./build
# - BUILD_TYPE = release or debug
#
# All other build targets get passed straight to Ninja
###############################################################################
# Default to a less-verbose build. If you want all the gory compiler output,
# run "make VERBOSE=1"
$(VERBOSE).SILENT:
# Figure out where to build the software.
# Use BUILD_PREFIX if it was passed in.
# If not, search up to four parent directories for a 'build' directory.
# Otherwise, use ./build.
ifeq "$(BUILD_PREFIX)" ""
BUILD_PREFIX:=$(shell for pfx in ./ .. ../.. ../../.. ../../../..; do d=`pwd`/$$pfx/build;\
if [ -d $$d ]; then echo $$d; exit 0; fi; done; echo `pwd`/build)
endif
# create the build directory if needed, and normalize its path name
BUILD_PREFIX:=$(shell mkdir -p $(BUILD_PREFIX) && cd $(BUILD_PREFIX) && echo `pwd`)
# Default to a release build. If you want to enable debugging flags, run
# "make BUILD_TYPE=debug"
ifeq "$(BUILD_TYPE)" ""
BUILD_TYPE="release"
endif
all: $(BUILD_PREFIX)/build.ninja
ninja -C $(BUILD_PREFIX)
$(BUILD_PREFIX)/build.ninja:
$(MAKE) configure
.PHONY: configure
configure:
@echo "\nBUILD_PREFIX: $(BUILD_PREFIX)\n\n"
@meson --buildtype=$(BUILD_TYPE) $(BUILD_PREFIX)
# This needs to be separate for some reason
test: $(BUILD_PREFIX)/build.ninja
ninja -C $(BUILD_PREFIX) test
coverage: test
ninja -C $(BUILD_PREFIX) coverage
debug: $(BUILD_PREFIX)/build.ninja
meson configure $(BUILD_PREFIX) --buildtype=debug
ninja -C $(BUILD_PREFIX)
release: $(BUILD_PREFIX)/build.ninja
meson configure $(BUILD_PREFIX) --buildtype=release
ninja -C $(BUILD_PREFIX)
sanitize: $(BUILD_PREFIX)/build.ninja
meson configure $(BUILD_PREFIX) -Db_sanitize=address
ninja -C $(BUILD_PREFIX)
clean:
-if [ -d $(BUILD_PREFIX) ]; then ninja -C $(BUILD_PREFIX) clean; fi
spotless:
rm -r $(BUILD_PREFIX)
meson subprojects purge --confirm
# other (custom) targets are passed through to the Meson genarated Ninja file
% ::
ninja -C $(BUILD_PREFIX) $@

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# ${REPO_NAME_PASCAL}
${REPO_DESCRIPTION}

2702
docs/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

7908
docs/doxygen-awesome.css Normal file

File diff suppressed because one or more lines are too long

4
docs/mainpage.md Normal file
View File

@ -0,0 +1,4 @@
\mainpage
## Header
${REPO_DESCRIPTION}

24
docs/meson.build Normal file
View File

@ -0,0 +1,24 @@
cdata = configuration_data()
cdata.set('VERSION', meson.project_version())
cdata.set('PROJECTNAME', meson.project_name())
cdata.set('TOP_SRCDIR', meson.source_root())
cdata.set('TOP_BUILDDIR', meson.build_root())
cdata.set('DOXYGEN_AWESOME', join_paths(meson.current_source_dir(), 'doxygen-awesome.css'))
cdata.set('DOC_OUTPUT_DIR', meson.current_build_dir())
if find_program('dot', required : false).found()
cdata.set('HAVE_DOT', 'YES')
else
cdata.set('HAVE_DOT', 'NO')
endif
doxyfile = configure_file(input: 'Doxyfile.in',
output: 'Doxyfile',
configuration: cdata,
install: false)
html_target = custom_target('docs',
input: doxyfile,
output: 'html',
command: [doxygen, doxyfile],
install: false)

7
gcovr.cfg Normal file
View File

@ -0,0 +1,7 @@
exclude = build/test/*
exclude = test/*
exclude = include/*
exclude = subprojects/*
gcov-parallel = yes
decisions = yes

20
meson.build Normal file
View File

@ -0,0 +1,20 @@
project('${REPO_NAME_PASCAL}', 'cpp',
version : '0.1',
default_options : ['warning_level=3',
'cpp_std=c++20',
'b_coverage=true'])
add_global_arguments(language : 'cpp')
inc = include_directories('include')
doxygen = find_program('doxygen', required : false)
doctest = subproject('doctest')
doctest_dep = doctest.get_variable('doctest_dep')
subdir('src')
subdir('test')
if doxygen.found()
subdir('docs')
endif

5
src/hello.cpp Normal file
View File

@ -0,0 +1,5 @@
/*!
* \brief Main Entry Point
* \return Status code
*/
int main() { return 0; }

3
src/meson.build Normal file
View File

@ -0,0 +1,3 @@
sources = ['hello.cpp']
executable('hello', sources, include_directories : inc, install : false)

View File

@ -0,0 +1,2 @@
DisableFormat: true
SortIncludes: Never

9
subprojects/doctest.wrap Normal file
View File

@ -0,0 +1,9 @@
[wrap-file]
directory = doctest-2.4.9
source_url = https://github.com/doctest/doctest/archive/refs/tags/v2.4.9.tar.gz
source_filename = doctest-2.4.9.tar.gz
source_hash = 19b2df757f2f3703a5e63cee553d85596875f06d91a3333acd80a969ef210856
wrapdb_version = 2.4.9-1
[provide]
dependency_names = doctest

3
test/Sample_test.cpp Normal file
View File

@ -0,0 +1,3 @@
#include "doctest.h"
TEST_CASE("sample_test") { CHECK(1 == 1); }

2
test/TestMain.cpp Normal file
View File

@ -0,0 +1,2 @@
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"

11
test/meson.build Normal file
View File

@ -0,0 +1,11 @@
# Add test sources to this list
test_sources = ['Sample_test.cpp']
test_sources += 'TestMain.cpp'
testexe = executable('TestMain', test_sources, dependencies : doctest_dep, include_directories : inc)
test_base_name = ''.join([meson.project_name(), 'Tests'])
# List test targets here, organized by suite
test(test_base_name, testexe)