Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
abdes committed Apr 9, 2023
2 parents 0ba5409 + b333b38 commit 05e9697
Show file tree
Hide file tree
Showing 19 changed files with 310 additions and 136 deletions.
45 changes: 9 additions & 36 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
ARG VARIANT=debian-11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.205.2/containers/python-3/.devcontainer/base.Dockerfile

# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
ARG VARIANT="3.10-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install lsb-release wget software-properties-common \
&& apt-get -y install lsb-release wget software-properties-common

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install build-essential ninja-build valgrind gdb lcov doxygen graphviz

# Install latest cmake 3.22 so we have support for cmake presets and a better integration in IDEs
Expand All @@ -25,12 +21,6 @@ RUN add-apt-repository 'deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullsey
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install clang-14 clangd-14 lldb-14 llvm-14 clang-format-14 clang-tidy-14

# Install ccache
RUN apt-get -y install ccache

# Clean-up
RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 100
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 100
RUN update-alternatives --install /usr/bin/clang-apply-replacements clang-apply-replacements /usr/bin/clang-apply-replacements-14 100
Expand All @@ -43,25 +33,8 @@ RUN update-alternatives --install /usr/bin/scan-view scan-view /usr/bin/scan-vie
RUN update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-14 100
RUN update-alternatives --install /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-14 100

# Our pip requirements rarely change, add them to the image.
COPY requirements.txt /tmp/pip-tmp/
RUN if [ -f "/tmp/pip-tmp/requirements.txt" ]; then \
pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
&& rm -rf /tmp/pip-tmp; \
fi

# Install global node packages and enable husky.
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g husky standard-version @commitlint/cli @commitlint/config-conventional " 2>&1
# Install ccache
RUN apt-get -y install ccache

