Skip to content

Commit

Permalink
Merge pull request #1 from PacktPublishing/second_revision
Browse files Browse the repository at this point in the history
Second revision
  • Loading branch information
bernedom authored Apr 5, 2024
2 parents a34c64a + 6ac639d commit e070fd2
Show file tree
Hide file tree
Showing 76 changed files with 93 additions and 91 deletions.
32 changes: 17 additions & 15 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
FROM conanio/gcc11:1.44.1
FROM ubuntu:22.04

RUN pip3 install cmake-format pytest pytest-depends cpplint

# switch to root
USER root
ARG TZ=Europe/Zurich

# install a few tools for more convenient developing
RUN apt-get update; \
apt-get -y install --fix-missing \
LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8" DEBIAN_FRONTEND=noninteractive apt-get -y install --fix-missing \
gdb curl bash-completion vim rpm \
graphviz python3-pytest doxygen plantuml gcovr \
graphviz python3-pip python-is-python3 doxygen plantuml gcovr \
clang-tidy cppcheck iwyu zip afl++ clang-format ccache \
qemu qemu-system-arm gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user \
# QT runtime prerequisites
libgl1-mesa-dev libglu1-mesa-dev '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
libgl1-mesa-dev libglu1-mesa-dev '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev \
libxkbcommon-dev libxkbcommon-x11-dev bash build-essential git wget ninja-build gcovr lcov

RUN pip install cmake-format pytest pytest-depends cpplint conan

# Download version 3.21 from CMake
RUN curl -OL https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2-linux-x86_64.sh
RUN groupadd -r builder
RUN useradd --create-home --gid builder --groups dialout,plugdev,audio,tty --shell /usr/bin/bash builder

RUN chmod +x ./cmake-3.21.2-linux-x86_64.sh && ./cmake-3.21.2-linux-x86_64.sh --skip-license --prefix=/opt/pyenv/versions/3.7.5/ && rm ./cmake-3.21.2-linux-x86_64.sh
# Download version 3.23 of CMake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2-linux-x86_64.sh
RUN head cmake-3.23.2-linux-x86_64.sh
RUN chmod +x ./cmake-3.23.2-linux-x86_64.sh && ./cmake-3.23.2-linux-x86_64.sh --skip-license --prefix=/usr/local

USER conan
USER builder

# Download and install vcpkg
RUN curl -OL https://github.com/microsoft/vcpkg/archive/refs/tags/2021.05.12.tar.gz
RUN mkdir -p ~/.local/opt/vcpkg && mkdir -p ~/.local/bin/ && tar -xvf 2021.05.12.tar.gz --strip-components=1 -C ~/.local/opt/vcpkg && rm 2021.05.12.tar.gz
RUN cd ~ && curl -OL https://github.com/microsoft/vcpkg/archive/refs/tags/2021.05.12.tar.gz
RUN mkdir -p ~/.local/opt/vcpkg && mkdir -p ~/.local/bin/ && tar -xvf ~/2021.05.12.tar.gz --strip-components=1 -C ~/.local/opt/vcpkg && rm ~/2021.05.12.tar.gz
RUN ~/.local/opt/vcpkg/bootstrap-vcpkg.sh && ln -s ~/.local/opt/vcpkg/vcpkg ~/.local/bin/vcpkg

