- cpp_practice
Practice C++ 20
- List all
- the major technologies
- you used in your project
- here
Current list:
- C++ 20
- Third Party Tools:
- CPM
- CMake package management
- fmt
- Formatted printing
- spdlog
- Logging
- CLI11
- Command line interface and argument parser
- GSL: Guidelines Support Library
- Helping adhere to the C++ Core Guidelines
- Abseil
- Helping to adhere to the Google C++ styleguide
- CPM
- Tools to help enhance the quality of the code:
- Google Test
- Unit testing
- Google Benchmark
- Micro-benchmarking runtime performance
- pre-commit
- Helping ensure adherence to a common styleguide for other text based (non C++)
- clang-format
- Helping ensure adherence to a common C++ styleguide
- clang-tidy
- Static analyzer to help to enforce coding standards such as
- cppcheck
- Additional static analyzer
- codeql
- Additional static analyzer to help ensure secure code
- codacy
- Additional static analyzer to help ensure secure code and monitor test code coverage
- Google Test
Note about install commands:
- In case of an error in cmake, make sure that the dependencies are on the PATH.
- Currently the instructions are only for Debian/Ubuntu Linux; We hope to add additional operating systems in the future.
We have a Docker image that's already set up for you. See the
-
A C++ compiler that supports nearly all of C++17 and most of C++20.
-
See C++ Reference to see which features are supported by each compiler. The following compilers should work:
-
gcc 12+ Install command
-
Debian/Ubuntu:
sudo apt-get install build-essential gcovr gcc-12 g++-12 gcc-12-doc
-
-
clang 16+ Install command
-
Debian/Ubuntu:
wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 16 all
-
-
-
CMake 3.25+ Install Command
-
Debian/Ubuntu:
sudo apt-get install cmake
-
-
ninja Install Command
- A small build system with a focus on speed
sudo apt-get install ninja-build
-
Doxygen 1.9.7
-
Generate API documentation from source code
-
Debian/Ubuntu:
sudo apt-get install graphviz texlive-latex-extra ghostscript wget https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz \ mkdir -p "${HOME}/.local" \ tar -xC "${HOME}/.local" -f doxygen-1.9.7.linux.bin.tar.gz \ rm doxygen-1.9.7.linux.bin.tar.gz \ echo "export PATH=\"${HOME}/.local/doxygen-1.9.7/bin:${PATH}\"" >> "${HOME}/.bashrc" \ export PATH="${HOME}/.local/doxygen-1.9.7/bin:${PATH}" \
-
-
-
Compiler cache
-
Debian/Ubuntu:
sudo apt-get install ccache
-
-
-
C/C++ static analysis tool
-
Debian/Ubuntu:
sudo apt-get install cppcheck
-
Windows: Download latest version and install: cppcheck
-
-
- a helper library to program the performance monitoring event
sudo apt-get install libpfm4
-
- Optimize usage of
#include
C & C++ instructions - Follow instructions here: install: include what you use
- Optimize usage of
-
This is a great place
-
to list setup instructions
-
in a simple
-
easy-to-understand
-
format
-
This is a great place
-
to list setup instructions
-
in a simple
-
easy-to-understand
-
format
By default (if you don't set environment variables CC
and CXX
), the system
default compiler will be used. For Debian/Ubuntu this is usually the default
version of GCC.
CMake uses the environment variables CC
and CXX
to decide which compiler to
use. So to avoid the conflict issues only specify the compilers using these
variables.
-
Debian/Ubuntu Set your desired compiler (
clang
,gcc
, etc):-
Temporarily (only for the current shell)
-
Run one of the following in the terminal:
- clang
CC=clang CXX=clang++
- gcc (usually the default; however, if not, then...)
CC=gcc CXX=g++
-
Permanent:
-
Open
~/.bashrc
using your text editor:gedit ~/.bashrc
-
Add
CC
andCXX
to point to the compilers:export CC=clang export CXX=clang++
-
Save and close the file
-
To configure the project, you could use cmake
, or ccmake
or cmake-gui
. It
is assumed the user knows how to build software.
You can use the ctest
command run the tests.
cd ./build
ctest -C Debug
cd ../
- Provide any additional details
- concerning testing your project
- or other special build options
- such as building documentation,
- etc.
If you have Docker installed, you can run this in your terminal, when the
Dockerfile is inside the .devcontainer
directory:
docker build -f ./.devcontainer/Dockerfile --tag=my_project:latest .
docker run -it my_project:latest
- Provide additional instructions
- for building the docker project
- and definitely modify the dockerfile
- for your specific project
- Any known issues
- should go here
- If your project allows third
- party contributors, then list
- the rules and instructions here
- with a links to
- CONTRIBUTING.md which contains rules & instructors for contributors
- CONTRIBUTORS.md which is an autogenerated list of contributors from a tool like all-contributor
- List which license you are utilizing
- for your project
- provide a link to the LICENSE.md
- file for your project