Skip to content

Latest commit

 

History

History
145 lines (95 loc) · 3.92 KB

BAZEL.md

File metadata and controls

145 lines (95 loc) · 3.92 KB

SkCMS Bazel build

This file provides instructions on how to build and test SkCMS using Bazel.

Linux

Building and testing locally

Open a terminal and cd into your SkCMS repository checkout, then run:

$ bazel build //...

$ bazel test //...

To include debug symbols, add --compilation_mode=dbg to your commands.

Building and testing on RBE

Same as above, but add --config=linux-rbe to your bazel invocation, e.g.:

$ bazel build //... --config=linux-rbe

$ bazel test //... --config=linux-rbe

Note that you need to obtain RBE credentials for this to work (instructions below).

macOS

Ensure you have a local Xcode installation, then run:

$ bazel build //...

$ bazel test //...

Our Bazel macOS build does not support RBE at this time.

Note however that it is possible to use RBE from macOS to cross-compile for Linux and run tests on Linux RBE workers, e.g.:

$ bazel build //... --config=linux-rbe

$ bazel test //... --config=linux-rbe

Windows

SkCMS can be compiled with either Microsoft Build Tools for Visual Studio 2019 or Clang.

Before continuing, install Bazel by following the instructions here. Make sure to include bazel binary in your PATH.

Note that Bazel requires symlink support to function properly. Enable symlink support by enabling Developer Mode, or by running Bazel as an administrator (reference).

Building and testing locally

The below instructions are based on the Build on Windows section of the Bazel documentation.

With Build Tools for Visual Studio 2019

Download and install Build Tools for Visual Studio 2019 using this link. Select "Desktop development with C++" on the installation wizard, and leave all other items unchanged.

Open cmd.exe and cd into your SkCMS repository checkout. Set the BAZEL_VC environment variable to point to your Build Tools for Visual Studio 2019 installation:

> set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC

Then run:

> bazel build //...

> bazel test //... --enable_runfiles

Reference here.

TODO(lovisolo): Consider adding --enable_runfiles to //.bazelrc.

With Clang

In order to build with Clang, you have to install both LLVM and Build Tools for Visual Studio 2019 (rationale here). Please install the latter by following the above instructions before proceeding.

Download and install LLVM from this link.

Open cmd.exe and cd into your SkCMS repository checkout, then run:

> bazel build //... --compiler=clang-cl

> bazel test //... --compiler=clang-cl --enable_runfiles

If the above commands fail because Bazel cannot find your LLVM installation, set the BAZEL_LLVM environment variable to point to your LLVM installation:

> set BAZEL_LLVM=C:\Program Files\LLVM

Reference here.

TODO(lovisolo): Investigate adding a platform target to the top-level BUILD.bazel file as per the instructions here.

Building and testing on RBE

TODO(lovisolo)

RBE Credentials

gcloud auth application-default login

Settings in .bazelrc should look to use those default Google cloud credentials.