Skip to content

Commit f44b422

Browse files
committed
Add Bazel workspace
1 parent 69d2750 commit f44b422

15 files changed

+820
-0
lines changed

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build --cxxopt=-std=c++17
2+
build --cxxopt=-Wno-sign-compare --cxxopt=-Wno-attributes
3+
build:lua5_1 --define lua=lua5_1
4+
build:lua5_2 --define lua=lua5_2
5+
build:luajit --define lua=luajit

WORKSPACE

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
workspace(name = "org_deepmind_lab2d")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
6+
name = "com_google_googletest",
7+
strip_prefix = "googletest-master",
8+
urls = ["https://github.com/google/googletest/archive/master.zip"],
9+
)
10+
11+
http_archive(
12+
name = "com_google_benchmark",
13+
strip_prefix = "benchmark-master",
14+
urls = ["https://github.com/google/benchmark/archive/master.zip"],
15+
)
16+
17+
http_archive(
18+
name = "rules_cc",
19+
strip_prefix = "rules_cc-master",
20+
urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"],
21+
)
22+
23+
http_archive(
24+
name = "bazel_skylib",
25+
strip_prefix = "bazel-skylib-master",
26+
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/master.zip"],
27+
)
28+
29+
http_archive(
30+
name = "com_google_absl",
31+
strip_prefix = "abseil-cpp-master",
32+
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
33+
)
34+
35+
http_archive(
36+
name = "com_google_absl_py",
37+
strip_prefix = "abseil-py-master",
38+
urls = ["https://github.com/abseil/abseil-py/archive/master.zip"],
39+
)
40+
41+
http_archive(
42+
name = "enum34_archive",
43+
build_file = "@com_google_absl_py//third_party:enum34.BUILD",
44+
sha256 = "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1",
45+
urls = [
46+
"https://mirror.bazel.build/pypi.python.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz",
47+
"https://pypi.python.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz",
48+
],
49+
)
50+
51+
http_archive(
52+
name = "funcsigs_archive",
53+
build_file = "@//bazel:funcsigs.BUILD",
54+
strip_prefix = "funcsigs-1.0.2",
55+
urls = [
56+
"https://pypi.python.org/packages/94/4a/db842e7a0545de1cdb0439bb80e6e42dfe82aaeaadd4072f2263a4fbed23/funcsigs-1.0.2.tar.gz",
57+
],
58+
)
59+
60+
http_archive(
61+
name = "eigen_archive",
62+
build_file = "@//bazel:eigen.BUILD",
63+
sha256 = "9a01fed6311df359f3f9af119fcf298a3353aef7d1b1bc86f6c8ae0ca6a2f842",
64+
strip_prefix = "/eigen-eigen-5d5dd50b2eb6",
65+
urls = [
66+
"https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/5d5dd50b2eb6.zip",
67+
"https://bitbucket.org/eigen/eigen/get/5d5dd50b2eb6.zip",
68+
],
69+
)
70+
71+
http_archive(
72+
name = "png_archive",
73+
build_file = "@//bazel:png.BUILD",
74+
sha256 = "7ffa5eb8f9f3ed23cf107042e5fec28699718916668bbce48b968600475208d3",
75+
strip_prefix = "libpng-1.6.34",
76+
urls = [
77+
"https://mirror.bazel.build/github.com/glennrp/libpng/archive/v1.6.34.zip",
78+
"https://github.com/glennrp/libpng/archive/v1.6.34.zip",
79+
],
80+
)
81+
82+
http_archive(
83+
name = "zlib_archive",
84+
build_file = "@//bazel:zlib.BUILD",
85+
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
86+
strip_prefix = "zlib-1.2.11",
87+
urls = [
88+
"https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz",
89+
"https://zlib.net/zlib-1.2.11.tar.gz",
90+
],
91+
)
92+
93+
http_archive(
94+
name = "six_archive",
95+
build_file = "@//bazel:six.BUILD",
96+
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
97+
strip_prefix = "six-1.10.0",
98+
urls = [
99+
"https://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
100+
"https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
101+
],
102+
)
103+
104+
http_archive(
105+
name = "lua5_1_archive",
106+
build_file = "@//bazel:lua5_1.BUILD",
107+
sha256 = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333",
108+
strip_prefix = "lua-5.1.5/src",
109+
urls = [
110+
"https://mirror.bazel.build/www.lua.org/ftp/lua-5.1.5.tar.gz",
111+
"https://www.lua.org/ftp/lua-5.1.5.tar.gz",
112+
],
113+
)
114+
115+
http_archive(
116+
name = "lua5_2_archive",
117+
build_file = "@//bazel:lua5_2.BUILD",
118+
strip_prefix = "lua-5.2.4/src",
119+
urls = [
120+
"https://mirror.bazel.build/www.lua.org/ftp/lua-5.2.4.tar.gz",
121+
"https://www.lua.org/ftp/lua-5.2.4.tar.gz",
122+
],
123+
)
124+
125+
http_archive(
126+
name = "luajit_archive",
127+
build_file = "@//bazel:luajit.BUILD",
128+
sha256 = "409f7fe570d3c16558e594421c47bdd130238323c9d6fd6c83dedd2aaeb082a8",
129+
strip_prefix = "LuaJIT-2.1.0-beta3",
130+
urls = ["https://github.com/LuaJIT/LuaJIT/archive/v2.1.0-beta3.tar.gz"],
131+
)
132+
133+
http_archive(
134+
name = "dm_env_archive",
135+
build_file = "@//bazel:dm_env.BUILD",
136+
strip_prefix = "dm_env-master",
137+
urls = ["https://github.com/deepmind/dm_env/archive/master.zip"],
138+
)
139+
140+
http_archive(
141+
name = "tree_archive",
142+
repo_mapping = {
143+
"@python_headers": "@python_system",
144+
},
145+
strip_prefix = "tree-master",
146+
urls = ["https://github.com/deepmind/tree/archive/master.zip"],
147+
)
148+
149+
http_archive(
150+
name = "pybind11_archive",
151+
build_file = "@tree_archive//external:pybind11.BUILD",
152+
strip_prefix = "pybind11-master",
153+
urls = ["https://github.com/pybind/pybind11/archive/master.zip"],
154+
)
155+
156+
new_local_repository(
157+
name = "python_system",
158+
build_file = "@//bazel:python.BUILD",
159+
path = "/usr/include",
160+
)

