blob: 359d941eb8353a472b51474f542222a39027ab27 [file] [log] [blame]
# Part of the Crubit project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Provide LLVM from a local tree built with CMake.
llvm_install_tree_build_file_contents = """
package(default_visibility = ["//visibility:public"])
# An extremely coarse-grained target that provides *all* headers and libraries.
cc_library(
name = "all",
srcs = glob([
"lib/*.a",
], exclude = [
"**/*.i386.a",
]),
hdrs = glob([
"include/**",
]),
includes = [
"include/",
],
linkopts = ["-lncurses", "-lz"],
)
"""
def llvm_repository(name):
# First, create an intermediate repo that overlays the BUILD file onto the
# prebuilt LLVM tree, yielding the single ":all" target.
native.new_local_repository(
name = "prebuilt-llvm",
path = "${LLVM_INSTALL_PATH}", # template value
build_file_content = llvm_install_tree_build_file_contents,
)
# Next, create the final repo that emulates the layout of Bazel targets in
# llvm-project.
native.local_repository(
name = name,
path = "bazel/llvm_project",
)