From 5b8635dd4c81c0d2adab4de21f2cfe576f9bc3ed Mon Sep 17 00:00:00 2001 From: Template Janitor Date: Sun, 22 May 2022 10:25:26 +0000 Subject: [PATCH 1/6] Change Template Name --- .github/template/template_name | 2 +- .github/template/template_repository | 2 +- README.md | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) 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/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. From a5e6e8f4fe35ed01f746d48e1b540f7bf4387c45 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Fri, 23 Dec 2022 22:07:49 +0000 Subject: [PATCH 2/6] Update ubuntu default docker variant to jammy (22.04 LTS). Pump gcc default version to 12. Pump LLVM default version to 15. Update Readme --- .devcontainer/Dockerfile | 14 +++++--------- .devcontainer/devcontainer.json | 12 ++++++------ README_docker.md | 24 ++++++++++++------------ 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e948180e..4441a4b4 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ -# [Choice] bionic (18.04), focal (20.04) -ARG VARIANT="focal" +# [Choice] bionic (18.04), focal (20.04), jammy (22.04) +ARG VARIANT="jammy" FROM ubuntu:${VARIANT} # Restate the variant to use it later on in the llvm and cmake installations @@ -28,9 +28,9 @@ ENV CONAN_SYSREQUIRES_SUDO 0 ENV CONAN_SYSREQUIRES_MODE enabled # User-settable versions: -# This Dockerfile should support gcc-[7, 8, 9, 10, 11] and clang-[10, 11, 12, 13] +# This Dockerfile should support gcc-[7, 8, 9, 10, 11, 12] and clang-[10, 11, 12, 13, 14, 15] # Earlier versions of clang will require significant modifications to the IWYU section -ARG GCC_VER="11" +ARG GCC_VER="12" # Add gcc-${GCC_VER} RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ @@ -41,7 +41,7 @@ RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ RUN update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100 RUN update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100 -ARG LLVM_VER="13" +ARG LLVM_VER="15" # Add clang-${LLVM_VER} ARG LLVM_URL="http://apt.llvm.org/${VARIANT}/" ARG LLVM_PKG="llvm-toolchain-${VARIANT}-${LLVM_VER}" @@ -113,8 +113,4 @@ ENV CXX=${USE_CLANG:+"clang++"} ENV CC=${CC:-"gcc"} ENV CXX=${CXX:-"g++"} -# Include project -#ADD . /workspaces/cpp_starter_project -#WORKDIR /workspaces/cpp_starter_project - CMD ["/bin/bash"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8b79bed2..d29a1bf0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,14 +4,14 @@ "name": "C++", "build": { "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick an Ubuntu OS version. Options: [bionic, focal]. Default: focal - // Update 'GCC_VER' to pick a gcc and g++ version. Options: [7, 8, 9, 10, 11]. Default: 11 - // Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13]. Default: 13 + // Update 'VARIANT' to pick an Ubuntu OS version. Options: [bionic, focal, jammy]. Default: jammy + // Update 'GCC_VER' to pick a gcc and g++ version. Options: [7, 8, 9, 10, 11, 12]. Default: 12 + // Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13, 14, 15]. Default: 15 // Update 'USE_CLANG' to set clang as the default C and C++ compiler. Options: [1, null]. Default null // "args": { - // "VARIANT": "focal", - // "GCC_VER": "11", - // "LLVM_VER": "13" + // "VARIANT": "jammy", + // "GCC_VER": "12", + // "LLVM_VER": "15" // } }, "runArgs": [ diff --git a/README_docker.md b/README_docker.md index b1f5bf52..1922e944 100644 --- a/README_docker.md +++ b/README_docker.md @@ -8,19 +8,19 @@ docker build -f ./.devcontainer/Dockerfile --tag=my_project:latest . docker run -it my_project:latest ``` -This command will put you in a `bash` session in a Ubuntu 20.04 Docker container, +This command will put you in a `bash` session in a Ubuntu 22.04 Docker container, with all of the tools listed in the [Dependencies](#dependencies) section already installed. -Additionally, you will have `g++-11` and `clang++-13` installed as the default +Additionally, you will have `g++-12` and `clang++-15` installed as the default versions of `g++` and `clang++`. If you want to build this container using some other versions of gcc and clang, you may do so with the `GCC_VER` and `LLVM_VER` arguments: ```bash -docker build --tag=myproject:latest --build-arg GCC_VER=10 --build-arg LLVM_VER=11 . +docker build --tag=myproject:latest --build-arg GCC_VER=11 --build-arg LLVM_VER=14 . ``` -The CC and CXX environment variables are set to GCC version 11 by default. +The CC and CXX environment variables are set to GCC by default. If you wish to use clang as your default CC and CXX environment variables, you may do so like this: @@ -29,7 +29,7 @@ docker build --tag=my_project:latest --build-arg USE_CLANG=1 . ``` You will be logged in as root, so you will see the `#` symbol as your prompt. -You will be in a directory that contains a copy of the `cpp_starter_project`; +You will be in a directory that contains a copy of the `cmake_conan_boilerplate_template`; any changes you make to your local copy will not be updated in the Docker image until you rebuild it. If you need to mount your local copy directly in the Docker image, see @@ -45,18 +45,18 @@ docker run -it \ You can configure and build [as directed above](#build) using these commands: ```bash -/starter_project# mkdir build -/starter_project# cmake -S . -B ./build -/starter_project# cmake --build ./build +/cmake_conan_boilerplate_template# mkdir build +/cmake_conan_boilerplate_template# cmake -S . -B ./build +/cmake_conan_boilerplate_template# cmake --build ./build ``` -You can configure and build using `clang-13`, without rebuilding the container, +You can configure and build using `clang`, without rebuilding the container, with these commands: ```bash -/starter_project# mkdir build -/starter_project# CC=clang CXX=clang++ cmake -S . -B ./build -/starter_project# cmake --build ./build +/cmake_conan_boilerplate_template# mkdir build +/cmake_conan_boilerplate_template# CC=clang CXX=clang++ cmake -S . -B ./build +/cmake_conan_boilerplate_template# cmake --build ./build ``` The `ccmake` tool is also installed; you can substitute `ccmake` for `cmake` to From 6e85777edb0e8175d2ee3e7f4e1bf3a8953e2d5e Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Thu, 29 Dec 2022 14:25:31 +0200 Subject: [PATCH 3/6] Update OS and compiler versions in the ci --- .github/workflows/auto-clang-format.yml | 4 ++-- .github/workflows/ci.yml | 28 ++++++++++++------------- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/template-janitor.yml | 4 ++-- conanfile.txt | 5 +++-- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/auto-clang-format.yml b/.github/workflows/auto-clang-format.yml index c39fb5e7..b870b74b 100644 --- a/.github/workflows/auto-clang-format.yml +++ b/.github/workflows/auto-clang-format.yml @@ -7,12 +7,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: DoozyX/clang-format-lint-action@v0.13 + - uses: DoozyX/clang-format-lint-action@v0.15 with: source: '.' exclude: './third_party ./external' extensions: 'h,cpp,hpp' - clangFormatVersion: 12 + clangFormatVersion: 15 inplace: True - uses: EndBug/add-and-commit@v4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff341bd5..8593fc40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: CONAN_SYSREQUIRES_MODE: enabled CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" - CLANG_TIDY_VERSION: "13.0.0" + CLANG_TIDY_VERSION: "15" jobs: Test: @@ -31,13 +31,13 @@ jobs: # and your own projects needs matrix: os: - - ubuntu-20.04 + - ubuntu-22.04 - macos-10.15 - windows-2019 compiler: - # you can specify the version after `-` like "llvm-13.0.0". - - llvm-13.0.0 - - gcc-11 + # you can specify the version after `-` like "llvm-15". + - llvm-15 + - gcc-12 generator: - "Ninja Multi-Config" build_type: @@ -50,14 +50,14 @@ jobs: exclude: # mingw is determined by this author to be too buggy to support - os: windows-2019 - compiler: gcc-11 + compiler: gcc-12 include: # Add appropriate variables for gcov version required. This will intentionally break # if you try to use a compiler that does not have gcov set - - compiler: gcc-11 + - compiler: gcc-12 gcov_executable: gcov - - compiler: llvm-13.0.0 + - compiler: llvm-15 gcov_executable: "llvm-cov gcov" # Set up preferred package generators, for given build configurations @@ -66,33 +66,33 @@ jobs: package_generator: TBZ2 # This exists solely to make sure a non-multiconfig build works - - os: ubuntu-20.04 - compiler: gcc-11 + - os: ubuntu-22.04 + compiler: gcc-12 generator: "Unix Makefiles" build_type: Debug gcov_executable: gcov developer_mode: On # Windows msvc builds - - os: windows-2022 + - os: windows-2019 compiler: msvc generator: "Visual Studio 17 2022" build_type: Debug developer_mode: On - - os: windows-2022 + - os: windows-2019 compiler: msvc generator: "Visual Studio 17 2022" build_type: Release developer_mode: On - - os: windows-2022 + - os: windows-2019 compiler: msvc generator: "Visual Studio 17 2022" build_type: Debug developer_mode: Off - - os: windows-2022 + - os: windows-2019 compiler: msvc generator: "Visual Studio 17 2022" build_type: Release diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 05955f2b..78f975d4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -44,7 +44,7 @@ jobs: # Learn more about CodeQL language support at https://git.io/codeql-language-support compiler: # you can specify the version after `-` like "llvm-13.0.0". - - gcc-11 + - gcc-12 generator: - "Ninja Multi-Config" build_type: diff --git a/.github/workflows/template-janitor.yml b/.github/workflows/template-janitor.yml index 61c9102d..c622047a 100644 --- a/.github/workflows/template-janitor.yml +++ b/.github/workflows/template-janitor.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: compiler: - - gcc-11 + - gcc-12 generator: - "Unix Makefiles" build_type: @@ -153,7 +153,7 @@ jobs: strategy: matrix: compiler: - - gcc-11 + - gcc-12 generator: - "Unix Makefiles" build_type: diff --git a/conanfile.txt b/conanfile.txt index a92cc590..0d2e8008 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -2,8 +2,9 @@ [requires] catch2/2.13.9 -cli11/2.2.0 -spdlog/1.10.0 +cli11/2.3.1 +spdlog/1.11.0 +zlib/1.2.13 [generators] cmake_find_package_multi From 22ad471452cdb15564daafa0ce10c7795840994f Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Sat, 31 Dec 2022 01:44:54 +0200 Subject: [PATCH 4/6] Update devcontainer.json --- .devcontainer/devcontainer.json | 48 ++++++++++++++++++--------------- conanfile.txt | 5 ++-- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d29a1bf0..0c8bfc16 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ { "name": "C++", "build": { - "dockerfile": "Dockerfile", + "dockerfile": "Dockerfile" // Update 'VARIANT' to pick an Ubuntu OS version. Options: [bionic, focal, jammy]. Default: jammy // Update 'GCC_VER' to pick a gcc and g++ version. Options: [7, 8, 9, 10, 11, 12]. Default: 12 // Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13, 14, 15]. Default: 15 @@ -19,34 +19,40 @@ "--security-opt", "seccomp=unconfined" ], - // Set *default* container specific settings.json values on container create. - "settings": { - "cmake.configureOnOpen": true, - "editor.formatOnSave": true + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "cmake.configureOnOpen": true, + "editor.formatOnSave": true + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "twxs.cmake", + "ms-vscode.cpptools-themes", + "cschlosser.doxdocgen", + "eamodio.gitlens", + "ms-python.python", + "ms-python.vscode-pylance", + "mutantdino.resourcemonitor" + ] + } }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "ms-vscode.cpptools", - "ms-vscode.cmake-tools", - "twxs.cmake", - "ms-vscode.cpptools-themes", - "cschlosser.doxdocgen", - "eamodio.gitlens", - "ms-python.python", - "ms-python.vscode-pylance", - "mutantdino.resourcemonitor" - ], // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - //"postCreateCommand": "uname -a", + // "postCreateCommand": "uname -a && gcc -v && clang -v", // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. //"remoteUser": "vscode", "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,consistency=delegated", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "features": { - "git": "latest", - "git-lfs": "latest", - "powershell": "latest" + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/devcontainers/features/powershell:1": {} } } \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt index 0d2e8008..a92cc590 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -2,9 +2,8 @@ [requires] catch2/2.13.9 -cli11/2.3.1 -spdlog/1.11.0 -zlib/1.2.13 +cli11/2.2.0 +spdlog/1.10.0 [generators] cmake_find_package_multi From ed2b8f9811fca943d8b80d1cd1fff10fbb560e92 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Sat, 31 Dec 2022 01:10:20 +0200 Subject: [PATCH 5/6] Update project options --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 324628e7..5024b804 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(OPT_WARNINGS_AS_ERRORS_DEVELOPER_DEFAULT TRUE) # Add project_options v0.20.0 # https://github.com/cpp-best-practices/project_options include(FetchContent) -FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.20.0.zip) +FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.26.3.zip) FetchContent_MakeAvailable(_project_options) include(${_project_options_SOURCE_DIR}/Index.cmake) From fd670b1b963864a57d02ce71af67b4c47295edf5 Mon Sep 17 00:00:00 2001 From: Iason Nikolas Date: Sat, 31 Dec 2022 18:23:12 +0200 Subject: [PATCH 6/6] Revert changes (+2 squashed commit) Squashed commit: [638ca3e] Update spdlog [1a7664a] Update windows version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5024b804..324628e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(OPT_WARNINGS_AS_ERRORS_DEVELOPER_DEFAULT TRUE) # Add project_options v0.20.0 # https://github.com/cpp-best-practices/project_options include(FetchContent) -FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.26.3.zip) +FetchContent_Declare(_project_options URL https://github.com/aminya/project_options/archive/refs/tags/v0.20.0.zip) FetchContent_MakeAvailable(_project_options) include(${_project_options_SOURCE_DIR}/Index.cmake)