Skip to content

Commit

Permalink
feat(//:libtrtorch): Ship a WORKSPACE file and BUILD file with the
Browse files Browse the repository at this point in the history
tarball so that users can just load it as an HTTP archive

Signed-off-by: Naren Dasan <naren@narendasan.com>
Signed-off-by: Naren Dasan <narens@nvidia.com>
  • Loading branch information
narendasan committed Oct 12, 2021
1 parent f0523f1 commit 7ac6f1c
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ pkg_tar(
name = "libtrtorch",
srcs = [
"//:LICENSE",
"//bzl_def:BUILD.bzl",
"//bzl_def:WORKSPACE"
],
extension = "tar.gz",
package_dir = "trtorch",
Expand Down
6 changes: 6 additions & 0 deletions bzl_def/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package(default_visibility = ["//visibility:public"])

exports_files([
"WORKSPACE",
"BUILD.bzl"
])
79 changes: 79 additions & 0 deletions bzl_def/BUILD.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package(default_visibility = ["//visibility:public"])

config_setting(
name = "aarch64_linux",
constraint_values = [
"@platforms//cpu:aarch64",
"@platforms//os:linux",
],
)

config_setting(
name = "windows",
constraint_values = [
"@platforms//os:windows",
],
)

cc_library(
name = "libtrtorch",
srcs = select({
":windows": [
"lib/x64/trtorch.dll",
],
"//conditions:default": [
"lib/libtrtorch.so",
],
}),
hdrs = glob([
"include/**/*.h",
]),
strip_include_prefix = "include",
includes = ["include/"]
)

cc_library(
name = "libtrtorchrt",
srcs = select({
":windows": [
"lib/x64/trtorchrt.dll"
],
"//conditions:default": [
"lib/libtrtorchrt.so"
]
})
)

cc_library(
name = "libtrtorch_plugins",
srcs = select({
":windows": [
"lib/x64/trtorch_plugins.dll"
],
"//conditions:default": [
"lib/libtrtorch_plugins.so"
]
}),
hdrs = glob([
"include/trtorch/core/plugins/**/*.h",
]),
strip_include_prefix = "include",
includes = ["include/"]
)

cc_library(
name = "trtorch_core_hdrs",
hdrs = glob([
"include/trtorch/core/**/*.h"
]),
strip_include_prefix = "include",
includes = ["include/trtorch/"]
)

# Alias for ease of use
cc_library(
name = "trtorch",
deps = [
":libtrtorch",
]
)
1 change: 1 addition & 0 deletions bzl_def/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspace(name = "trtorch")

0 comments on commit 7ac6f1c

Please sign in to comment.