From bcd2b9d03952bfeaec299aaa8cd481f2e4ae6dfe Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 24 Jan 2025 19:57:52 +0100 Subject: [PATCH] Add Bazel docs (#8510) --- docs/source/building.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/source/building.md b/docs/source/building.md index 21f80e3b2..93c4d2b84 100644 --- a/docs/source/building.md +++ b/docs/source/building.md @@ -75,6 +75,20 @@ Once the project files are generated, build as normal for your platform. ## Building with Bazel +You can use [Bazelisk](https://github.com/bazelbuild/bazelisk) to manage your Bazel environment. +For Swift support, you also need Clang and [Swift SDK](https://download.swift.org/). + +```sh +curl -sL --fail https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 -o bazelisk && chmod +x bazelisk +sudo apt install -y clang +SWIFT_VERSION="6.0.3" +curl -L https://download.swift.org/swift-${SWIFT_VERSION}-release/debian12/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-debian12.tar.gz | tar xz +CC=clang PATH=$PATH:$(pwd)/swift-${SWIFT_VERSION}-RELEASE-debian12/usr/bin bazel build //... +CC=clang PATH=$PATH:$(pwd)/swift-${SWIFT_VERSION}-RELEASE-debian12/usr/bin bazel test //... +``` + +If you are unsure which versions to use, check our CI config at `.bazelci/presubmit.yml`. + ## Building with VCPKG You can download and install flatbuffers using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: