Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cpm package manager to amp-devcontainer-cpp #609

Merged
merged 5 commits into from
Oct 21, 2024
Merged
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
4 changes: 4 additions & 0 deletions .devcontainer/cpp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM ubuntu:24.04@sha256:ab64a8382e935382638764d8719362bb50ee418d944c1f3d26e0c99
ARG BATS_VERSION=1.11.0
ARG CCACHE_VERSION=4.10.1
ARG CLANG_VERSION=17
ARG CPM_VERSION=0.40.2
ARG DOCKER_VERSION=27.3.1
ARG MULL_VERSION=0.22.0
ARG INCLUDE_WHAT_YOU_USE_VERSION=0.21
Expand Down Expand Up @@ -36,6 +37,9 @@ ENV CMAKE_GENERATOR="Ninja"
ENV CMAKE_EXPORT_COMPILE_COMMANDS="On"
ENV CCACHE_DIR=/root/.ccache

# Install CPM.cmake to the CMake module path
RUN wget -qP /usr/local/lib/python*/dist-packages/cmake/data/share/cmake-*/Modules/ https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_VERSION}/CPM.cmake

# Install clang toolchain
COPY .devcontainer/cpp/apt-requirements-clang.json /tmp/apt-requirements-clang.json
# hadolint ignore=SC1091
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ add_subdirectory(clang-tools)
add_subdirectory(fuzzing)
add_subdirectory(gcc)
add_subdirectory(gcc-arm-none-eabi)
add_subdirectory(package-managers)
add_subdirectory(sanitizers)
add_subdirectory(test)
12 changes: 12 additions & 0 deletions .devcontainer/cpp/test/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
"ENABLE_COVERAGE_TEST": "On"
}
},
{
"name": "cpm",
"inherits": "defaults",
"cacheVariables": {
"ENABLE_CPM_TEST": "On"
}
},
{
"name": "gcc",
"inherits": "defaults"
Expand Down Expand Up @@ -81,6 +88,11 @@
"configurePreset": "coverage",
"targets": ["test-coverage"]
},
{
"name": "cpm",
"configurePreset": "cpm",
"targets": ["test-cpm"]
},
{
"name": "fuzzing",
"configurePreset": "clang",
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/cpp/test/package-managers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(cpm)
8 changes: 8 additions & 0 deletions .devcontainer/cpp/test/package-managers/cpm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if (ENABLE_CPM_TEST)
rjaegers marked this conversation as resolved.
Show resolved Hide resolved
include(CPM)

CPMAddPackage("gh:fmtlib/fmt#11.0.2")

add_executable(test-cpm EXCLUDE_FROM_ALL main.cpp)
target_link_libraries(test-cpm PRIVATE fmt::fmt)
endif()
7 changes: 7 additions & 0 deletions .devcontainer/cpp/test/package-managers/cpm/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <fmt/core.h>

int main()
{
fmt::print("Hello, world!\n");
return 0;
}
5 changes: 5 additions & 0 deletions .devcontainer/cpp/test/testsuite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ teardown() {
build_and_run_with_sanitizers clang
}

@test "using CPM as package manager should resolve external dependencies" {
cmake --preset cpm
cmake --build --preset cpm
}

function configure_and_build_with_ccache() {
local PRESET=${1:?}

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/issue-creation-tool-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:

- [ ] The [ARM GNU](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) toolchain is up to date and matches with the GCC version
- [ ] The [Clang toolchain](https://apt.llvm.org/) is up to date
- [ ] The [CPM](https://github.com/cpm-cmake/CPM.cmake) package manager is up to date
- [ ] The [Docker cli](https://download.docker.com/linux/static/stable/) is up to date
- [ ] [bats-core](https://github.com/bats-core/bats-core), [bats-support](https://github.com/bats-core/bats-support) and [bats-assert](https://github.com/bats-core/bats-assert) are up to date
- [ ] [Mull](https://github.com/mull-project/mull) is up to date and compatible with the currently installed Clang version
Expand Down
Loading