# Setup oh-my-zsh and plugins for user vscode
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
COPY --chown=$USER_UID:$USER_GID .devcontainer/.zshrc /home/$USERNAME
RUN chmod 644 /home/$USERNAME/.zshrc
# the user we're applying this too (otherwise it most likely install for root)
USER $USERNAME
RUN git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
ENV SHELL=/bin/zsh
# Clean-up
RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
35 changes: 24 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.10-bullseye",
// Options
"NODE_VERSION": "16"
"VARIANT": "debian-11"
}
},
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {
"configureZshAsDefaultShell": true,
"userName": "vscode",
"uid": "1000",
"gid": "1000"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "16"
},
"ghcr.io/devcontainers/features/python:1": {
"version": "os-provided"
}
},
// Set *default* container specific settings.json values on container create.
Expand All @@ -28,10 +40,7 @@
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.experiments.optInto": [
"pythonDeprecatePythonPath"
],
"clangd.path": "/usr/bin/clangd-14",
"clangd.path": "/usr/bin/clangd-14"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
Expand All @@ -52,8 +61,12 @@
],
// 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": "npx husky install < /dev/null",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
"remoteUser": "vscode",
"postCreateCommand": {
"git_dubious_fix": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"commit_tools": "npm install -g husky standard-version @commitlint/cli @commitlint/config-conventional",
"enable_husky": "npx husky install < /dev/null",
"update_python_modules": "pip --disable-pip-version-check --no-cache-dir install -r requirements.txt"
}
}
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"esbonio.sphinx.confDir": "doc",
"esbonio.sphinx.confDir": "${workspaceFolder}/doc",
"esbonio.sphinx.buildDir": "${workspaceFolder}/out/html",
"editor.rulers": [
80,
100
Expand Down Expand Up @@ -292,4 +293,4 @@
"files.exclude": {
"**/.sphinx": true
},
}
}
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,66 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [4.6.3](http://github.com/abdes/asap/compare/v4.6.2...v4.6.3) (2023-03-25)

### Enhancements

* Simplify `devcontainer` setup by using features and additional container
lifecycle commands.

### Bug Fixes

* enable profiling for test coverage for MSVC ([7348d0a](http://github.com/abdes/asap/commit/7348d0a36b05b2f2e9c517e5b981f2c218bd511e)), closes [#22](http://github.com/abdes/asap/issues/22)

## [4.6.2](http://github.com/abdes/asap/compare/v4.6.1...v4.6.2) (2022-11-28)

### Features

* increase ccache hit rate ([a22a912](http://github.com/abdes/asap/commit/a22a91226060851fe9fc7e5bc0e51973df94d95c))
* more robust handling of contract checking mode ([304e9ae](http://github.com/abdes/asap/commit/304e9aee1e8fb265be78163578c45ae22569e52b))

When linking against the contract checking and enforcement library
`asap-contract` (https://github.com/asap-projects/asap-contract), it is
possible to control the contract checking mode by passing a value for the
`CONTRACTS` option when adding any type of target with `asap_add_xxx`
API (e.g. asap_add_library. asap_add_test, etc):

* CONTRACTS OFF : set contract checking mode to OFF
* CONTRACTS AUDIT : set contract checking mode to AUDIT
* CONTRACTS DEFAULT : set contract checking mode to DEFAULT

* CONTRACTS AUTO : set contract checking mode using as a first priority the
value passed in the cmake option `OPTION_CONTRACT_MODE`. If none is present,
automatically set the mode based on the build configuration. For Debug ->
AUDIT, For Release and RelMinSize -> OFF, and for RelWithDebInfo -> DEFAULT.

* CONTRACTS TESTING : indicates that contracts are being testing and the
target needs to have full control on the contract checking mode. Nothing
will be done here.

The default setting is AUTO.

### Bug Fixes

* **build:** [#21](http://github.com/abdes/asap/issues/21) target option `WARNING` not propagated properly ([432cdaf](http://github.com/abdes/asap/commit/432cdaff1e5c8775d0d5c533dd0abe5eac229bd7))

By default, for every target we build, a compiler option will be added
to treat warnings as errors, unless the target is added with `WARNING` as
an option.

When that option is used, we now properly propagate it to set the
corresponding compiler option to **NOT** treat warnings as errors.

This is useful when 3rd party dependencies have include files that
generate warnings.

## [4.6.1](http://github.com/abdes/asap/compare/v4.6.0...v4.6.1) (2022-09-20)

### Bug Fixes

* always add code coverage 'all' targets ([d7309a0](http://github.com/abdes/asap/commit/d7309a0806e11a46c73b700f12bccb424c62839b))
* version-info test was added even when ASAP_BUILD_TESTS is OFF ([b566e7b](http://github.com/abdes/asap/commit/b566e7b555ffb40f8ab1eea43d9a965c5724ccf1))

## [4.6.0](http://github.com/abdes/asap/compare/v4.5.2...v4.6.0) (2022-09-20)

### Features
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ endif()
# project hierarchy
include(LogHelpers)

# Setup our override file, in which we may cleanup cmake's default compiler
# options, based on what we are doing.
set(CMAKE_USER_MAKE_RULES_OVERRIDE "ResetInitialCompilerOptions")

# ------------------------------------------------------------------------------
# Project description and (meta) information
# ------------------------------------------------------------------------------
Expand Down
73 changes: 49 additions & 24 deletions cmake/AsapTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,32 @@ endfunction()
# Target creation helpers
# ------------------------------------------------------------------------------

macro(_add_common_compiler_options target warnings)
# Set some common compiler options, and forward the 'WARNING' option if it was
# provided
if(warnings)
asap_set_compile_options(${target} WARNING)
else()
asap_set_compile_options(${target})
endif()
endmacro()

function(asap_add_library target)
swift_add_library("${target}" ${ARGN})
set(argOption EXCEPTIONS RTTI WARNING)
set(argSingle CONTRACTS)
set(argMulti)

cmake_parse_arguments(x "${argOption}" "${argSingle}" "${argMulti}" ${ARGN})

if(x_WARNING)
set(warning_flag "WARNING")
else()
set(warning_flag)
endif()

# Contrarily to swift default, we enable exceptions and RTTI for all targets
swift_add_library("${target}" EXCEPTIONS RTTI ${warning_flag}
${x_UNPARSED_ARGUMENTS})

# We can refer to this target either with its standalone target name or with a
# project scoped name (<project>::<module>) which we will alias to the target
Expand All @@ -120,9 +144,9 @@ function(asap_add_library target)
get_target_property(type ${target} TYPE)
if(NOT ${type} STREQUAL "INTERFACE_LIBRARY")
# Set some common private compiler defines
asap_set_compile_definitions(${target})
# Set some common compiler options
asap_set_compile_options(${target})
asap_set_compile_definitions(${target} CONTRACTS ${x_CONTRACTS})
# Set common compiler options
asap_set_compile_options(${target} ${warning_flag})
# Generate export headers for the library
asap_generate_export_headers(${target} ${META_MODULE_NAME})

Expand All @@ -138,33 +162,34 @@ function(asap_add_library target)
endfunction()

function(asap_add_executable target)
swift_add_executable("${target}" ${ARGN})
set(argOption EXCEPTIONS RTTI WARNING)
set(argSingle CONTRACTS)
set(argMulti)

cmake_parse_arguments(x "${argOption}" "${argSingle}" "${argMulti}" ${ARGN})

if(x_WARNING)
set(warning_flag "WARNING")
else()
set(warning_flag)
endif()

# Contrarily to swift default, we enable exceptions and RTTI for all targets
swift_add_executable("${target}" EXCEPTIONS RTTI ${warning_flag}
${x_UNPARSED_ARGUMENTS})
# Set some common private compiler defines
asap_set_compile_definitions(${target})
# Set some common compiler options
asap_set_compile_options(${target})
asap_set_compile_definitions(${target} CONTRACTS ${x_CONTRACTS})
# Set common compiler options
asap_set_compile_options(${target} ${warning_flag})
set_target_properties(${target} PROPERTIES FOLDER "Executables")
endfunction()

function(asap_add_tool target)
swift_add_tool("${target}" ${ARGN})
# Set some common private compiler defines
asap_set_compile_definitions(${target})
# Set some common compiler options
asap_set_compile_options(${target})
asap_add_executable(${target} ${ARGN})
set_target_properties(${target} PROPERTIES FOLDER "Tools")
endfunction()

function(asap_add_tool_library target)
swift_add_tool_library("${target}" ${ARGN})
# Set some common private compiler defines
asap_set_compile_definitions(${target})
# Set some common compiler options
asap_set_compile_options(${target})
set_target_properties(
${target}
PROPERTIES FOLDER "Tool Libraries"
VERSION ${META_MODULE_VERSION}
SOVERSION ${META_MODULE_VERSION_MAJOR}
DEBUG_POSTFIX "d")
asap_add_library(${target} ${ARGN})
set_target_properties(${target} PROPERTIES FOLDER "Tool Libraries")
endfunction()
4 changes: 2 additions & 2 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# Do this only once for the project by checking if we already have loaded CPM
# which will define the CURRENT_CPM_VERSION, and if that version is what we want
# to have here.
if(NOT CURRENT_CPM_VERSION VERSION_EQUAL 0.35.6)
set(CPM_DOWNLOAD_VERSION 0.35.6)
if(NOT CURRENT_CPM_VERSION VERSION_EQUAL 0.38.1)
set(CPM_DOWNLOAD_VERSION 0.38.1)

if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a
Expand Down
Loading

0 comments on commit 05e9697

Please sign in to comment.