Coder Social home page Coder Social logo

afv's Introduction

afv GitHub Build status

Template set up with basic infrastructure for C++ projects.

Building

Necessary build tools are:

  • CMake 3.27 or higher
  • Conan 2.0 or higher
  • One of supported compilers:
    • Clang-17
    • GCC-13
    • Visual Studio 2022 (MSVC v193)

Install dependencies

conan install . --profile=conan/clang-17 --build=missing --settings build_type=Release
  • Conan profiles for supported compilers: gcc-13, clang-17 and msvc-2022
  • Conan build types: Release, Debug

Configure, build and test

cmake --preset release
cmake --build --preset=release

Disable building of tests by:

  • Adding --conf tools.build:skip_test=True to conan install command
  • Adding -DBUILD_TESTING=OFF during CMake configure

Building of tests is enabled by default. Execute the tests with the following command:

ctest --preset release

Use the preset matching the build type used when installing dependencies. When compiling with MSVC or using some other multi configuration generator use multi-debug or multi-release presets.

Additional tools

ClangFormat

Enable running clang-format automatically on all source files during build by adding -DAFV_ENABLE_CLANG_FORMAT=ON during CMake configure. This option is disabled by default.

Additional compilation options

Toolchain hardening

Enable toolchain security hardening compiler options, by adding an additional profile to the conan install command, together with --build=* to recompile dependencies with hardening enabled. The hardening options should only be used with Release build type. This option is disabled by default.

conan install . --profile=conan/clang-17 --profile=conan/opt/linux-hardening --build=* --settings build_type=Release
  • Conan profiles for toolchain hardening are: linux-hardening and msvc-hardening

Sanitizers

Enable sanitizers by adding an additional profile to the conan install command, together with --build=* to recompile dependencies with santizers enabled. Sanitizers should only be used with Release build type. These options are disabled by default.

conan install . --profile=conan/clang-17 --profile=conan/opt/linux-address-sanitizer --build=* --settings build_type=Release
  • Conan profiles for Clang and GCC sanitizers are: linux-address-sanitizer, linux-leak-sanitizer, linux-thread-sanitizer, linux-undefined-sanitizer
    • Thread sanitizer cannot be used in combination with any other sanitizer
  • Conan profile for MSVC compiler is: msvc-address-sanitizer
    • Run the compiled executables from the developer command prompt, or execute call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 to correctly set up search paths for runtime libraries

Static analysis

ClangTidy

Enable running clang-tidy automatically on all source files during build by adding -DAFV_ENABLE_CLANG_TIDY=ON during CMake configure. This option is disabled by default.

Compiler static analysis

Enable compiler flags for static analysis during build by adding -DAFV_ENABLE_COMPILER_STATIC_ANALYSIS=ON during CMake configure. This option is disabled by default.

  • Compiler static analysis is supported for GCC and MSVC compilers

include-what-you-use

Enable running of include-what-you-use automatically on all source files during build by adding -DAFV_ENABLE_IWYU=ON during CMake configure. This option is disabled by default.

Cppcheck

Enable running of cppcheck automatically on all source files during build by adding -DAFV_ENABLE_CPPCHECK=ON during CMake configure. This option is disabled by default.

afv's People

Contributors

jan-kelemen avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.