Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Bazel support #1434

Merged
merged 6 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.1
7.2.1
41 changes: 41 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,47 @@ cc_library(
],
)

cc_test(
name = "test_mutex",
srcs = [
"test/tbb/test_mutex.cpp",
"test/tbb/test_mutex.h"
] + glob([
"test/common/*.h",
]),
includes = ["test"],
deps = [
":tbb",
],
)

cc_test(
name = "test_parallel_for",
srcs = [
"test/tbb/test_parallel_for.cpp",
"test/tbb/test_partitioner.h"
] + glob([
"test/common/*.h",
]),
includes = ["test"],
deps = [
":tbb",
],
)

cc_test(
name = "test_parallel_reduce",
srcs = [
"test/tbb/test_parallel_reduce.cpp",
] + glob([
"test/common/*.h",
]),
includes = ["test"],
deps = [
":tbb",
],
)

cc_test(
name = "test_task",
srcs = [
Expand Down
12 changes: 12 additions & 0 deletions Bazel.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The standard Bazel approach to handling third-party libraries is static linking.

## Using oneTBB as a dependency

### Traditional WORKSPACE approach

This example demonstrates how to use oneTBB as a dependency within a Bazel project.

The following file structure is assumed:
Expand Down Expand Up @@ -78,6 +80,16 @@ The expected output of this program is the current version of oneTBB.

Switch to the folder with the files created earlier and run the binary with `bazel run //:Demo`.

### Bzlmod

If you use Bzlmod, you can fetch oneTBB with the [Bazel Central Registry](https://registry.bazel.build/).

Add the following line to your `MODULE.bazel` file:

```bazel
bazel_dep(name = "onetbb", version = "2021.13.0")
```

## Build oneTBB using Bazel

Run ```bazel build //...``` in the oneTBB root directory.
Expand Down
6 changes: 5 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
/oneTBB/python/ @sarathnandu
/oneTBB/python/ @isaevil


# Bazel build related files.
/oneTBB/.bazelversion @Vertexwahn
/oneTBB/Bazel.md @Vertexwahn
/oneTBB/BUILD.bazel @Vertexwahn
/oneTBB/MODULE.bazel @Vertexwahn
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "platforms", version = "0.0.10")
65 changes: 65 additions & 0 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading