Is there a way to do this? I'm trying to build parts of the AWS SDK (s3 and rds) to use in my Bazel project. I've heard that rules_foreign_cc
can be used to integrate CMake projects with Bazel.
Asked
Active
Viewed 562 times
3

user15507541
- 43
- 1
- 3
2 Answers
3
tensorflow-io contains bazel build files here:
Might be slightly cleaner to adopt these vs using rules_foreign_cc
. Note that above links refer to a specific hash in the repo - the files might have changed upstream.

Sebastian
- 2,876
- 2
- 24
- 28
1
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
rules_foreign_cc_dependencies()
AWS_BUILD = """\
filegroup(
name = "sdk",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
"""
new_git_repository(
name = "aws_sdk",
build_file_content = _ALL_CONTENT,
commit = "2550901e1011e0ee1dc1bae44b42e1a2c6947c24",
recursive_init_submodules = True,
remote = "https://github.com/aws/aws-sdk-cpp",
shallow_since = "1628277923 +0000",
)
Then you can reference the binaries from within the BUILD file. Just build the aws-sdk using cmake.
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
cmake(
name = "aws_sdk",
cache_entries = {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_ONLY": "s3",
"BUILD_SHARED_LIBS": "ON",
"ENABLE_TESTING": "OFF",
},
install = True,
lib_source = "@aws_sdk//:sdk",
out_shared_libs = [
"libaws-cpp-sdk-core.so",
"libaws-cpp-sdk-s3.so",
]
)
-
I am not sure this works. For example, running this with dynamodb instead of s3 gives: ``` ERROR: /path/to/BUILD:3:6: output 'ext/aws/lib/libaws-cpp-sdk-core.so' was not created ERROR: /path/to/BUILD:3:6: output 'ext/aws/lib/libaws-cpp-sdk-dynamodb.so' was not created ERROR: /path/to/BUILD:3:6: Foreign Cc - CMake: Building aws failed: not all outputs were created or valid ``` – Victor M Jun 20 '22 at 20:58