diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..05d01d7dbc --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,61 @@ +FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04 + +# Install software-properties-common for add-apt-repository +RUN apt-get update && apt-get -y install software-properties-common + +# Install C++ tools and libraries +RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get -y update && apt-get -y install \ + git gdb cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \ + protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \ + rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \ + libbz2-dev libdouble-conversion-dev libstdc++-13-dev liblz4-dev libssl-dev \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install LLVM +RUN wget https://apt.llvm.org/llvm.sh && \ + chmod u+x llvm.sh && \ + ./llvm.sh 16 + +# Update alternatives to use clang-16 and clang++-16 by default +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 && \ + update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 + +# Install libiconv +ENV LIBICONV_VERSION=1.15 +RUN wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz && \ + tar -xvzf libiconv-${LIBICONV_VERSION}.tar.gz && cd libiconv-${LIBICONV_VERSION} && \ + ./configure --prefix=/usr/local && \ + make && \ + make install + +# Install base64 +ENV BASE64_VERSION=0.5.2 +RUN wget -O base64-${BASE64_VERSION}.tar.gz https://github.com/aklomp/base64/archive/refs/tags/v${BASE64_VERSION}.tar.gz && \ + tar -xvzf base64-${BASE64_VERSION}.tar.gz && cd base64-${BASE64_VERSION} && \ + mkdir build && cd build && \ + cmake -DCMAKE_BUILD_TYPE=Release .. && \ + cmake --build . --config Release --target install + +# Install brotli +ENV BROTLI_VERSION=1.1.0 +RUN wget -O brotli-${BROTLI_VERSION}.tar.gz https://github.com/google/brotli/archive/refs/tags/v${BROTLI_VERSION}.tar.gz && \ + tar -xvzf brotli-${BROTLI_VERSION}.tar.gz && cd brotli-${BROTLI_VERSION} && \ + mkdir build && cd build && \ + cmake -DCMAKE_BUILD_TYPE=Release .. && \ + cmake --build . --config Release --target install + +# Install jwt-cpp +ENV JWT_CPP_VERSION=0.7.0 +RUN wget -O jwt-cpp-${JWT_CPP_VERSION}.tar.gz https://github.com/Thalhammer/jwt-cpp/archive/refs/tags/v${JWT_CPP_VERSION}.tar.gz && \ + tar -xvzf jwt-cpp-${JWT_CPP_VERSION}.tar.gz && cd jwt-cpp-${JWT_CPP_VERSION} && \ + mkdir build && cd build && \ + cmake -DCMAKE_BUILD_TYPE=Release .. && \ + cmake --build . --config Release --target install + +# Install ccache 4.8.1 or above +ENV CCACHE_VERSION=4.8.1 +RUN wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \ + && tar -xf ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \ + && cp ccache-${CCACHE_VERSION}-linux-x86_64/ccache /usr/local/bin/ \ + && rm -rf ccache-${CCACHE_VERSION}-linux-x86_64 ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz diff --git a/.devcontainer/configure.sh b/.devcontainer/configure.sh new file mode 100755 index 0000000000..471865297f --- /dev/null +++ b/.devcontainer/configure.sh @@ -0,0 +1,8 @@ +#!/bin/sh +WORKSPACE_FOLDER=$1 + +cd $1 +mkdir -p build +git submodule update --init --recursive +ccache -o cache_dir=/root/.ccache +cmake --preset release-test-with-ccache-basedir -DCMAKE_EXPORT_COMPILE_COMMANDS=1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..44d51d9e86 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,49 @@ +// 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": "C++", + "build": { + "dockerfile": "Dockerfile", + "options": [ + "--platform", + "linux/amd64" + ] + }, + // Allows the container to use ptrace, which is useful for debugging. + "capAdd": [ + "SYS_PTRACE" + ], + // Disables seccomp, which can be necessary for some debugging tools to function correctly. + "securityOpt": [ + "seccomp=unconfined" + ], + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/github-cli:1": { + "installDirectlyFromGitHubRelease": true, + "version": "latest" + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [], + "initializeCommand": "mkdir -p ${localEnv:HOME}/.ccache && cd \"${localWorkspaceFolder}\" && git config --local user.email \"$(git config user.email)\" && git config --local user.name \"$(git config user.name)\"", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": ".devcontainer/configure.sh ${containerWorkspaceFolder}", + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "twxs.cmake", + "ms-vscode.cpptools-extension-pack", + "llvm-vs-code-extensions.vscode-clangd" + ] + } + }, + "mounts": [ + "source=${localEnv:HOME}/.ccache,target=/root/.ccache,type=bind,consistency=cached" + ], + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + "remoteUser": "root" +} diff --git a/.gitignore b/.gitignore index ababfa711b..9529b57eca 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,6 @@ llvm.sh # User CMake presets CMakeUserPresets.json + +# Dev Containers +!.devcontainer/Dockerfile