Skip to content

Devcontainer #136

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

Merged
merged 30 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4322bee
Create Dockerfile devcontainer
antoinebou12 Nov 11, 2024
dcb558c
Create devcontainer.json
antoinebou12 Nov 11, 2024
77c8b52
Add files via upload
antoinebou12 Nov 11, 2024
aaed46a
Update pre-commit-config.yaml
antoinebou12 Nov 11, 2024
345e7d2
Update pre-commit-config.yaml
antoinebou12 Nov 12, 2024
21d47a6
Update devcontainer.json
antoinebou12 Nov 12, 2024
f5b6509
Update Dockerfile
antoinebou12 Nov 12, 2024
4f9362d
Update devcontainer.json
antoinebou12 Nov 12, 2024
96e1a81
Update Dockerfile
antoinebou12 Nov 12, 2024
ef022d5
Create CMakePresets.json
antoinebou12 Nov 12, 2024
878bdcf
Update CMakePresets.json
antoinebou12 Nov 12, 2024
8426018
Update Dockerfile
antoinebou12 Nov 12, 2024
b5ed1d9
Rename pre-commit-config.yaml to .pre-commit-config.yaml
antoinebou12 Nov 12, 2024
bf17237
Merge branch 'ipc-sim:main' into devcontainer
antoinebou12 Nov 12, 2024
2ef5de1
Update devcontainer.json
antoinebou12 Nov 18, 2024
7e1ee4d
Merge branch 'ipc-sim:main' into devcontainer
antoinebou12 Nov 18, 2024
b12c82c
Update devcontainer.json
antoinebou12 Nov 18, 2024
521736a
Update Dockerfile
antoinebou12 Nov 18, 2024
5a6f043
Update devcontainer.json
antoinebou12 Nov 18, 2024
3418ccb
Update Dockerfile
antoinebou12 Nov 18, 2024
fe781b7
Update Dockerfile
antoinebou12 Nov 18, 2024
3764f7d
Update Dockerfile
antoinebou12 Nov 18, 2024
b181012
Update Dockerfile
antoinebou12 Nov 19, 2024
3067694
Update Dockerfile
antoinebou12 Nov 19, 2024
007bbf4
Update Dockerfile
antoinebou12 Nov 19, 2024
b442d67
Update devcontainer.json
antoinebou12 Nov 19, 2024
a8d1549
Update Dockerfile
antoinebou12 Nov 19, 2024
5f9fe29
Update Dockerfile
antoinebou12 Nov 19, 2024
15e44ad
Update devcontainer.json
antoinebou12 Nov 19, 2024
1a74275
Update .pre-commit-config.yaml
antoinebou12 Nov 26, 2024
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
82 changes: 82 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
FROM ubuntu:22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV CCACHE_DIR=/home/devuser/.ccache
ENV CCACHE_MAXSIZE=1G
ENV CXX_STANDARD=17

# Update package lists
RUN apt-get update

