Skip to content
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

Pin vcpkg commit #1033

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .github/workflows/vcpkg_docker_amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
host:
- { name: 'ubuntu-22.04', arch: '' }
container:
- { version: '20.04', codename: 'focal' }
- { version: '22.04', codename: 'jammy' }

runs-on: ${{ matrix.host.name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vcpkg_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: release
jobs:
release:
name: Publish Release on GitHub
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Create Release
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ To use the dependencies, just download the compressed file and decompress it. Th
For example:

```bash
curl -LO https://github.com/lifting-bits/cxx-common/releases/latest/download/vcpkg_ubuntu-20.04_llvm-15_amd64.tar.xz
tar -xJf vcpkg_ubuntu-20.04_llvm-15_amd64.tar.xz
curl -LO https://github.com/lifting-bits/cxx-common/releases/latest/download/vcpkg_ubuntu-22.04_llvm-16_amd64.tar.xz
tar -xJf vcpkg_ubuntu-22.04_llvm-16_amd64.tar.xz
```

Will produce a directory, and then you'll have to set the following during your CMake configure command to use these dependencies!

```text
-DCMAKE_TOOLCHAIN_FILE="<...>/vcpkg_ubuntu-20.04_llvm-15_amd64/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-linux-rel
-DCMAKE_TOOLCHAIN_FILE="<...>/vcpkg_ubuntu-22.04_llvm-16_amd64/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-linux-rel
```

Replace `x64-linux-rel` with `x64-osx-rel` if using the macOS pre-built download.
Expand All @@ -29,12 +29,12 @@ Replace `x64-linux-rel` with `x64-osx-rel` if using the macOS pre-built download

If you aren't running a supported operating system, or you want to have dependencies with a build type other than `Release`, you can build everything from source using the `./build_dependencies.sh` script (pass `--help` to see available options).

By default, the script will install the dependencies listed in [`dependencies.txt`](./dependencies.txt), which doesn't include an LLVM version, so passing an `llvm-15` string as an argument will actually be passed to [`vcpkg install`](https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#install). Any other strings not matching the script's own options are also passed to the `vcpkg install` command. Furthermore, without specifying any other build script options, vcpkg determine determine the best triplet for your operating system, which means building _both_ `Debug` and `Release` build types (see the [vcpkg triplet docs](https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md) for more info).
By default, the script will install the dependencies listed in [`dependencies.txt`](./dependencies.txt), which doesn't include an LLVM version, so passing an `llvm-16` string as an argument will actually be passed to [`vcpkg install`](https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#install). Any other strings not matching the script's own options are also passed to the `vcpkg install` command. Furthermore, without specifying any other build script options, vcpkg determine determine the best triplet for your operating system, which means building _both_ `Debug` and `Release` build types (see the [vcpkg triplet docs](https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md) for more info).

You can customize the features that a particular package is built with by specifying the feature name between brackets, i.e. `llvm-15[target-all]` (build all target backends), to ensure non-default features are also installed along with all default features. The list of features can be found in the target port's `vcpkg.json` file. Please read the [vcpkg docs](https://github.com/microsoft/vcpkg/blob/master/docs/users/selecting-library-features.md#installing-additional-features) for more information about specifying additional features.
You can customize the features that a particular package is built with by specifying the feature name between brackets, i.e. `llvm-16[target-all]` (build all target backends), to ensure non-default features are also installed along with all default features. The list of features can be found in the target port's `vcpkg.json` file. Please read the [vcpkg docs](https://github.com/microsoft/vcpkg/blob/master/docs/users/selecting-library-features.md#installing-additional-features) for more information about specifying additional features.

```bash
./build_dependencies.sh llvm-15
./build_dependencies.sh llvm-16
```

Note that vcpkg will use binary caching to store built dependency packages (usually at `~/.cache/vcpkg` or manually set with environment variable `VCPKG_DEFAULT_BINARY_CACHE`) so that upon reinstallation/rebuilding (re-running the script) you likely won't have to rebuild everything from scratch, unless the package itself has been updated, you are using a different vcpkg triplet, your compiler has been changed/update, or any of the vcpkg scripts have changed (updated vcpkg repo). If you'd like to turn off [binary caching](https://github.com/microsoft/vcpkg/blob/master/docs/users/binarycaching.md) (not recommended), then you can either pass `--no-binarycaching` to the build script after the main options listed in or add `-binarycaching` to the `VCPKG_FEATURE_FLAGS` environment variable.
Expand All @@ -46,25 +46,25 @@ Note that vcpkg will use binary caching to store built dependency packages (usua
Passing `--export-dir <DIR>` to the `./build_dependencies.sh` script, you can install the chosen dependencies in a separate directory. Otherwise, the built dependencies will be stored within the vcpkg repo directory itself (`vcpkg/installed` relative path if in the root of this repo). Separate export directories are required to keep track of different LLVM versions, since they cannot coexist within the same export (read: installation) directory.

```bash
./build_dependencies.sh --export-dir vcpkg-llvm-15-install llvm-15
./build_dependencies.sh --export-dir vcpkg-llvm-16-install llvm-16
```

will build all of the dependencies listed in `dependencies.txt` _and_ LLVM 15 and install into a local directory named `vcpkg-llvm-15-install`.
will build all of the dependencies listed in `dependencies.txt` _and_ LLVM 15 and install into a local directory named `vcpkg-llvm-16-install`.

Furthermore, you are able to install additional dependencies into an existing exported directory created by this script by setting the `--export-dir <path>` to the same path:

```bash
./build_dependencies.sh --release --export-dir "<...>/vcpkg_ubuntu-20.04_llvm-15_amd64" spdlog
./build_dependencies.sh --release --export-dir "<...>/vcpkg_ubuntu-22.04_llvm-16_amd64" spdlog
```

When reusing the pre-built export directory downloaded from GitHub, you must specify `--release` (see the 'Debug and Release Builds' section below) to build only release binaries. You cannot use dependencies from different triplets.

### Debug and Release Builds

To build both debug and release versions with llvm-15, just run the following
To build both debug and release versions with llvm-16, just run the following

```bash
./build_dependencies.sh llvm-15
./build_dependencies.sh llvm-16
```

The script will be verbose about what it is doing and will clone the correct version of vcpkg (found in `vcpkg_info.txt`) and build everything in the `vcpkg` directory in the root of this repo.
Expand All @@ -83,7 +83,7 @@ $ ./build_dependencies.sh --export-dir example-export-dir
If you don't want to compile a debug version of the tools, just pass `--release` to the script.

```bash
$ ./build_dependencies.sh --release llvm-15
$ ./build_dependencies.sh --release llvm-16
...
[+] Set the following in your CMake configure command to use these dependencies!
[+] -DCMAKE_TOOLCHAIN_FILE="/Users/ekilmer/src/cxx-common/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-osx-rel -DVCPKG_HOST_TRIPLET=x64-osx-rel
Expand All @@ -98,7 +98,7 @@ There is experimental support for compiling dependencies with address sanitizer
These dependencies can be built with the script by passing `--asan` to the script, and it should work whether building only Release or both Debug and Release:

```bash
./build_dependencies.sh [--release] --asan llvm-15
./build_dependencies.sh [--release] --asan llvm-16
```

Just because your dependencies were built with a sanitizer, you'll still need to manually add support for sanitizer usage within your own project. A quick and dirty way involves specifying the extra compilation flags during CMake configure:
Expand Down
2 changes: 1 addition & 1 deletion vcpkg_info.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://github.com/trail-of-forks/vcpkg.git
cxx-common
e32948cca1926244ab0d9ccc31bfd20a048cd3d7