Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeLyon committed Oct 19, 2023
1 parent a59dddd commit 75d4a33
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ VSCode supports creating development environments inside of a docker container.

1. Install Docker, a tool for managing containerized VMs: https://www.docker.com
- If you have Docker installed, make sure it is updated to the most recent version (there is a "Check for Updates" option in the application UI).
- If installing Docker on macOS for the first time, I recommend selecting the "Advanced" installation option, specifying a "User" installation and disabling the two options below. This makes it so your Docker installation does not require root privileges for anything, making updates more seamless. This will require you telling VSCode where the `docker` executable ended up by chaging the "dev.containers.dockerPath" setting `"/Users/<your-user-name>/.docker/bin/docker”`. You should make sure this executable exists by executing `"/Users/<your-user-name>/.docker/bin/docker --version”`, if you are not on macOS the `docker` executable might be at a different path.
- If installing Docker on macOS for the first time, I recommend selecting the "Advanced" installation option, specifying a "User" installation and disabling the two options below. This makes it so your Docker installation does not require root privileges for anything, making updates more seamless. This will require you telling VSCode where the `docker` executable ended up by changing the "dev.containers.dockerPath" setting `"/Users/<your-user-name>/.docker/bin/docker”`. You should make sure this executable exists by executing `"/Users/<your-user-name>/.docker/bin/docker --version”`, if you are not on macOS the `docker` executable might be at a different path.
2. Install Visual Studio Code and the Remote Containers extensions: https://code.visualstudio.com/docs/devcontainers/tutorial
3. Configure Docker by opening up the Docker application and navigating to "Settings"
- Recommended settings for macOS (some of these are defaults):
Expand Down
5 changes: 2 additions & 3 deletions .devcontainer/cmake-helper
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

# Calls CMake, loading arguments from devcontainer settings to maintain a single source of truth.

PROJECT_NAME=circel
PROJECT_NAME=circt

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJECT_ROOT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)
Expand Down Expand Up @@ -39,7 +39,6 @@ case "$1" in
fi
fi

set -e
echo "-DCMAKE_BUILD_TYPE=Debug"
sed 's@//.*@@' < "$VSCODE_SETTINGS_FILE" | \
sed "s@\${[A-Za-z]*orkspaceFolder}@$PROJECT_ROOT@" | \
Expand Down
16 changes: 5 additions & 11 deletions .devcontainer/default/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,17 @@ FROM --platform=$BUILDPLATFORM ubuntu:rolling
# The following line is needed to set the $TARGETARCH variable to amd64 or arm64 depending on the target architecture. If you need alternative formulations (x86_64 or aarch64) use $(arch) in a RUN command.
ARG TARGETARCH

# This can be changed to "ci" to remove developer tools and reduce image size. Currently this only saves about 200MB of space.
# This can be changed to "ci" to remove developer tools and reduce image size. Currently this only saves about 200MB of space
ARG CONTAINER_MODE=dev

# Different versions of clang and Java can be selected by specifying the following build arguments, but are not guaranteed to work.
# The version of clang to use
ARG CLANG_VERSION=17
ARG JAVA_VERSION=java11

# Can be set to something like `firtool-1.56.1` to use a specific CIRCT release
ARG PINNED_CIRCT_VERSION=

# Setup container environment
ENV \
# Change locale to suppress some warnings
LC_ALL=C \
#
# Setup clang
CC=clang-$CLANG_VERSION \
CXX=clang++-$CLANG_VERSION \
LLVM_SYMBOLIZER_PATH=llvm-symbolizer-$CLANG_VERSION \
#
# Set VSCode as default editor
EDITOR="code --wait" \
GIT_EDITOR="code --wait"
Expand Down Expand Up @@ -76,6 +67,9 @@ RUN \
apt autoremove -y && \
rm /usr/bin/clang-cl-$CLANG_VERSION && \
#
# Create suffix-free links to clang binaries
for FILE in $(find /usr/bin -name "*-$CLANG_VERSION"); do ln -s ${FILE} ${FILE%-$CLANG_VERSION}; done && \
#
# Verilator hardcodes "g++" as the C++ compiler, so we symlink clang++ to g++ to avoid having gcc installed
cd /usr/bin && ln -s clang++-$CLANG_VERSION g++ && \
#
Expand Down
4 changes: 1 addition & 3 deletions .devcontainer/default/VSCode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"-DLLVM_USE_SANITIZER=",

// LLVM (performance)
"-DLLVM_USE_LINKER=lld-17",
"-DLLVM_USE_LINKER=lld",
"-DLLVM_OPTIMIZED_TABLEGEN=ON",
"-DLLVM_USE_SPLIT_DWARF=ON",

Expand All @@ -34,15 +34,13 @@
],

// -- Clangd Settings
"clangd.path": "clangd-17",
"clangd.checkUpdates": false,
"clangd.onConfigChanged": "restart",
"clangd.arguments": [
"--all-scopes-completion",
"--compile-commands-dir=${workspaceFolder}/build/circt",
"--header-insertion=never",
"--clang-tidy",
"--clang-tidy-checks=*",
"--pch-storage=memory"
],

Expand Down
9 changes: 5 additions & 4 deletions .devcontainer/default/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"name": "CIRCT",
"dockerFile": "Dockerfile",
"runArgs": [
// Allow the processes in the container to attach a debugger
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"mounts": [
/// VSCode settings in Docker need to be different from the host machine
// VSCode settings in Docker need to be different from the host machine
"source=${localWorkspaceFolder}/.devcontainer/default/VSCode,target=${containerWorkspaceFolder}/.vscode,type=bind",
/// Use a named volume for the build products for optimal performance (https://code.visualstudio.com/remote/advancedcontainers/improve-performance?WT.mc_id=javascript-14373-yolasors#_use-a-targeted-named-volume)
// Use a named volume for the build products for optimal performance (https://code.visualstudio.com/remote/advancedcontainers/improve-performance?WT.mc_id=javascript-14373-yolasors#_use-a-targeted-named-volume)
"source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/build,type=volume",
/// Use a named volume to share the ccache database. We use a simple name so that different devcontainers which build llvm could all share the same ccache database. Also share the configuration folder so configuration settings persist.
// Use a named volume to share the ccache database. We use a simple name so that different devcontainers which build llvm could all share the same ccache database. Also share the configuration folder so configuration settings persist.
"source=shared-llvm-ccache-database,target=/root/.cache/ccache,type=volume",
"source=shared-llvm-ccache-config,target=/root/.config/ccache,type=volume"
],
Expand All @@ -32,7 +33,7 @@
],
"settings": {
// This must be set in devcontainer.json because it must be an absolute path and thus cannot use `${workspaceFolder}` if defined in `settings.json`
"mlir.server_path": "${containerWorkspaceFolder}/build/circt/bin/circt-lsp-server",
"mlir.server_path": "${containerWorkspaceFolder}/build/circt/bin/circt-lsp-server"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer-helper
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -euo pipefail

PROJECT_ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )
cd "$PROJECT_ROOT" || exit 1
Expand Down

0 comments on commit 75d4a33

Please sign in to comment.