aboutsummaryrefslogtreecommitdiffstats
path: root/.devcontainer
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-08-12 10:39:27 +0000
committersaturneric <[email protected]>2024-08-12 10:39:27 +0000
commit5c0bc42ed0c2e56726e5dce2673c07b2f7ee9111 (patch)
tree96e41ca30db32e91ce6e2ac6f56b0c9b02223373 /.devcontainer
parentCreate devcontainer.json (diff)
downloadGpgFrontend-5c0bc42ed0c2e56726e5dce2673c07b2f7ee9111.tar.gz
GpgFrontend-5c0bc42ed0c2e56726e5dce2673c07b2f7ee9111.zip
feat: add c++ dev container config
Diffstat (limited to '.devcontainer')
-rw-r--r--.devcontainer/Dockerfile36
-rw-r--r--.devcontainer/devcontainer.json40
-rw-r--r--.devcontainer/reinstall-cmake.sh59
3 files changed, 120 insertions, 15 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 00000000..94b553f8
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,36 @@
+FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12
+
+ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.22.2"
+
+# Optionally install the cmake for vcpkg
+COPY ./reinstall-cmake.sh /tmp/
+
+RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
+ chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
+ fi \
+ && rm -f /tmp/reinstall-cmake.sh
+
+# [Optional] Uncomment this section to install additional vcpkg ports.
+# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install <your-port-name-here>"
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ build-essential \
+ git \
+ autoconf \
+ automake \
+ gettext \
+ texinfo \
+ gcc \
+ g++ \
+ ninja-build \
+ libarchive-dev \
+ libssl-dev \
+ libgpgme-dev \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/*
+
+# Install Qt6
+RUN git clone https://github.com/jurplel/install-qt-action.git /tmp/install-qt-action && \
+ /tmp/install-qt-action/install-qt.sh -v "6.7.2" --no-cache && \
+ rm -rf /tmp/install-qt-action \ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index fa2b045f..f94bcc8c 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,17 +1,27 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the
+// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
- "name": "GpgFrontend Development Environment",
- "build": {
- "dockerfile": "Dockerfile"
- },
- "settings": {
- "terminal.integrated.shell.linux": "/bin/bash"
- },
- "extensions": [
- "ms-vscode.cpptools",
- "ms-vscode.cmake-tools",
- "twxs.cmake",
- "ms-vscode.gitlens"
- ],
- "forwardPorts": [8000],
- "remoteUser": "devuser"
+ "name": "C++",
+ "build": {
+ "dockerfile": "Dockerfile"
+ },
+ "features": {
+ "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {},
+ "ghcr.io/nils-geistmann/devcontainers-features/zsh:0": {}
+ }
+
+ // Features to add to the dev container. More info: https://containers.dev/features.
+ // "features": {},
+
+ // 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": "gcc -v",
+
+ // Configure tool-specific properties.
+ // "customizations": {},
+
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
+ // "remoteUser": "root"
}
diff --git a/.devcontainer/reinstall-cmake.sh b/.devcontainer/reinstall-cmake.sh
new file mode 100644
index 00000000..408b81d2
--- /dev/null
+++ b/.devcontainer/reinstall-cmake.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+#-------------------------------------------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
+#-------------------------------------------------------------------------------------------------------------
+#
+set -e
+
+CMAKE_VERSION=${1:-"none"}
+
+if [ "${CMAKE_VERSION}" = "none" ]; then
+ echo "No CMake version specified, skipping CMake reinstallation"
+ exit 0
+fi
+
+# Cleanup temporary directory and associated files when exiting the script.
+cleanup() {
+ EXIT_CODE=$?
+ set +e
+ if [[ -n "${TMP_DIR}" ]]; then
+ echo "Executing cleanup of tmp files"
+ rm -Rf "${TMP_DIR}"
+ fi
+ exit $EXIT_CODE
+}
+trap cleanup EXIT
+
+
+echo "Installing CMake..."
+apt-get -y purge --auto-remove cmake
+mkdir -p /opt/cmake
+
+architecture=$(dpkg --print-architecture)
+case "${architecture}" in
+ arm64)
+ ARCH=aarch64 ;;
+ amd64)
+ ARCH=x86_64 ;;
+ *)
+ echo "Unsupported architecture ${architecture}."
+ exit 1
+ ;;
+esac
+
+CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh"
+CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt"
+TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX)
+
+echo "${TMP_DIR}"
+cd "${TMP_DIR}"
+
+curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O
+curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O
+
+sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}"
+sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license
+
+ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
+ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest