generated from cpp-best-practices/gui_starter_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e67ffd6
Showing
44 changed files
with
1,402 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: DontAlign | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: true | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: false | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterClass: true | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: true | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: true | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyNamespace: true | ||
SplitEmptyRecord: true | ||
BreakAfterJavaFieldAnnotations: true | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeBraces: Custom | ||
BreakBeforeInheritanceComma: true | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 0 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 2 | ||
ContinuationIndentWidth: 2 | ||
Cpp11BracedListStyle: false | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: true | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeCategories: | ||
- Priority: 2 | ||
Regex: ^"(llvm|llvm-c|clang|clang-c)/ | ||
- Priority: 3 | ||
Regex: ^(<|"(gtest|gmock|isl|json)/) | ||
- Priority: 1 | ||
Regex: .* | ||
IncludeIsMainRegex: (Test)?$ | ||
IndentCaseLabels: false | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: true | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
Language: Cpp | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 2 | ||
NamespaceIndentation: Inner | ||
ObjCBlockIndentWidth: 7 | ||
ObjCSpaceAfterProperty: true | ||
ObjCSpaceBeforeProtocolList: false | ||
PointerAlignment: Right | ||
ReflowComments: true | ||
SortIncludes: false | ||
SortUsingDeclarations: false | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 0 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: true | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 8 | ||
UseTab: Never | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm-*' | ||
WarningsAsErrors: '*' | ||
HeaderFilterRegex: '' | ||
FormatStyle: none | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
additional_commands: | ||
foo: | ||
flags: | ||
- BAR | ||
- BAZ | ||
kwargs: | ||
DEPENDS: '*' | ||
HEADERS: '*' | ||
SOURCES: '*' | ||
bullet_char: '*' | ||
dangle_parens: false | ||
enum_char: . | ||
line_ending: unix | ||
line_width: 120 | ||
max_pargs_hwrap: 3 | ||
separate_ctrl_name_with_space: false | ||
separate_fn_name_with_space: false | ||
tab_size: 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: CMake | ||
|
||
on: [push] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: RelWithDebInfo | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create Build Environment | ||
# Some projects don't allow in-source building, so create a separate build directory | ||
# We'll use this as our working directory for all subsequent commands | ||
run: cmake -E make_directory ${{runner.workspace}}/build | ||
|
||
- name: Install conan | ||
shell: bash | ||
run: | | ||
python3 -m pip install --upgrade pip setuptools | ||
python3 -m pip install conan | ||
source ~/.profile | ||
- name: Configure CMake | ||
# Use a bash shell so we can use the same syntax for environment variable | ||
# access regardless of the host operating system | ||
shell: bash | ||
working-directory: ${{runner.workspace}}/build | ||
# Note the current convention is to use the -S and -B options here to specify source | ||
# and build directories, but this is only available with CMake 3.13 and higher. | ||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | ||
# | ||
# We need to source the profile file to make sure conan is in PATH | ||
run: | | ||
source ~/.profile | ||
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE | ||
- name: Build | ||
working-directory: ${{runner.workspace}}/build | ||
shell: bash | ||
# Execute the build. You can specify a specific target with "--target <NAME>" | ||
run: cmake --build . --config $BUILD_TYPE | ||
|
||
- name: Test | ||
working-directory: ${{runner.workspace}}/build | ||
shell: bash | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
run: ctest -C $BUILD_TYPE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
language: cpp | ||
|
||
install: | ||
- pip install --user conan cmake | ||
|
||
jobs: | ||
include: | ||
- os: osx | ||
compiler: gcc | ||
osx_image: xcode11.2 # includes gcc-9 by default | ||
env: | ||
# Conan is at: ${HOME}/Library/Python/2.7/bin: we need this in the path | ||
- PATH="${HOME}/Library/Python/2.7/bin:${PATH}" | ||
- GCC_VER="9" | ||
- MATRIX_EVAL="CC=gcc-${GCC_VER} && CXX=g++-${GCC_VER}" | ||
after_script: | ||
- bash <(curl -s https://codecov.io/bash) -x /usr/bin/gcov-${GCC_VER} | ||
- os: osx | ||
compiler: clang | ||
osx_image: xcode11.2 | ||
env: | ||
- PATH="${HOME}/Library/Python/2.7/bin:${PATH}" | ||
- MATRIX_EVAL="" | ||
- os: linux | ||
dist: bionic | ||
compiler: gcc | ||
env: | ||
- GCC_VER="9" | ||
- MATRIX_EVAL="CC=gcc-${GCC_VER} && CXX=g++-${GCC_VER}" | ||
|
||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
# I couldn't get ${GCC_VER} in here successfully | ||
- gcc-9 | ||
- g++-9 | ||
- doxygen | ||
after_script: | ||
- bash <(curl -s https://codecov.io/bash) -x /usr/bin/gcov-${GCC_VER} | ||
- os: linux | ||
dist: bionic | ||
compiler: clang | ||
env: | ||
- MATRIX_EVAL="CC=clang && CXX=clang++" | ||
addons: { apt: { packages: ['doxygen'] } } | ||
|
||
|
||
before_script: | ||
- eval "${MATRIX_EVAL}" | ||
|
||
script: | ||
- cmake -D ENABLE_COVERAGE:BOOL=TRUE . | ||
- cmake --build . -- -j2 | ||
- ctest -j2 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
# Set the project name to your project name, my project isn't very descriptive | ||
project(myproject CXX) | ||
include(cmake/StandardProjectSettings.cmake) | ||
|
||
# Link this 'library' to set the c++ standard / compile-time options requested | ||
add_library(project_options INTERFACE) | ||
target_compile_features(project_options INTERFACE cxx_std_17) | ||
|
||
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") | ||
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF) | ||
if (ENABLE_BUILD_WITH_TIME_TRACE) | ||
add_compile_definitions(project_options INTERFACE -ftime-trace) | ||
endif() | ||
endif() | ||
|
||
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake | ||
add_library(project_warnings INTERFACE) | ||
|
||
# enable cache system | ||
include(cmake/Cache.cmake) | ||
|
||
# standard compiler warnings | ||
include(cmake/CompilerWarnings.cmake) | ||
set_project_warnings(project_warnings) | ||
|
||
# sanitizer options if supported by compiler | ||
include(cmake/Sanitizers.cmake) | ||
enable_sanitizers(project_options) | ||
|
||
# enable doxygen | ||
include(cmake/Doxygen.cmake) | ||
enable_doxygen() | ||
|
||
# allow for static analysis options | ||
include(cmake/StaticAnalyzers.cmake) | ||
|
||
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF) | ||
option(ENABLE_TESTING "Enable Test Builds" ON) | ||
option(ENABLE_FUZZING "Enable Fuzzing Builds" OFF) | ||
|
||
# Very basic PCH example | ||
option(ENABLE_PCH "Enable Precompiled Headers" OFF) | ||
if (ENABLE_PCH) | ||
# This sets a global PCH parameter, each project will build its own PCH, which | ||
# is a good idea if any #define's change | ||
# | ||
# consider breaking this out per project as necessary | ||
target_precompile_headers(project_options INTERFACE <vector> <string> <map> <utility>) | ||
endif() | ||
|
||
|
||
# Set up some extra Conan dependencies based on our needs | ||
# before loading Conan | ||
set(CONAN_EXTRA_REQUIRES "") | ||
set(CONAN_EXTRA_OPTIONS "") | ||
|
||
if(CPP_STARTER_USE_IMGUI) | ||
set(CONAN_EXTRA_REQUIRES ${CONAN_EXTRA_REQUIRES} | ||
imgui-sfml/2.1@bincrafters/stable) | ||
|
||
# set(CONAN_EXTRA_OPTIONS ${CONAN_EXTRA_OPTIONS} sfml:shared=False | ||
# sfml:graphics=True sfml:audio=False sfml:window=True | ||
# libalsa:disable_python=True) | ||
endif() | ||
|
||
if(CPP_STARTER_USE_SDL) | ||
set(CONAN_EXTRA_REQUIRES ${CONAN_EXTRA_REQUIRES} | ||
sdl2/2.0.10@bincrafters/stable) | ||
# set(CONAN_EXTRA_OPTIONS ${CONAN_EXTRA_OPTIONS} sdl2:wayland=True) | ||
endif() | ||
|
||
|
||
include(cmake/Conan.cmake) | ||
run_conan() | ||
|
||
if(ENABLE_TESTING) | ||
enable_testing() | ||
message( | ||
"Building Tests. Be sure to check out test/constexpr_tests for constexpr testing" | ||
) | ||
add_subdirectory(test) | ||
endif() | ||
|
||
if(ENABLE_FUZZING) | ||
message( | ||
"Building Fuzz Tests, using fuzzing sanitizer https://www.llvm.org/docs/LibFuzzer.html" | ||
) | ||
add_subdirectory(fuzz_test) | ||
endif() | ||
|
||
|
||
add_subdirectory(src) | ||
|
||
|
||
option(ENABLE_UNITY "Enable Unity builds of projects" OFF) | ||
if (ENABLE_UNITY) | ||
# Add for any project you want to apply unity builds for | ||
set_target_properties(intro PROPERTIES UNITY_BUILD ON) | ||
endif() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <https://unlicense.org> |
Oops, something went wrong.