github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/ngraph/tbb.BUILD (about)

     1  licenses(["notice"])  # 3-Clause BSD
     2  
     3  exports_files(["LICENSE"])
     4  
     5  # Taken from: https://github.com/rnburn/satyr/blob/master/bazel/tbb.BUILD
     6  # License for this BUILD file: MIT
     7  # See: https://github.com/rnburn/satyr/blob/master/LICENSE
     8  #
     9  # License for TBB: Apache 2.0
    10  # See: https://github.com/01org/tbb/blob/tbb_2018/LICENSE
    11  
    12  genrule(
    13      name = "build_tbb",
    14      srcs = glob(["**"]) + [
    15          "@local_config_cc//:toolchain",
    16      ],
    17      outs = [
    18          "libtbb.a",
    19          "libtbbmalloc.a",
    20      ],
    21      cmd = """
    22  	    set -e
    23  	    WORK_DIR=$$PWD
    24  		DEST_DIR=$$PWD/$(@D)
    25          export PATH=$$(dirname $(AR)):$$PATH
    26  		export CXXFLAGS=$(CC_FLAGS)
    27  		export NM=$(NM)
    28  		export AR=$(AR)
    29  		cd $$(dirname $(location :Makefile))
    30  
    31          #TBB's build needs some help to figure out what compiler it's using
    32          if $$CXX --version | grep clang &> /dev/null; then 
    33             COMPILER_OPT="compiler=clang"
    34          else
    35  			COMPILER_OPT="compiler=gcc"
    36  
    37            #  # Workaround for TBB bug
    38            #  # See https://github.com/01org/tbb/issues/59
    39            #  CXXFLAGS="$$CXXFLAGS -flifetime-dse=1"
    40          fi 
    41  
    42          # uses extra_inc=big_iron.inc to specify that static libraries are
    43          # built. See https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/297792
    44          make tbb_build_prefix="build" \
    45                extra_inc=big_iron.inc \
    46                $$COMPILER_OPT; \
    47  
    48          echo cp build/build_{release,debug}/*.a $$DEST_DIR
    49          cp build/build_{release,debug}/*.a $$DEST_DIR
    50  		cd $$WORK_DIR
    51  	""",
    52  )
    53  
    54  cc_library(
    55      name = "tbb",
    56      srcs = ["libtbb.a"],
    57      hdrs = glob([
    58          "include/serial/**",
    59          "include/tbb/**/**",
    60      ]),
    61      includes = ["include"],
    62      visibility = ["//visibility:public"],
    63  )