diff --git a/.github/actions/setup_cache/action.yml b/.github/actions/setup_cache/action.yml index 3291fce9..80ae4745 100644 --- a/.github/actions/setup_cache/action.yml +++ b/.github/actions/setup_cache/action.yml @@ -2,16 +2,10 @@ name: 'setup_cache' description: 'sets up the shared cache' inputs: - compiler: + configure_preset: required: true type: string - build_type: - required: true - type: string - generator: - required: true - type: string - developer_mode: + build_preset: required: true type: string @@ -32,7 +26,7 @@ runs: ${{ env.XDG_CACHE_HOME }}/vcpkg/archives ${{ env.LOCALAPPDATA }}\vcpkg\archives ${{ env.APPDATA }}\vcpkg\archives - key: ${{ runner.os }}-${{ inputs.compiler }}-${{ inputs.build_type }}-${{ hashFiles('./conanfile.txt')}}-${{ inputs.generator }}-${{ inputs.developer_mode }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}} + key: ${{ runner.os }}-${{ inputs.configure_preset }}-${{ inputs.build_preset }}-${{ hashFiles('./conanfile.txt')}}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}} restore-keys: | - ${{ runner.os }}-${{ inputs.compiler }}-${{ inputs.build_type }}-${{ hashFiles('./conanfile.txt') }} + ${{ runner.os }}-${{ inputs.configure_preset }}-${{ inputs.build_preset }}-${{ hashFiles('./conanfile.txt') }} diff --git a/.github/template/template_name b/.github/template/template_name index b4857fcb..9f9b489e 100644 --- a/.github/template/template_name +++ b/.github/template/template_name @@ -1 +1 @@ -cmake_conan_boilerplate_template +cpp_boilerplate_project diff --git a/.github/template/template_repository b/.github/template/template_repository index efbdeb18..fc9336c3 100644 --- a/.github/template/template_repository +++ b/.github/template/template_repository @@ -1 +1 @@ -cpp-best-practices/cmake_conan_boilerplate_template +Jason5480/cpp_boilerplate_project diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff341bd5..ba66585e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ on: env: # Conan cache environment variables CONAN_SYSREQUIRES_MODE: enabled + CONAN_REVISIONS_ENABLED: 1 CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" CLANG_TIDY_VERSION: "13.0.0" @@ -46,6 +47,32 @@ jobs: developer_mode: - ON - OFF + configure_preset: + - windows-msvc-dev + - windows-clang-dev + - unixlike-gcc-dev + - unixlike-clang-dev + - windows-msvc-usr + - windows-clang-usr + - unixlike-gcc-usr + - unixlike-clang-usr + build_test_preset: + - windows-msvc-dev-debug + - windows-msvc-dev-release + - windows-clang-dev-debug + - windows-clang-dev-release + - unixlike-gcc-dev-debug + - unixlike-gcc-dev-release + - unixlike-clang-dev-debug + - unixlike-clang-dev-release + - windows-msvc-usr-debug + - windows-msvc-usr-release + - windows-clang-usr-debug + - windows-clang-usr-release + - unixlike-gcc-usr-debug + - unixlike-gcc-usr-release + - unixlike-clang-usr-debug + - unixlike-clang-usr-release exclude: # mingw is determined by this author to be too buggy to support @@ -113,10 +140,8 @@ jobs: - name: Setup Cache uses: ./.github/actions/setup_cache with: - compiler: ${{ matrix.compiler }} - build_type: ${{ matrix.build_type }} - developer_mode: ${{ matrix.developer_mode }} - generator: ${{ matrix.generator }} + configure_preset: ${{ matrix.configure_preset }} + build_preset: ${{ matrix.build_test_preset }} - name: Setup Cpp uses: aminya/setup-cpp@v1 @@ -131,7 +156,6 @@ jobs: ccache: true clangtidy: ${{ env.CLANG_TIDY_VERSION }} - cppcheck: true gcovr: true @@ -145,12 +169,12 @@ jobs: # has meaningful results - name: Configure CMake run: | - cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }} + cmake -S . --preset="${{matrix.configure_preset}}" -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }} - name: Build # Execute the build. You can specify a specific target with "--target " run: | - cmake --build ./build --config ${{matrix.build_type}} + cmake --build ./build --preset=${{matrix.build_test_preset}} - name: Unix - Test and coverage if: runner.os != 'Windows' @@ -158,14 +182,14 @@ jobs: # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: | - ctest -C ${{matrix.build_type}} + ctest -C --preset=${{matrix.build_test_preset}} gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' - name: Windows - Test and coverage if: runner.os == 'Windows' working-directory: ./build run: | - OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}} + OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C --preset=${{matrix.build_test_preset}} - name: CPack if: matrix.package_generator != '' @@ -180,7 +204,6 @@ jobs: files: | build/*-*${{ matrix.build_type }}*-*.* - - name: Publish to codecov uses: codecov/codecov-action@v2 with: diff --git a/CMakePresets.json b/CMakePresets.json index 5871489e..0a717477 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,18 +7,17 @@ }, "configurePresets": [ { - "name": "conf-common", - "description": "General settings that apply to all configurations", + "name": "ninja_multi", + "description": "Generator settings that apply to all configurations", "hidden": true, - "generator": "Ninja", + "generator": "Ninja Multi-Config", "binaryDir": "${sourceDir}/out/build/${presetName}", "installDir": "${sourceDir}/out/install/${presetName}" }, { - "name": "conf-windows-common", + "name": "windows", "description": "Windows settings for MSBuild toolchain that apply to msvc and clang", "hidden": true, - "inherits": "conf-common", "condition": { "type": "equals", "lhs": "${hostSystemName}", @@ -33,15 +32,14 @@ "strategy": "external" }, "cacheVariables": { - "ENABLE_CPPCHECK_DEFAULT": "FALSE", - "ENABLE_CLANG_TIDY_DEFAULT": "FALSE" + "ENABLE_CPPCHECK_DEFAULT": false, + "ENABLE_CLANG_TIDY_DEFAULT": false } }, { - "name": "conf-unixlike-common", - "description": "Unix-like OS settings for gcc and clang toolchains", + "name": "unixlike", + "description": "Unixlike OS settings for gcc and clang toolchains", "hidden": true, - "inherits": "conf-common", "condition": { "type": "inList", "string": "${hostSystemName}", @@ -57,133 +55,363 @@ } }, { - "name": "windows-msvc-debug-developer-mode", - "displayName": "msvc Debug (Developer Mode)", - "description": "Target Windows with the msvc compiler, debug build type", - "inherits": "conf-windows-common", + "name": "msvc", + "description": "Set cl as the compiler to be used", + "hidden": true, "cacheVariables": { "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl", - "CMAKE_BUILD_TYPE": "Debug", - "ENABLE_DEVELOPER_MODE": "ON" + "CMAKE_CXX_COMPILER": "cl" } }, { - "name": "windows-msvc-release-developer-mode", - "displayName": "msvc Release (Developer Mode)", - "description": "Target Windows with the msvc compiler, release build type", - "inherits": "conf-windows-common", + "name": "clang_cl", + "description": "Set clang-cl as the compiler to be used", + "hidden": true, "cacheVariables": { - "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl", - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "ENABLE_DEVELOPER_MODE": "ON" + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "intelliSenseMode": "windows-clang-x64" + } } }, { - "name": "windows-msvc-debug-user-mode", - "displayName": "msvc Debug (User Mode)", - "description": "Target Windows with the msvc compiler, debug build type", - "inherits": "conf-windows-common", + "name": "gcc", + "description": "Set gcc as the compiler to be used", + "hidden": true, "cacheVariables": { - "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl", - "CMAKE_BUILD_TYPE": "Debug", - "ENABLE_DEVELOPER_MODE": "OFF" + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++" } }, { - "name": "windows-msvc-release-user-mode", - "displayName": "msvc Release (User Mode)", - "description": "Target Windows with the msvc compiler, release build type", - "inherits": "conf-windows-common", + "name": "clang", + "description": "Set clang as the compiler to be used", + "hidden": true, "cacheVariables": { - "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl", - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "ENABLE_DEVELOPER_MODE": "OFF" + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" } }, { - "name": "windows-clang-debug", - "displayName": "clang Debug", - "description": "Target Windows with the clang compiler, debug build type", - "inherits": "conf-windows-common", + "name": "dev", + "description": "Set the flags to enable the Developer Mode", + "hidden": true, "cacheVariables": { - "CMAKE_C_COMPILER": "clang-cl", - "CMAKE_CXX_COMPILER": "clang-cl", - "CMAKE_BUILD_TYPE": "Debug" - }, - "vendor": { - "microsoft.com/VisualStudioSettings/CMake/1.0": { - "intelliSenseMode": "windows-clang-x64" - } + "ENABLE_DEVELOPER_MODE": true } }, { - "name": "windows-clang-release", - "displayName": "clang Release", - "description": "Target Windows with the clang compiler, release build type", - "inherits": "conf-windows-common", + "name": "usr", + "description": "Set the flags to enable the User Mode", + "hidden": true, "cacheVariables": { - "CMAKE_C_COMPILER": "clang-cl", - "CMAKE_CXX_COMPILER": "clang-cl", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - }, - "vendor": { - "microsoft.com/VisualStudioSettings/CMake/1.0": { - "intelliSenseMode": "windows-clang-x64" - } + "ENABLE_DEVELOPER_MODE": false } }, { - "name": "unixlike-gcc-debug", - "displayName": "gcc Debug", - "description": "Target Unix-like OS with the gcc compiler, debug build type", - "inherits": "conf-unixlike-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "gcc", - "CMAKE_CXX_COMPILER": "g++", - "CMAKE_BUILD_TYPE": "Debug" - } + "name": "windows-msvc-dev", + "displayName": "msvc", + "description": "Target Windows with the msvc compiler (Developer Mode)", + "inherits": [ + "ninja_multi", + "windows", + "msvc", + "dev" + ] }, { - "name": "unixlike-gcc-release", - "displayName": "gcc Release", - "description": "Target Unix-like OS with the gcc compiler, release build type", - "inherits": "conf-unixlike-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "gcc", - "CMAKE_CXX_COMPILER": "g++", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - } + "name": "windows-clang-dev", + "displayName": "clang", + "description": "Target Windows with the clang compiler (Developer Mode)", + "inherits": [ + "ninja_multi", + "windows", + "clang_cl", + "dev" + ] }, { - "name": "unixlike-clang-debug", - "displayName": "clang Debug", - "description": "Target Unix-like OS with the clang compiler, debug build type", - "inherits": "conf-unixlike-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_BUILD_TYPE": "Debug" + "name": "unixlike-gcc-dev", + "displayName": "gcc", + "description": "Target unixlike OS with the gcc compiler (Developer Mode)", + "inherits": [ + "ninja_multi", + "unixlike", + "gcc", + "dev" + ] + }, + { + "name": "unixlike-clang-dev", + "displayName": "clang", + "description": "Target unixlike OS with the clang compiler (Developer Mode)", + "inherits": [ + "ninja_multi", + "unixlike", + "clang", + "dev" + ] + }, + { + "name": "windows-msvc-usr", + "displayName": "msvc", + "description": "Target Windows with the msvc compiler (User Mode)", + "inherits": [ + "ninja_multi", + "windows", + "msvc", + "usr" + ] + }, + { + "name": "windows-clang-usr", + "displayName": "clang", + "description": "Target Windows with the clang compiler (User Mode)", + "inherits": [ + "ninja_multi", + "windows", + "clang_cl", + "usr" + ] + }, + { + "name": "unixlike-gcc-usr", + "displayName": "gcc", + "description": "Target unixlike OS with the gcc compiler (User Mode)", + "inherits": [ + "ninja_multi", + "unixlike", + "gcc", + "usr" + ] + }, + { + "name": "unixlike-clang-usr", + "displayName": "clang", + "description": "Target unixlike OS with the clang compiler (User Mode)", + "inherits": [ + "ninja_multi", + "unixlike", + "clang", + "usr" + ] + } + ], + "buildPresets": [ + { + "name": "windows", + "description": "Windows build settings", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } }, { - "name": "unixlike-clang-release", - "displayName": "clang Release", - "description": "Target Unix-like OS with the clang compiler, release build type", - "inherits": "conf-unixlike-common", - "cacheVariables": { - "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" + "name": "unixlike", + "description": "Unixlike OS build settings", + "hidden": true, + "condition": { + "type": "inList", + "string": "${hostSystemName}", + "list": [ + "Linux", + "Darwin" + ] } + }, + { + "name": "debug", + "description": "Set build type to Debug", + "hidden": true, + "configuration": "Debug" + }, + { + "name": "release", + "description": "Set build type to Release", + "hidden": true, + "configuration": "Release" + }, + { + "name": "relwithdebinfo", + "description": "Set build type to RelWithDebInfo", + "hidden": true, + "configuration": "RelWithDebInfo" + }, + { + "name": "minsizerel", + "description": "Set build type to MinSizeRel", + "hidden": true, + "configuration": "MinSizeRel" + }, + { + "name": "windows-msvc-dev-debug", + "displayName": "Debug", + "description": "Build msvc debug on windows", + "inherits": [ + "windows", + "debug" + ], + "configurePreset": "windows-msvc-dev" + }, + { + "name": "windows-msvc-dev-release", + "displayName": "Release", + "description": "Build msvc release on windows", + "inherits": [ + "windows", + "release" + ], + "configurePreset": "windows-msvc-dev" + }, + { + "name": "windows-clang-dev-debug", + "displayName": "Debug", + "description": "Build clang debug on windows", + "inherits": [ + "windows", + "debug" + ], + "configurePreset": "windows-clang-dev" + }, + { + "name": "windows-clang-dev-release", + "displayName": "Release", + "description": "Build clang release on windows", + "inherits": [ + "windows", + "release" + ], + "configurePreset": "windows-clang-dev" + }, + { + "name": "unixlike-gcc-dev-debug", + "displayName": "Debug", + "description": "Build gcc debug on unixlike OS", + "inherits": [ + "unixlike", + "debug" + ], + "configurePreset": "unixlike-gcc-dev" + }, + { + "name": "unixlike-gcc-dev-release", + "displayName": "Release", + "description": "Build gcc release on unixlike OS", + "inherits": [ + "unixlike", + "release" + ], + "configurePreset": "unixlike-gcc-dev" + }, + { + "name": "unixlike-clang-dev-debug", + "displayName": "Debug", + "description": "Build clang debug on unixlike OS", + "inherits": [ + "unixlike", + "debug" + ], + "configurePreset": "unixlike-clang-dev" + }, + { + "name": "unixlike-clang-dev-release", + "displayName": "Release", + "description": "Build clang release on unixlike OS", + "inherits": [ + "unixlike", + "release" + ], + "configurePreset": "unixlike-clang-dev" + }, + { + "name": "windows-msvc-usr-debug", + "displayName": "Debug", + "description": "Build msvc debug on windows", + "inherits": [ + "windows", + "debug" + ], + "configurePreset": "windows-msvc-usr" + }, + { + "name": "windows-msvc-usr-release", + "displayName": "Release", + "description": "Build msvc release on windows", + "inherits": [ + "windows", + "release" + ], + "configurePreset": "windows-msvc-usr" + }, + { + "name": "windows-clang-usr-debug", + "displayName": "Debug", + "description": "Build clang debug on windows", + "inherits": [ + "windows", + "debug" + ], + "configurePreset": "windows-clang-usr" + }, + { + "name": "windows-clang-usr-release", + "displayName": "Release", + "description": "Build clang release on windows", + "inherits": [ + "windows", + "release" + ], + "configurePreset": "windows-clang-usr" + }, + { + "name": "unixlike-gcc-usr-debug", + "displayName": "Debug", + "description": "Build gcc debug on unixlike OS", + "inherits": [ + "unixlike", + "debug" + ], + "configurePreset": "unixlike-gcc-usr" + }, + { + "name": "unixlike-gcc-usr-release", + "displayName": "Release", + "description": "Build gcc release on unixlike OS", + "inherits": [ + "unixlike", + "release" + ], + "configurePreset": "unixlike-gcc-usr" + }, + { + "name": "unixlike-clang-usr-debug", + "displayName": "Debug", + "description": "Build clang debug on unixlike OS", + "inherits": [ + "unixlike", + "debug" + ], + "configurePreset": "unixlike-clang-usr" + }, + { + "name": "unixlike-clang-usr-release", + "displayName": "Release", + "description": "Build clang release on unixlike OS", + "inherits": [ + "unixlike", + "release" + ], + "configurePreset": "unixlike-clang-usr" } ], "testPresets": [ { - "name": "test-common", + "name": "ninja_multi", "description": "Test CMake settings that apply to all configurations", "hidden": true, "output": { @@ -195,60 +423,215 @@ } }, { - "name": "test-windows-msvc-debug-developer-mode", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-msvc-debug-developer-mode" + "name": "windows", + "description": "Windows test settings", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "unixlike", + "description": "Unixlike OS test settings", + "hidden": true, + "condition": { + "type": "inList", + "string": "${hostSystemName}", + "list": [ + "Linux", + "Darwin" + ] + } + }, + { + "name": "debug", + "description": "Test CMake settings that apply to debug configurations", + "hidden": true, + "configuration": "Debug" + }, + { + "name": "release", + "description": "Test CMake settings that apply to release configurations", + "hidden": true, + "configuration": "Release" + }, + { + "name": "windows-msvc-dev-debug", + "displayName": "Debug", + "description": "Set Strict rules for windows msvc debug tests", + "inherits": [ + "ninja_multi", + "windows", + "debug" + ], + "configurePreset": "windows-msvc-dev" + }, + { + "name": "windows-msvc-dev-release", + "displayName": "Release", + "description": "Set Strict rules for windows msvc release tests", + "inherits": [ + "ninja_multi", + "windows", + "release" + ], + "configurePreset": "windows-msvc-dev" + }, + { + "name": "windows-clang-dev-debug", + "displayName": "Debug", + "description": "Set Strict rules for windows clang debug tests", + "inherits": [ + "ninja_multi", + "windows", + "debug" + ], + "configurePreset": "windows-clang-dev" + }, + { + "name": "windows-clang-dev-release", + "displayName": "Release", + "description": "Set Strict rules for windows clang release tests", + "inherits": [ + "ninja_multi", + "windows", + "release" + ], + "configurePreset": "windows-clang-dev" + }, + { + "name": "unixlike-gcc-dev-debug", + "displayName": "Debug", + "description": "Set Strict rules for unixlike gcc debug tests", + "inherits": [ + "ninja_multi", + "unixlike", + "debug" + ], + "configurePreset": "unixlike-gcc-dev" + }, + { + "name": "unixlike-gcc-dev-release", + "displayName": "Release", + "description": "Set Strict rules for unixlike gcc release tests", + "inherits": [ + "ninja_multi", + "unixlike", + "release" + ], + "configurePreset": "unixlike-gcc-dev" + }, + { + "name": "unixlike-clang-dev-debug", + "displayName": "Debug", + "description": "Set Strict rules for unixlike clang debug tests", + "inherits": [ + "ninja_multi", + "unixlike", + "debug" + ], + "configurePreset": "unixlike-clang-dev" + }, + { + "name": "unixlike-clang-dev-release", + "displayName": "Release", + "description": "Set Strict rules for unixlike clang release tests", + "inherits": [ + "ninja_multi", + "unixlike", + "release" + ], + "configurePreset": "unixlike-clang-dev" + }, + { + "name": "windows-msvc-usr-debug", + "displayName": "Debug", + "description": "Set Strict rules for windows msvc debug tests", + "inherits": [ + "ninja_multi", + "windows", + "debug" + ], + "configurePreset": "windows-msvc-usr" }, { - "name": "test-windows-msvc-release-developer-mode", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-msvc-release-developer-mode" + "name": "windows-msvc-usr-release", + "displayName": "Release", + "description": "Set Strict rules for windows msvc release tests", + "inherits": [ + "ninja_multi", + "windows", + "release" + ], + "configurePreset": "windows-msvc-usr" }, { - "name": "test-windows-clang-debug", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-clang-debug" + "name": "windows-clang-usr-debug", + "displayName": "Debug", + "description": "Set Strict rules for windows clang debug tests", + "inherits": [ + "ninja_multi", + "windows", + "debug" + ], + "configurePreset": "windows-clang-usr" }, { - "name": "test-windows-clang-release", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "windows-clang-release" + "name": "windows-clang-usr-release", + "displayName": "Release", + "description": "Set Strict rules for windows clang release tests", + "inherits": [ + "ninja_multi", + "windows", + "release" + ], + "configurePreset": "windows-clang-usr" }, { - "name": "test-unixlike-gcc-debug", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "unixlike-gcc-debug" + "name": "unixlike-gcc-usr-debug", + "displayName": "Debug", + "description": "Set Strict rules for unixlike gcc debug tests", + "inherits": [ + "ninja_multi", + "unixlike", + "debug" + ], + "configurePreset": "unixlike-gcc-usr" }, { - "name": "test-unixlike-gcc-release", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "unixlike-gcc-release" + "name": "unixlike-gcc-usr-release", + "displayName": "Release", + "description": "Set Strict rules for unixlike gcc release tests", + "inherits": [ + "ninja_multi", + "unixlike", + "release" + ], + "configurePreset": "unixlike-gcc-usr" }, { - "name": "test-unixlike-clang-debug", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "unixlike-clang-debug" + "name": "unixlike-clang-usr-debug", + "displayName": "Debug", + "description": "Set Strict rules for unixlike clang debug tests", + "inherits": [ + "ninja_multi", + "unixlike", + "debug" + ], + "configurePreset": "unixlike-clang-usr" }, { - "name": "test-unixlike-clang-release", - "displayName": "Strict", - "description": "Enable output and stop on failure", - "inherits": "test-common", - "configurePreset": "unixlike-clang-release" + "name": "unixlike-clang-usr-release", + "displayName": "Release", + "description": "Set Strict rules for unixlike clang release tests", + "inherits": [ + "ninja_multi", + "unixlike", + "release" + ], + "configurePreset": "unixlike-clang-usr" } ] } \ No newline at end of file diff --git a/README.md b/README.md index 8b9af443..0aa24486 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# cmake_conan_boilerplate_template +# cpp_boilerplate_project -[![ci](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/ci.yml) -[![codecov](https://codecov.io/gh/cpp-best-practices/cmake_conan_boilerplate_template/branch/main/graph/badge.svg)](https://codecov.io/gh/cpp-best-practices/cmake_conan_boilerplate_template) -[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/cpp-best-practices/cmake_conan_boilerplate_template)](https://lgtm.com/projects/g/cpp-best-practices/cmake_conan_boilerplate_template/context:cpp) -[![CodeQL](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cpp-best-practices/cmake_conan_boilerplate_template/actions/workflows/codeql-analysis.yml) +[![ci](https://github.com/Jason5480/cpp_boilerplate_project/actions/workflows/ci.yml/badge.svg)](https://github.com/Jason5480/cpp_boilerplate_project/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/Jason5480/cpp_boilerplate_project/branch/main/graph/badge.svg)](https://codecov.io/gh/Jason5480/cpp_boilerplate_project) +[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/Jason5480/cpp_boilerplate_project)](https://lgtm.com/projects/g/Jason5480/cpp_boilerplate_project/context:cpp) +[![CodeQL](https://github.com/Jason5480/cpp_boilerplate_project/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Jason5480/cpp_boilerplate_project/actions/workflows/codeql-analysis.yml) -## About cmake_conan_boilerplate_template +## About cpp_boilerplate_project This is a C++ Best Practices GitHub template for getting up and running with C++ quickly. @@ -36,7 +36,7 @@ Ths Boilerplate project will merge new features first, then they will be merged ### 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_conan_boilerplate_template/generate) page. +This will take you to Github's ['Generate Repository'](https://github.com/Jason5480/cpp_boilerplate_project/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, prepopulated with the contents of this project. diff --git a/README_building.md b/README_building.md index b4a4b9bd..09a00660 100644 --- a/README_building.md +++ b/README_building.md @@ -94,10 +94,22 @@ With Cmake directly: Cmake will automatically create the `./build` folder if it does not exist, and it wil configure the project. -Instead, if you have CMake version 3.21+, you can use one of the configuration presets that are listed in the CmakePresets.json file. +Instead, if you have CMake version 3.21+, you can use one of the configuration presets that are listed in the CMakePresets.json file. - cmake . --preset - cmake --build + cmake . --list-presets=all + +Given that list you can configure, build and test the project with the following commands. + + cmake -S . --preset= + cmake --build --preset= + ctest --build --preset= + +where the possible values of the configure, build and test preset names can be found in the CMakePresets.json and CMakeUserPresets.json files in the root folder. +e.g. For a Linux system you can use: + + cmake --preset=unixlike-gcc-usr + cmake --build --preset=unixlike-gcc-debug-usr + ctest --build --preset=unixlike-gcc-debug-usr #### (2.b) Configuring via ccmake: