diff --git a/BUILD b/BUILD index 1d1ecf849c..6e8fe1d1b3 100644 --- a/BUILD +++ b/BUILD @@ -65,6 +65,8 @@ pkg_tar( name = "libtrtorch", srcs = [ "//:LICENSE", + "//bzl_def:BUILD.bzl", + "//bzl_def:WORKSPACE" ], extension = "tar.gz", package_dir = "trtorch", diff --git a/bzl_def/BUILD b/bzl_def/BUILD new file mode 100644 index 0000000000..e20e391a45 --- /dev/null +++ b/bzl_def/BUILD @@ -0,0 +1,6 @@ +package(default_visibility = ["//visibility:public"]) + +exports_files([ + "WORKSPACE", + "BUILD.bzl" +]) \ No newline at end of file diff --git a/bzl_def/BUILD.bzl b/bzl_def/BUILD.bzl new file mode 100644 index 0000000000..e5419bf114 --- /dev/null +++ b/bzl_def/BUILD.bzl @@ -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", + ] +) \ No newline at end of file diff --git a/bzl_def/WORKSPACE b/bzl_def/WORKSPACE new file mode 100644 index 0000000000..cb50ef1d93 --- /dev/null +++ b/bzl_def/WORKSPACE @@ -0,0 +1 @@ +workspace(name = "trtorch") \ No newline at end of file