bazel/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
licenses(["notice"])

bazel/dm_env.BUILD

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Description:
2+
# Bazel BUILD rules for "dm_env" (https://github.com/deepmind/dm_env),
3+
# a Python API for reinforcement learning environments.
4+
5+
py_library(
6+
name = "dm_env",
7+
srcs = [
8+
"dm_env/__init__.py",
9+
"dm_env/_environment.py",
10+
"dm_env/_metadata.py",
11+
"dm_env/specs.py",
12+
],
13+
visibility = ["//visibility:public"],
14+
deps = [
15+
"@funcsigs_archive//:funcsigs",
16+
"@six_archive//:six",
17+
],
18+
)
19+
20+
py_library(
21+
name = "test_utils",
22+
srcs = [
23+
"dm_env/_abstract_test_mixin.py",
24+
"dm_env/test_utils.py",
25+
],
26+
visibility = ["//visibility:public"],
27+
deps = [
28+
":dm_env",
29+
"@com_google_absl_py//absl/testing:absltest",
30+
"@tree_archive//tree",
31+
],
32+
)

bazel/eigen.BUILD

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Description:
2+
# Eigen is a C++ template library for linear algebra: vectors,
3+
# matrices, and related algorithms.
4+
5+
licenses([
6+
# Note: Eigen is an MPL2 library that includes GPL v3 and LGPL v2.1+ code.
7+
# We've taken special care to not reference any restricted code.
8+
"reciprocal", # MPL2
9+
"notice", # Portions BSD
10+
])
11+
12+
# License-restricted (i.e. not reciprocal or notice) files inside Eigen/...
13+
EIGEN_RESTRICTED_FILES = [
14+
"Eigen/src/OrderingMethods/Amd.h",
15+
"Eigen/src/SparseCholesky/**",
16+
]
17+
18+
# Notable transitive dependencies of restricted files inside Eigen/...
19+
EIGEN_RESTRICTED_DEPS = [
20+
"Eigen/Eigen",
21+
"Eigen/IterativeLinearSolvers",
22+
"Eigen/MetisSupport",
23+
"Eigen/Sparse",
24+
"Eigen/SparseCholesky",
25+
"Eigen/SparseLU",
26+
]
27+
28+
# Note: unsupported/Eigen is unsupported and might go away at any time.
29+
EIGEN_FILES = [
30+
"Eigen/**",
31+
"unsupported/Eigen/CXX11/**",
32+
"unsupported/Eigen/FFT",
33+
"unsupported/Eigen/KroneckerProduct",
34+
"unsupported/Eigen/src/FFT/**",
35+
"unsupported/Eigen/src/KroneckerProduct/**",
36+
"unsupported/Eigen/MatrixFunctions",
37+
"unsupported/Eigen/SpecialFunctions",
38+
"unsupported/Eigen/src/SpecialFunctions/**",
39+
]
40+
41+
# List of files picked up by glob but actually part of another target.
42+
EIGEN_EXCLUDE_FILES = [
43+
"Eigen/src/Core/arch/AVX/PacketMathGoogleTest.cc",
44+
]
45+
46+
# Files known to be under MPL2 license.
47+
EIGEN_MPL2_HEADER_FILES = glob(
48+
EIGEN_FILES,
49+
exclude = EIGEN_EXCLUDE_FILES +
50+
EIGEN_RESTRICTED_FILES +
51+
EIGEN_RESTRICTED_DEPS + [
52+
# Guarantees any file missed by excludes above will not compile.
53+
"Eigen/src/Core/util/NonMPL2.h",
54+
"Eigen/**/CMakeLists.txt",
55+
],
56+
)
57+
58+
cc_library(
59+
name = "eigen",
60+
hdrs = EIGEN_MPL2_HEADER_FILES,
61+
defines = [
62+
# This define (mostly) guarantees we don't link any problematic
63+
# code. We use it, but we do not rely on it, as evidenced above.
64+
"EIGEN_MPL2_ONLY",
65+
],
66+
includes = ["."],
67+
visibility = ["//visibility:public"],
68+
)

