aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/gpus/cuda/build_defs.bzl.tpl
blob: 8f7dc0063093178d7e43d3d06640f014e94897c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
    })