Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed Mar 19, 2024
2 parents c73d5fe + 759d718 commit b8e3946
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 52 deletions.
4 changes: 0 additions & 4 deletions .github/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
[![codecov](https://codecov.io/gh/%%myorg%%/%%myproject%%/branch/main/graph/badge.svg)](https://codecov.io/gh/%%myorg%%/%%myproject%%)
[![CodeQL](https://github.com/%%myorg%%/%%myproject%%/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/%%myorg%%/%%myproject%%/actions/workflows/codeql-analysis.yml)

LGTM Has to be set up manually after template is created:

[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/%%myorg%%/%%myproject%%)](https://lgtm.com/projects/g/%%myorg%%/%%myproject%%/context:cpp)

## About %%myproject%%
%%description%%

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/template-janitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ on:
release:
types: [published]
push:
tags:
branches:
- main
- develop
permissions:
contents: write

env:
TEMPLATES_PATH: ".github/template"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Build directories and binary files
build/
out/
out/coverage/*
cmake-build-*/
conan-cache/

Expand All @@ -15,6 +16,7 @@ CMakeUserPresets.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.bak
*.swp
*~
_ReSharper*
Expand Down
24 changes: 0 additions & 24 deletions .lgtm.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function(myproject_setup_dependencies)
endif()

if(NOT TARGET ftxui::screen)
cpmaddpackage("gh:ArthurSonzogni/FTXUI#e23dbc7473654024852ede60e2121276c5aab660")
cpmaddpackage("gh:ArthurSonzogni/FTXUI@5.0.0")
endif()

if(NOT TARGET tools::tools)
Expand Down
2 changes: 1 addition & 1 deletion ProjectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ macro(myproject_local_options)

if(myproject_ENABLE_USER_LINKER)
include(cmake/Linker.cmake)
configure_linker(myproject_options)
myproject_configure_linker(myproject_options)
endif()

include(cmake/Sanitizers.cmake)
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

[![ci](https://github.com/cpp-best-practices/cmake_template/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-best-practices/cmake_template/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/cpp-best-practices/cmake_template/branch/main/graph/badge.svg)](https://codecov.io/gh/cpp-best-practices/cmake_template)
[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/cpp-best-practices/cmake_template)](https://lgtm.com/projects/g/cpp-best-practices/cmake_template/context:cpp)
[![CodeQL](https://github.com/cpp-best-practices/cmake_template/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cpp-best-practices/cmake_template/actions/workflows/codeql-analysis.yml)

## About cmake_template

**NOTE** This is undergoing a major overhaul on a new branch currently.


This is a C++ Best Practices GitHub template for getting up and running with C++ quickly.

By default (collectively known as `ENABLE_DEVELOPER_MODE`)
Expand All @@ -23,7 +19,7 @@ It includes

* a basic CLI example
* examples for fuzz, unit, and constexpr testing
* large github action testing matrix
* large GitHub action testing matrix

It requires

Expand All @@ -36,15 +32,16 @@ This project gets you started with a simple example of using FTXUI, which happen

## Getting Started

### Use the Github template
### Use the GitHub template
First, click the green `Use this template` button near the top of this page.
This will take you to Github's ['Generate Repository'](https://github.com/cpp-best-practices/cmake_template/generate) page.
This will take you to GitHub's ['Generate Repository'](https://github.com/cpp-best-practices/cmake_template/generate)
page.
Fill in a repository name and short description, and click 'Create repository from template'.
This will allow you to create a new repository in your Github account,
This will allow you to create a new repository in your GitHub account,
prepopulated with the contents of this project.

After creating the project please wait until the cleanup workflow has finished
setting up your project and commited the changes.
setting up your project and committed the changes.

Now you can clone the project locally and get to work!

Expand All @@ -54,7 +51,6 @@ Now you can clone the project locally and get to work!

* [Dependency Setup](README_dependencies.md)
* [Building Details](README_building.md)
* [Troubleshooting](README_troubleshooting.md)
* [Docker](README_docker.md)

## Testing
Expand Down
6 changes: 3 additions & 3 deletions README_dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Note about install commands:
- for Windows, we use [choco](https://chocolatey.org/install).
- for MacOS, we use [brew](https://brew.sh/).
- for macOS, we use [brew](https://brew.sh/).
- In case of an error in cmake, make sure that the dependencies are on the PATH.


Expand All @@ -11,7 +11,7 @@ Note about install commands:
This is a really long list of dependencies, and it's easy to mess up. That's why:

#### Docker
We have a Docker image that's already set up for you. See the [Docker instructions](#docker-instructions).
We have a Docker image that's already set up for you. See the [Docker instructions](./README_docker.md).

#### Setup-cpp

Expand Down Expand Up @@ -103,7 +103,7 @@ The following compilers should work:
</details>


2. [CMake 3.15+](https://cmake.org/)
2. [CMake 3.21+](https://cmake.org/)
<details>
<summary>Install Command</summary>

Expand Down
5 changes: 3 additions & 2 deletions cmake/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function(
if("${MSVC_WARNINGS}" STREQUAL "")
set(MSVC_WARNINGS
/W4 # Baseline reasonable warnings
/w14242 # 'identifier': conversion from 'type1' to 'type1', possible loss of data
/w14242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/w14254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/w14263 # 'function': member function does not override any base class virtual member function
/w14265 # 'classname': class has virtual functions, but destructor is not virtual instances of this class may not
Expand All @@ -30,7 +30,7 @@ function(
/w14555 # expression has no effect; expected expression with side- effect
/w14619 # pragma warning: there is no warning number 'number'
/w14640 # Enable warning on thread un-safe static member initialization
/w14826 # Conversion from 'type1' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
/w14826 # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
/w14905 # wide string literal cast to 'LPSTR'
/w14906 # string literal cast to 'LPWSTR'
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
Expand Down Expand Up @@ -67,6 +67,7 @@ function(
-Wduplicated-branches # warn if if / else branches have duplicated code
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
-Wuseless-cast # warn if you perform a cast to the same type
-Wsuggest-override # warn if an overridden member function is not marked 'override' or 'final'
)
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/Cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ macro(myproject_target_link_cuda target)
if(WIN32 AND "$ENV{VSCMD_VER}" STREQUAL "")
message(
WARNING
"Compiling Cuda on Windows outside the Visual Studio Commant prompt or without running `vcvarsall.bat x64` probably fails"
"Compiling CUDA on Windows outside the Visual Studio Command prompt or without running `vcvarsall.bat x64` probably fails"
)
endif()
endmacro()
2 changes: 1 addition & 1 deletion cmake/Linker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ macro(myproject_configure_linker project_name)
"Using custom linker: '${USER_LINKER_OPTION}', explicitly supported entries are ${USER_LINKER_OPTION_VALUES}")
endif()

if(NOT ENABLE_USER_LINKER)
if(NOT myproject_ENABLE_USER_LINKER)
return()
endif()

Expand Down
5 changes: 4 additions & 1 deletion cmake/StaticAnalyzers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ macro(myproject_enable_cppcheck WARNINGS_AS_ERRORS CPPCHECK_OPTIONS)
if("${CPPCHECK_OPTIONS}" STREQUAL "")
# Enable all warnings that are actionable by the user of this toolset
# style should enable the other 3, but we'll be explicit just in case
set(SUPPRESS_DIR "*:${CMAKE_CURRENT_BINARY_DIR}/_deps/*.h")
message(STATUS "CPPCHECK_OPTIONS suppress: ${SUPPRESS_DIR}")
set(CMAKE_CXX_CPPCHECK
${CPPCHECK}
--template=${CPPCHECK_TEMPLATE}
Expand All @@ -26,7 +28,8 @@ macro(myproject_enable_cppcheck WARNINGS_AS_ERRORS CPPCHECK_OPTIONS)
# ignores code that cppcheck thinks is invalid C++
--suppress=syntaxError
--suppress=preprocessorErrorDirective
--inconclusive)
--inconclusive
--suppress=${SUPPRESS_DIR})
else()
# if the user provides a CPPCHECK_OPTIONS with a template specified, it will override this template
set(CMAKE_CXX_CPPCHECK ${CPPCHECK} --template=${CPPCHECK_TEMPLATE} ${CPPCHECK_OPTIONS})
Expand Down
2 changes: 1 addition & 1 deletion cmake/Utilities.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# find a subtring from a string by a given prefix such as VCVARSALL_ENV_START
# find a substring from a string by a given prefix such as VCVARSALL_ENV_START
function(
find_substring_by_prefix
output
Expand Down
2 changes: 1 addition & 1 deletion cmake/VCEnvironment.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ macro(detect_architecture)
set(VCVARSALL_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
else()
set(VCVARSALL_ARCH x64)
message(STATUS "Unkown architecture CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR_LOWER} - using x64")
message(STATUS "Unknown architecture CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR_LOWER} - using x64")
endif()
endif()
endmacro()
Expand Down
20 changes: 20 additions & 0 deletions gcovr.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = .
search-path = out

filter = src/*
filter = include/*

exclude-directories = install
exclude-directories = out/*/*/_deps
exclude-directories = test
exclude-directories = fuzz_test

gcov-ignore-parse-errors = yes
print-summary = yes

html-details = ./out/coverage/index.html

cobertura-pretty = yes
cobertura = out/cobertura.xml

#TBD delete-gcov-files = yes
Empty file added out/coverage/.keep
Empty file.
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if(PROJECT_IS_TOP_LEVEL OR TEST_INSTALLED_VERSION)
find_package(myproject CONFIG REQUIRED) # for intro, project_options, ...

if(NOT TARGET myproject_options)
message(FATAL_ERROR "Requiered config package not found!")
message(FATAL_ERROR "Required config package not found!")
return() # be strictly paranoid for Template Janitor github action! CK
endif()
endif()
Expand Down

0 comments on commit b8e3946

Please sign in to comment.