bazel/enum34.BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
licenses(["notice"])
4+
5+
py_library(
6+
name = "enum",
7+
srcs = ["enum34-1.1.6/enum/__init__.py"],
8+
)

bazel/funcsigs.BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Description:
2+
# funcsigs provides a backport of the inspect module for Python 2.
3+
4+
py_library(
5+
name = "funcsigs",
6+
srcs = [
7+
"funcsigs/__init__.py",
8+
"funcsigs/version.py",
9+
],
10+
srcs_version = "PY2AND3",
11+
visibility = ["//visibility:public"],
12+
)

bazel/lua5_1.BUILD

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Description:
2+
# Build rule for Lua 5.1.
3+
4+
cc_library(
5+
name = "lua5_1",
6+
srcs = glob(
7+
include = [
8+
"*.c",
9+
"*.h",
10+
],
11+
exclude = [
12+
"lauxlib.h",
13+
"lua.c",
14+
"lua.h",
15+
"luac.c",
16+
"lualib.h",
17+
"print.c",
18+
],
19+
),
20+
hdrs = [
21+
"lauxlib.h",
22+
"lua.h",
23+
"lualib.h",
24+
],
25+
visibility = ["//visibility:public"],
26+
)

bazel/lua5_2.BUILD

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Description:
2+
# Build rule for Lua 5.2.
3+
4+
cc_library(
5+
name = "lua5_2",
6+
srcs = glob(
7+
include = [
8+
"*.c",
9+
"*.h",
10+
],
11+
exclude = [
12+
"lauxlib.h",
13+
"lua.c",
14+
"lua.h",
15+
"luac.c",
16+
"lualib.h",
17+
"print.c",
18+
],
19+
),
20+
hdrs = [
21+
"lauxlib.h",
22+
"lua.h",
23+
"lualib.h",
24+
],
25+
visibility = ["//visibility:public"],
26+
)

0 commit comments

Comments
 (0)