#install git shell extension
# install git shell extension
RUN curl -L https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh > ~/.bash_git && echo "source ~/.bash_git" >> ~/.bashrc
RUN sed -Ei 's/(PS1=.*)(\\\[\\033\[00m\\\]\\\$.*)/\1\\[\\033[01;33m\\]$(__git_ps1)\2/p' ~/.bashrc
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"remoteEnv": {
"DISPLAY": ":0"
},
"containerUser": "conan"
"containerUser": "builder"
}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Specifies the minimum required CMake version to build this project (and
# subprojects) Subprojects may override this value by specifying another version
# requirement in their CMakeLists file (e.g. require a later version of CMake)
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

# The main project
project(
Expand Down
2 changes: 1 addition & 1 deletion chapter01/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
chapter_1
Expand Down
2 changes: 1 addition & 1 deletion chapter01/policy_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch1_policy_example
Expand Down
2 changes: 1 addition & 1 deletion chapter01/simple_executable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

# Define a CMake project
project(
Expand Down
2 changes: 1 addition & 1 deletion chapter02/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"CMake Best Practices Chapter 2"
Expand Down
2 changes: 1 addition & 1 deletion chapter03/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
chapter_3
Expand Down
2 changes: 1 addition & 1 deletion chapter03/hello_header_only/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch3_hello_header_only
Expand Down
2 changes: 1 addition & 1 deletion chapter03/hello_world_standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch3_hello_world_standalone
Expand Down
2 changes: 1 addition & 1 deletion chapter04/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"CMake Best Practices Chapter 4"
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex01_executable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex01_executable
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex02_static/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex02_static
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex03_file/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex03_file
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex04_directory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex04_directory
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex05_config_file_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex05_lib
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex05_consumer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex05_consumer
Expand Down
4 changes: 2 additions & 2 deletions chapter04/ex06_pack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex06_pack
Expand All @@ -22,7 +22,7 @@ add_subdirectory(library)
# let CPack to get project name and version from the project()
set(CPACK_PACKAGE_VENDOR "CBP Authors")
# Enable DEB, RPM and TBZ2 generators by default
set(CPACK_GENERATOR "DEB;RPM;TBZ2")
set(CPACK_GENERATOR "DEB;TBZ2;TGZ;STGZ")
# Use all available cores when parallelism is supported
set(CPACK_THREADS 0)
# The DEB generator requires CPACK_DEBIAN_PACKAGE_MAINTAINER
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex06_pack/executable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex06_executable
Expand Down
2 changes: 1 addition & 1 deletion chapter04/ex06_pack/library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch4_ex06_library
Expand Down
2 changes: 1 addition & 1 deletion chapter05/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"Chapter_5"
Expand Down
2 changes: 1 addition & 1 deletion chapter05/conan_conanfile_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
conan_conanfile_example
Expand Down
2 changes: 1 addition & 1 deletion chapter05/conan_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

# using language CXX and C is necessary so conan recognizes the compiler correctly when compiling with clang under windows
project(
Expand Down
2 changes: 1 addition & 1 deletion chapter05/external_project_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch5_external_project_example
Expand Down
2 changes: 1 addition & 1 deletion chapter05/fetch_content_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch5_fetch_content_example
Expand Down
2 changes: 1 addition & 1 deletion chapter05/find_module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch5_find_module_example
Expand Down
2 changes: 1 addition & 1 deletion chapter05/find_module/cmake/FindObscure.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

# find the libary file libobscure.so obscure.dll or libobscure.1.0.0.so or similar
# Additionally to the default paths look in ${PROJECT_SOURCE_DIR}/dep/
Expand Down
2 changes: 1 addition & 1 deletion chapter05/find_module/dep_source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
an_obscure_lib
Expand Down
2 changes: 1 addition & 1 deletion chapter05/find_package_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch5_find_package_example
Expand Down
2 changes: 1 addition & 1 deletion chapter05/vcpkg_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
ch5_vcpkg_example
Expand Down
2 changes: 1 addition & 1 deletion chapter06/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

option(ENABLE_DOCUMENTATION "Enable documentation" OFF)

Expand Down
2 changes: 1 addition & 1 deletion chapter07/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"Chapter_7"
Expand Down
2 changes: 1 addition & 1 deletion chapter07/clang_tidy_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"ch7_clang_tidy_example"
Expand Down
2 changes: 1 addition & 1 deletion chapter07/cppcheck_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"ch7_cppcheck_example"
Expand Down
2 changes: 1 addition & 1 deletion chapter07/cpplint_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"ch7_cpplint_example"
Expand Down
2 changes: 1 addition & 1 deletion chapter07/custom_build_type/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"ch7_custom_build_type"
Expand Down
2 changes: 1 addition & 1 deletion chapter07/fixture_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"ch7_fixture_sample"
Expand Down
2 changes: 1 addition & 1 deletion chapter07/iwyu_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"ch7_iwyu_example"
Expand Down
2 changes: 1 addition & 1 deletion chapter07/lwyu_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.23)

project(
"ch7_lwyu_example"
Expand Down
Loading

0 comments on commit e070fd2

Please sign in to comment.