19cc1ddd3SGeoffrey Martin-Noble# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
29cc1ddd3SGeoffrey Martin-Noble# See https://llvm.org/LICENSE.txt for license information.
39cc1ddd3SGeoffrey Martin-Noble# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
49cc1ddd3SGeoffrey Martin-Noble
59cc1ddd3SGeoffrey Martin-Noble"""An example WORKSPACE for configuring LLVM using a git submodule."""
69cc1ddd3SGeoffrey Martin-Noble
79cc1ddd3SGeoffrey Martin-Nobleworkspace(name = "submodule_example")
89cc1ddd3SGeoffrey Martin-Noble
9*8b86b3a8SGeoffrey Martin-NobleSKYLIB_VERSION = "1.0.3"
10*8b86b3a8SGeoffrey Martin-Noble
11*8b86b3a8SGeoffrey Martin-Noblehttp_archive(
12*8b86b3a8SGeoffrey Martin-Noble    name = "bazel_skylib",
13*8b86b3a8SGeoffrey Martin-Noble    sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
14*8b86b3a8SGeoffrey Martin-Noble    urls = [
15*8b86b3a8SGeoffrey Martin-Noble        "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version=SKYLIB_VERSION),
16*8b86b3a8SGeoffrey Martin-Noble        "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version=SKYLIB_VERSION),
17*8b86b3a8SGeoffrey Martin-Noble    ],
18*8b86b3a8SGeoffrey Martin-Noble)
19*8b86b3a8SGeoffrey Martin-Noble
209cc1ddd3SGeoffrey Martin-Noble# Or wherever your submodule is located.
219cc1ddd3SGeoffrey Martin-NobleSUBMODULE_PATH = "third_party/llvm-project"
229cc1ddd3SGeoffrey Martin-Noble
239cc1ddd3SGeoffrey Martin-Noblelocal_repository(
249cc1ddd3SGeoffrey Martin-Noble    name = "llvm-bazel",
259cc1ddd3SGeoffrey Martin-Noble    path = SUBMODULE_PATH + "/utils/bazel",
269cc1ddd3SGeoffrey Martin-Noble)
279cc1ddd3SGeoffrey Martin-Noble
28d08f8960SGeoffrey Martin-Nobleload("@llvm-bazel//:configure.bzl", "llvm_configure", "llvm_disable_optional_support_deps")
29d08f8960SGeoffrey Martin-Noble
309cc1ddd3SGeoffrey Martin-Noblellvm_configure(
319cc1ddd3SGeoffrey Martin-Noble    name = "llvm-project",
329cc1ddd3SGeoffrey Martin-Noble    src_path = SUBMODULE_PATH,
339cc1ddd3SGeoffrey Martin-Noble    src_workspace = "@submodule_example//:WORKSPACE",
349cc1ddd3SGeoffrey Martin-Noble)
359cc1ddd3SGeoffrey Martin-Noble
369cc1ddd3SGeoffrey Martin-Noble# Disables optional dependencies for Support like zlib and terminfo. You may
379cc1ddd3SGeoffrey Martin-Noble# instead want to configure them using the macros in the corresponding bzl
389cc1ddd3SGeoffrey Martin-Noble# files.
399cc1ddd3SGeoffrey Martin-Noblellvm_disable_optional_support_deps()
40