blob: ce928f8533f898665c3c1b80c314701e33713bad [file] [log] [blame]
Geoffrey Martin-Noble15545b42019-11-09 16:40:38 -08001# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Stella Laurenzo1128d502019-10-07 14:34:41 -070015# Workspace file for the IREE project.
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070016# buildozer: disable=positional-args
17
18workspace(name = "iree_core")
Stella Laurenzo196ad742019-10-09 10:33:08 -070019
20load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Stella Laurenzoe7d9e882019-10-10 14:32:38 -070021load(":repo_utils.bzl", "maybe")
Stella Laurenzo196ad742019-10-09 10:33:08 -070022
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070023###############################################################################
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080024# Bazel rules.
Stella Laurenzo196ad742019-10-09 10:33:08 -070025http_archive(
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080026 name = "rules_cc",
27 sha256 = "cf3b76a90c86c0554c5b10f4b160f05af71d252026b71362c4674e2fb9936cf9",
28 strip_prefix = "rules_cc-01d4a48911d5e7591ecb1c06d3b8af47fe872371",
29 urls = [
30 "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
31 "https://github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
32 ],
Stella Laurenzo196ad742019-10-09 10:33:08 -070033)
34
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080035http_archive(
36 name = "rules_python",
37 url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
38 sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070039)
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070040load("@rules_python//python:repositories.bzl", "py_repositories")
41py_repositories()
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080042
43###############################################################################
44
45###############################################################################
46# bazel toolchains rules for remote execution (https://releases.bazel.build/bazel-toolchains.html).
47http_archive(
48 name = "bazel_toolchains",
49 sha256 = "ca8aa49ceb47e9bee04dd67f0bec0b010032b37ebbe67147b535237e801d9a87",
50 strip_prefix = "bazel-toolchains-1.2.2",
51 urls = [
52 "https://github.com/bazelbuild/bazel-toolchains/releases/download/1.2.2/bazel-toolchains-1.2.2.tar.gz",
53 "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1.2.2.tar.gz",
54 ],
55)
56
57load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
58rbe_autoconfig(name = "rbe_default")
59
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070060###############################################################################
61
Stella Laurenzoe7d9e882019-10-10 14:32:38 -070062###############################################################################
63# io_bazel_rules_closure
64# This is copied from https://github.com/tensorflow/tensorflow/blob/v2.0.0-alpha0/WORKSPACE.
65# Dependency of:
66# TensorFlow (boilerplate for tf_workspace(), apparently)
67http_archive(
68 name = "io_bazel_rules_closure",
69 sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
70 strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
71 urls = [
72 "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
73 "https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
74 ],
75)
76###############################################################################
77
78###############################################################################
79# Skylib
80# Dependency of:
81# TensorFlow
82http_archive(
83 name = "bazel_skylib",
84 urls = [
85 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
86 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
87 ],
88 sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
89)
90load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
91bazel_skylib_workspace()
92###############################################################################
93
94###############################################################################
Stella Laurenzo15d8ae42020-01-03 13:52:12 -080095# llvm-project
96load("@iree_core//build_tools/bazel/third_party_import/llvm-project:configure.bzl", "llvm_configure")
97maybe(llvm_configure,
98 name = "llvm-project",
99 workspace = "@iree_core//:WORKSPACE",
100 path = "third_party/llvm-project",
101)
102###############################################################################
103
104###############################################################################
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700105# Bootstrap TensorFlow.
106# Note that we ultimately would like to avoid doing this at the top level like
Scott Todd13aeb4b2020-01-24 15:14:54 -0800107# this but need to unbundle some of the deps from the tensorflow repo first.
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700108# In the mean-time: we're sorry.
109# TODO(laurenzo): Come up with a way to make this optional. Also, see if we can
110# get the TensorFlow tf_repositories() rule to use maybe() so we can provide
111# local overrides safely.
112maybe(local_repository,
113 name = "org_tensorflow",
114 path = "third_party/tensorflow",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700115)
116
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700117# Import all of the tensorflow dependencies.
118load("@org_tensorflow//tensorflow:workspace.bzl", "tf_repositories")
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700119###############################################################################
120
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700121###############################################################################
122# Autoconfigure native build repo for python.
Marius Brehlerb18c3882020-01-14 17:06:28 -0800123load("//bindings/python/build_tools/python:configure.bzl", "python_configure")
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700124
125# TODO(laurenzo): Scoping to "iree" to avoid conflicts with other things that
126# take an opinion until we can isolate.
127maybe(python_configure,
128 name = "iree_native_python",
129)
130###############################################################################
131
Scott Todd0d416202019-11-12 16:22:05 -0800132###############################################################################
133# Find and configure the Vulkan SDK, if installed.
134load("//build_tools/third_party/vulkan_sdk:repo.bzl", "vulkan_sdk_setup")
135maybe(vulkan_sdk_setup,
136 name = "vulkan_sdk",
137)
138###############################################################################
139
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700140maybe(local_repository,
141 name = "com_google_absl",
142 path = "third_party/abseil-cpp",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700143)
144
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700145maybe(local_repository,
146 name = "com_google_googletest",
147 path = "third_party/googletest",
148)
149
150# Note that TensorFlow provides this as "flatbuffers" which is wrong.
151# It is only used for TFLite and may cause ODR issues if not fixed.
152maybe(local_repository,
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700153 name = "com_github_google_flatbuffers",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700154 path = "third_party/flatbuffers",
155)
156
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700157maybe(new_local_repository,
Stella Laurenzo196ad742019-10-09 10:33:08 -0700158 name = "com_google_tracing_framework_cpp",
159 path = "third_party/google_tracing_framework/bindings/cpp",
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700160 build_file = "build_tools/third_party/google_tracing_framework_cpp/BUILD.overlay",
161)
162
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700163maybe(new_local_repository,
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700164 name = "vulkan_headers",
165 path = "third_party/vulkan_headers",
166 build_file = "build_tools/third_party/vulkan_headers/BUILD.overlay",
167)
168
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700169maybe(new_local_repository,
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700170 name = "vulkan_memory_allocator",
171 path = "third_party/vulkan_memory_allocator",
172 build_file = "build_tools/third_party/vulkan_memory_allocator/BUILD.overlay",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700173)
Stella Laurenzo5e8573b2019-10-10 15:31:51 -0700174
175maybe(new_local_repository,
176 name = "glslang",
177 path = "third_party/glslang",
178 build_file = "build_tools/third_party/glslang/BUILD.overlay",
179)
180
181maybe(local_repository,
182 name = "spirv_tools",
183 path = "third_party/spirv_tools",
184)
185
186maybe(local_repository,
187 name = "spirv_headers",
188 path = "third_party/spirv_headers",
189)
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700190
191# TODO(laurenzo): TensorFlow is squatting on the pybind11 repo name, so
192# we use a temporary one until resolved. Theirs pulls in a bunch of stuff.
193maybe(new_local_repository,
194 name = "iree_pybind11",
195 path = "third_party/pybind11",
196 build_file = "build_tools/third_party/pybind11/BUILD.overlay",
197)
Stella Laurenzo0da4af52019-10-23 12:54:53 -0700198
199maybe(local_repository,
200 name = "com_google_benchmark",
201 path = "third_party/benchmark")
Scott Toddf7003552019-11-11 09:14:19 -0800202
203maybe(new_local_repository,
204 name = "sdl2",
205 path = "third_party/sdl2",
206 build_file = "build_tools/third_party/sdl2/BUILD.overlay",
207)
208
209maybe(new_local_repository,
210 name = "sdl2_config",
211 path = "build_tools/third_party/sdl2",
212 build_file_content = """
213package(default_visibility = ["//visibility:public"])
214cc_library(name = "headers", srcs = glob(["*.h"]))
215""",
216)
Scott Todd0d416202019-11-12 16:22:05 -0800217
218maybe(new_local_repository,
219 name = "dear_imgui",
220 path = "third_party/dear_imgui",
221 build_file = "build_tools/third_party/dear_imgui/BUILD.overlay",
222)
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800223
224# Bootstrap TensorFlow deps last so that ours can take precedence.
225tf_repositories()