Skip to content

Commit e140144

Browse files
committed
Update devcontainer configuration
Set up dev container with ubuntu 24.10, emsdk, wasi-sdk and clangd Update emsdk and wasi-sdk to latest versions and add cmake presets to configure for emscripten and wasi. Inside the devcontainer the following workflows should produce correct builds for emscripten and wasi ```bash cmake --workflow --preset emscripten cmake --workflow --preset wasi ````
1 parent 7020551 commit e140144

File tree

26 files changed

+373
-111
lines changed

26 files changed

+373
-111
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
FROM ubuntu:24.10
22

3+
RUN userdel -f -r ubuntu
4+
35
RUN apt-get update && apt-get install -y \
46
bash-completion \
57
build-essential \
68
clang-format \
79
clangd \
810
cmake \
11+
lldb \
912
ninja-build \
13+
pipx \
1014
python3-pip \
1115
python3-venv \
16+
valgrind \
1217
wget
1318

1419
RUN wget -nd -P /tmp/ https://github.com/watchexec/watchexec/releases/download/v2.2.0/watchexec-2.2.0-$(uname -m)-unknown-linux-gnu.deb \
1520
&& dpkg -i /tmp/watchexec-2.2.0-$(uname -m)-unknown-linux-gnu.deb \
1621
&& rm -f /tmp/watchexec-2.2.0-$(uname -m)-unknown-linux-gnu.deb
22+
23+
RUN wget -nd -P /tmp/ https://github.com/bytecodealliance/wasmtime/releases/download/v25.0.2/wasmtime-v25.0.2-$(uname -m)-linux.tar.xz \
24+
&& tar -C /usr/local/bin -xvf /tmp/wasmtime-v25.0.2-$(uname -m)-linux.tar.xz --strip-components=1 --wildcards 'wasmtime-*-linux/wasmtime' \
25+
&& rm -f /tmp/wasmtime-v25.0.2-$(uname -m)-linux.tar.xz

.devcontainer/devcontainer.json

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,40 @@
77

88
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
99

10-
"hostRequirements": {
11-
"cpus": 4
12-
},
13-
14-
"remoteUser": "vscode",
10+
"postCreateCommand": "./scripts/devcontainer-post-create.sh",
1511

16-
"postCreateCommand": "npm ci",
12+
"containerUser": "vscode",
1713

1814
"features": {
19-
"ghcr.io/devcontainers/features/common-utils": {},
20-
"ghcr.io/devcontainers/features/github-cli": "latest",
21-
"ghcr.io/devcontainers/features/node": "latest"
15+
"ghcr.io/devcontainers/features/common-utils:2": {
16+
"configureZshAsDefaultShell": false,
17+
"installOhMyZsh": false,
18+
"installOhMyZshConfig": false,
19+
"installZsh": false,
20+
"nonFreePackages": false,
21+
"upgradePackages": true,
22+
"userUid": "1000",
23+
"userGid": "1000"
24+
},
25+
"ghcr.io/devcontainers/features/github-cli:1": {},
26+
"ghcr.io/devcontainers/features/node:1": {
27+
"version": "latest"
28+
},
29+
"./features/emscripten": {},
30+
"./features/wasi-sdk": {}
2231
},
2332

2433
"customizations": {
2534
"vscode": {
2635
"extensions": [
2736
"llvm-vs-code-extensions.vscode-clangd",
28-
"llvm-vs-code-extensions.lldb-dap"
37+
"llvm-vs-code-extensions.lldb-dap",
38+
"twxs.cmake",
39+
"ms-vscode.cmake-tools",
40+
"esbenp.prettier-vscode"
2941
],
3042
"settings": {
31-
"clangd.arguments": [
32-
"--compile-commands-dir=build",
33-
"--completion-style=bundled"
34-
]
43+
"clangd.arguments": ["--completion-style=bundled"]
3544
}
3645
}
3746
}

.devcontainer/emscripten_dev/Dockerfile

Lines changed: 0 additions & 26 deletions
This file was deleted.

.devcontainer/emscripten_dev/devcontainer.json

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"id": "emscripten",
3+
"version": "1.0.0",
4+
"name": "Emscripten",
5+
"dependsOn": {
6+
"ghcr.io/devcontainers/features/common-utils": {}
7+
},
8+
"containerEnv": {
9+
"EMSCRIPTEN_ROOT": "/opt/emsdk/upstream/emscripten"
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
git clone --depth 1 http://github.com/emscripten-core/emsdk.git /opt/emsdk
6+
cd /opt/emsdk
7+
./emsdk install latest
8+
./emsdk activate latest
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"id": "wasi-sdk",
3+
"version": "1.0.0",
4+
"name": "Wasi SDK",
5+
"dependsOn": {
6+
"ghcr.io/devcontainers/features/common-utils": {}
7+
},
8+
"containerEnv": {
9+
"WASI_SDK_ROOT": "/opt/wasi-sdk"
10+
}
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
arch=$(uname -m)
6+
7+
if [ "$arch" == "aarch64" ]; then
8+
arch="arm64"
9+
fi
10+
11+
wget -nd -P /tmp/ https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-${arch}-linux.deb
12+
13+
dpkg -i /tmp/wasi-sdk-24.0-${arch}-linux.deb

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
runs-on: ubuntu-24.04
170170

171171
env:
172-
WASMTIME_VERSION: 20.0.2
172+
WASMTIME_VERSION: 25.0.2
173173

174174
steps:
175175
- uses: actions/checkout@v4
@@ -181,12 +181,12 @@ jobs:
181181
182182
- name: Install wasmtime
183183
run: |
184-
wget https://github.com/bytecodealliance/wasmtime/releases/download/v${{ env.WASMTIME_VERSION }}/wasmtime-v${{ env.WASMTIME_VERSION }}-x86_64-linux.tar.xz
185-
tar Jxvf wasmtime-v${{ env.WASMTIME_VERSION }}-x86_64-linux.tar.xz -C ~/
184+
wget -nd -P /tmp/ https://github.com/bytecodealliance/wasmtime/releases/download/v${{ env.WASMTIME_VERSION }}/wasmtime-v${{ env.WASMTIME_VERSION }}-$(uname -m)-linux.tar.xz
185+
tar -C /usr/local/bin -xvf /tmp/wasmtime-v${{ env.WASMTIME_VERSION }}-$(uname -m)-linux.tar.xz --strip-components=1 --wildcards 'wasmtime-*-linux/wasmtime'
186186
187187
- name: Test
188188
run: |
189-
~/wasmtime-v${{ env.WASMTIME_VERSION }}-x86_64-linux/wasmtime \
189+
wasmtime \
190190
--dir ${{github.workspace}}/build.wasi/install::/ \
191191
--dir tests::tests \
192192
${{github.workspace}}/build.wasi/install/usr/bin/cxx.wasm -v tests/manual/source.cc

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ node_modules
66
*.tgz
77
.vscode/launch.json
88
.cache
9+
.clangd
10+
*.pch

0 commit comments

Comments
 (0)