Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Feature/update devcontainer #44

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 && \
Expand All @@ -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}"
Expand Down Expand Up @@ -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"]
60 changes: 33 additions & 27 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,56 @@
{
"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
"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
// 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": [
"--cap-add=SYS_PTRACE",
"--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": {}
}
}
2 changes: 1 addition & 1 deletion .github/template/template_name
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cmake_conan_boilerplate_template
cpp_boilerplate_project
2 changes: 1 addition & 1 deletion .github/template/template_repository
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cpp-best-practices/cmake_conan_boilerplate_template
Jason5480/cpp_boilerplate_project
4 changes: 2 additions & 2 deletions .github/workflows/auto-clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/template-janitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
compiler:
- gcc-11
- gcc-12
generator:
- "Unix Makefiles"
build_type:
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
strategy:
matrix:
compiler:
- gcc-11
- gcc-12
generator:
- "Unix Makefiles"
build_type:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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.
Expand Down
24 changes: 12 additions & 12 deletions README_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand All @@ -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
Expand Down