1# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2# See https://llvm.org/LICENSE.txt for license information.
3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5"""An example WORKSPACE for configuring LLVM using a git submodule."""
6
7workspace(name = "submodule_example")
8
9SKYLIB_VERSION = "1.0.3"
10
11http_archive(
12    name = "bazel_skylib",
13    sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
14    urls = [
15        "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version=SKYLIB_VERSION),
16        "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version=SKYLIB_VERSION),
17    ],
18)
19
20# Or wherever your submodule is located.
21SUBMODULE_PATH = "third_party/llvm-project"
22
23local_repository(
24    name = "llvm-bazel",
25    path = SUBMODULE_PATH + "/utils/bazel",
26)
27
28load("@llvm-bazel//:configure.bzl", "llvm_configure", "llvm_disable_optional_support_deps")
29
30llvm_configure(
31    name = "llvm-project",
32    src_path = SUBMODULE_PATH,
33    src_workspace = "@submodule_example//:WORKSPACE",
34)
35
36# Disables optional dependencies for Support like zlib and terminfo. You may
37# instead want to configure them using the macros in the corresponding bzl
38# files.
39llvm_disable_optional_support_deps()
40