# Install essential packages
RUN apt-get install -y --no-install-recommends \
build-essential \
git \
wget \
curl \
fish \
zsh \
ninja-build \
ccache \
libeigen3-dev \
libtbb-dev \
libspdlog-dev \
python3 \
python3-pip \
python3-dev \
libgmp-dev \
libssl-dev \
libncurses5-dev \
libncursesw5-dev \
libxml2-dev \
libjsoncpp-dev \
libz3-dev \
sudo \
software-properties-common \
lsb-release \
gnupg \
&& rm -rf /var/lib/apt/lists/*

# Create a new user with sudo privileges
RUN useradd -m devuser \
&& echo "devuser:password" | chpasswd \
&& usermod -aG sudo devuser \
&& echo "devuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& mkdir -p $CCACHE_DIR \
&& chown devuser:devuser $CCACHE_DIR

# Set up Python tools
RUN pip3 install --upgrade pip setuptools wheel pre-commit

# Add Kitware APT repository for CMake
RUN wget -qO- https://apt.kitware.com/keys/kitware-archive-latest.asc | \
gpg --dearmor -o /usr/share/keyrings/kitware-archive-keyring.gpg

RUN echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | \
tee /etc/apt/sources.list.d/kitware.list > /dev/null

# Update package lists and install CMake
RUN apt-get update
RUN apt-get install -y cmake

# Verify CMake installation
RUN cmake --version

# Install LLVM/Clang and Clang-Format version 18
RUN wget -q https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
RUN chmod +x /tmp/llvm.sh
RUN /tmp/llvm.sh 18 || true

RUN apt-get update && apt-get install -y clang-18 clang-tools-18 clang-format-18

RUN clang-18 --version
RUN clang++-18 --version
RUN clang-format-18 --version

# 12. Set the default user and working directory
USER devuser

WORKDIR /home/devuser/workspace

CMD ["bash"]
59 changes: 59 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
"name": "IPCToolkit C++ Development Container",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/fish",
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.default.intelliSenseMode": "gcc-x64",
"C_Cpp.default.compilerPath": "/usr/bin/clang++-18",
"C_Cpp.clang_format_path": "/usr/bin/clang-format-18",
"C_Cpp.clang_format_style": "file",
"cmake.configureOnOpen": true,
"cmake.buildDirectory": "${workspaceFolder}/build",
"python.pythonPath": "/usr/bin/python3",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"prettier.requireConfig": true
},
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"xaver.clang-format",
"ms-python.python",
"ms-azuretools.vscode-docker",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"mhutchie.git-graph",
"twxs.cmake",
"jeff-hykin.better-cpp-syntax",
"vadimcn.vscode-lldb",
"cschlosser.doxdocgen",
"ms-python.vscode-pylance",
"mutantdino.resourcemonitor",
"randomfractalsinc.vscode-data-preview",
"oderwat.indent-rainbow",
"formulahendry.code-runner",
"donjayamanne.git-extension-pack"
]
}
},
"postCreateCommand": "pre-commit install",
"remoteUser": "devuser",
"mounts": [
"source=${localWorkspaceFolder}/.ccache,target=/home/devuser/.ccache,type=bind,consistency=cached"
],
"forwardPorts": [],
"remoteEnv": {
"CCACHE_DIR": "/home/devuser/.ccache",
"CCACHE_MAXSIZE": "1G"
},
"workspaceFolder": "/home/devuser/workspace",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/devuser/workspace,type=bind,consistency=cached"
}
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.0
hooks:
- id: clang-format
name: clang-format
description: "Use clang-format to format C/C++ code"
entry: clang-format-18
args:
- --style=file
- --verbose
files: '\.(c|cc|cpp|h|hpp|tpp|cxx|hh|inl|ipp)$'
151 changes: 151 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor":
},
"configurePresets": [
{
"name": "base-release",
"hidden": true,
"description": "Base preset for release builds",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_STANDARD": "17"
}
},
{
"name": "base-debug",
"hidden": true,
"description": "Base preset for debug builds",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_STANDARD": "17"
}
},
{
"name": "default",
"inherits": "base-release",
"displayName": "Default Configuration",
"description": "Default build configuration",
"binaryDir": "${sourceDir}/build/default"
},
{
"name": "cuda",
"inherits": "base-release",
"displayName": "CUDA Enabled",
"description": "Build with CUDA support",
"binaryDir": "${sourceDir}/build/cuda",
"cacheVariables": {
"IPC_TOOLKIT_WITH_CUDA": "ON"
}
},
{
"name": "simd",
"inherits": "base-release",
"displayName": "SIMD Enabled",
"description": "Build with SIMD optimizations",
"binaryDir": "${sourceDir}/build/simd",
"cacheVariables": {
"IPC_TOOLKIT_WITH_SIMD": "ON"
}
},
{
"name": "test",
"inherits": "base-debug",
"displayName": "Build for Testing",
"description": "Build with unit tests enabled",
"binaryDir": "${sourceDir}/build/test",
"cacheVariables": {
"IPC_TOOLKIT_WITH_CUDA": "ON",
"IPC_TOOLKIT_BUILD_TESTS": "ON",
"IPC_TOOLKIT_BUILD_PYTHON": "OFF"
}
},
{
"name": "python",
"inherits": "base-release",
"displayName": "Python Bindings",
"description": "Build with Python bindings enabled",
"binaryDir": "${sourceDir}/build/python",
"cacheVariables": {
"IPC_TOOLKIT_BUILD_PYTHON": "ON",
"IPC_TOOLKIT_BUILD_TESTS": "OFF",
"IPC_TOOLKIT_WITH_SIMD": "OFF",
"IPC_TOOLKIT_WITH_CUDA": "OFF"
}
},
{
"name": "coverage",
"inherits": "base-debug",
"displayName": "Code Coverage",
"description": "Build for code coverage",
"binaryDir": "${sourceDir}/build/coverage",
"cacheVariables": {
"IPC_TOOLKIT_WITH_CODE_COVERAGE": "ON",
"IPC_TOOLKIT_BUILD_TESTS": "ON",

}
},
{
"name": "debug-cuda",
"inherits": [ "base-debug", "cuda" ],
"displayName": "CUDA Debug",
"description": "Debug build with CUDA support",
"binaryDir": "${sourceDir}/build/debug-cuda"
},
],
"buildPresets": [
{
"name": "default-build",
"configurePreset": "default",
"description": "Build using default configuration"
},
{
"name": "cuda-build",
"configurePreset": "cuda",
"description": "Build with CUDA support"
},
{
"name": "test-build",
"configurePreset": "test",
"description": "Build for running tests"
},
{
"name": "python-build",
"configurePreset": "python",
"description": "Build with Python bindings enabled"
},
{
"name": "debug-cuda-build",
"configurePreset": "debug-cuda",
"description": "Debug build with CUDA support"
},
],
"testPresets": [
{
"name": "default-tests",
"description": "Run default tests",
"configurePreset": "test",
"execution": {
"stopOnFailure": true
}
},
{
"name": "cuda-tests",
"description": "Run tests with CUDA enabled",
"configurePreset": "cuda",
"execution": {
"stopOnFailure": true
}
},
{
"name": "debug-cuda-tests",
"description": "Run tests with CUDA Debug configuration",
"configurePreset": "debug-cuda",
"execution": {
"stopOnFailure": true
}
}
]
}