diff options
Diffstat (limited to 'third_party/gpus/cuda/build_defs.bzl.tpl')
-rw-r--r-- | third_party/gpus/cuda/build_defs.bzl.tpl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/third_party/gpus/cuda/build_defs.bzl.tpl b/third_party/gpus/cuda/build_defs.bzl.tpl new file mode 100644 index 0000000000..8f7dc00630 --- /dev/null +++ b/third_party/gpus/cuda/build_defs.bzl.tpl @@ -0,0 +1,14 @@ +# Macros for building CUDA code. + +def if_cuda(if_true, if_false = []): + """Shorthand for select()'ing on whether we're building with CUDA. + + Returns a select statement which evaluates to if_true if we're building + with CUDA enabled. Otherwise, the select statement evaluates to if_false. + + """ + return select({ + "@local_config_cuda//cuda:using_nvcc": if_true, + "@local_config_cuda//cuda:using_gcudacc": if_true, + "//conditions:default": if_false + }) |