Skip to content

Commit

Permalink
Coalesce vcpkg_installed directories. Fixes #56.
Browse files Browse the repository at this point in the history
Removes explicit `vcpkg install` command in Docker build which uses a different `vcpkg_installed` directory from the toolchain (by default).
  • Loading branch information
mross-ua committed Jul 13, 2024
1 parent b0a4637 commit 7a01f66
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 16 deletions.
7 changes: 3 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
#**/.git
#**/.gitignore

# we bind-mount these to get build output and to take
# advantage of vcpkg binary caching on the host
# we bind-mount this to get build output and to take
# advantage of any vcpkg binary cache on the host
build/
vcpkg_installed/

# these directories can be immense in size and should be
# superseded by a bind-mounted binary cache (vcpkg_installed/)
# superseded by a bind-mounted binary cache (i.e. `build/vcpkg_installed`)
vendor/microsoft/vcpkg/buildtrees/
vendor/microsoft/vcpkg/downloads/
vendor/microsoft/vcpkg/packages/
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
uses: actions/cache@v4
with:
key: vcpkg-${{ runner.os }}-${{ hashFiles('**/vcpkg.json') }}
path: vcpkg_installed
path: build/vcpkg_installed
save-always: true

- name: Build Docker image
Expand All @@ -56,7 +56,6 @@ jobs:
run: |
docker run \
-v "${{ github.workspace }}/build:/src/build" \
-v "${{ github.workspace }}/vcpkg_installed:/src/vcpkg_installed" \
kdeck-build
- name: Record hash
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
**/__pycache__

build/**
vcpkg_installed/**
CMakeUserPresets.json
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Linux",
"includePath": [
"${workspaceFolder}/include/**",
"${workspaceFolder}/vcpkg_installed/x64-linux/include/**",
"${workspaceFolder}/build/vcpkg_installed/x64-linux/include/**",
"/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2",
"/usr/include/wx-3.2"
],
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ SHELL ["/bin/bash", "-c"]

#TODO it's not clear why we need CMAKE_MAKE_PROGRAM; this is supposed to be detected automatically;
# is it because the shell form of RUN doesn't capture environment variables? (a new shell is invoked)
CMD ./vendor/microsoft/vcpkg/vcpkg install \
&& cmake -DCMAKE_MAKE_PROGRAM=make --preset release \
CMD cmake -DCMAKE_MAKE_PROGRAM=make --preset release \
&& cmake --build --preset release
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,7 @@ docker run -v "$(pwd)/build:/src/build" kdeck-build

You will find the final build output under `$(pwd)/build/bin`. The container is no longer needed.

For repeated builds, **you should persist vcpkg's binary cache of installed dependencies with an additional bind mount:**

```bash
docker build -t kdeck-build .
docker run -v "$(pwd)/build:/src/build" -v "$(pwd)/vcpkg_installed:/src/vcpkg_installed" kdeck-build
```
For subsequent builds, vcpkg will make use of the binary cache under `$(pwd)/build/vcpkg_installed`, resulting in quicker turnarounds.

> [!WARNING]
> This is the default vcpkg binary cache directory for this project. If your host system is Debian 12 (Bookworm), it should be safe to bind-mount this directory and share installed dependencies with the container. Users on other systems wishing to build with and without Docker may want to bind-mount to a different host directory (although builds targeting different system triplets can coexist).
Expand Down

0 comments on commit 7a01f66

Please sign in to comment.