1"""Build definitions for Ruy that are specific to the open-source build.""" 2 3# Used for targets that #include <thread> 4def ruy_linkopts_thread_standard_library(): 5 # In open source builds, GCC is a common occurence. It requires "-pthread" 6 # to use the C++11 <thread> standard library header. This breaks the 7 # opensource build on Windows and probably some other platforms, so that 8 # will need to be fixed as needed. Ideally we would like to do this based 9 # on GCC being the compiler, but that does not seem to be easy to achieve 10 # with Bazel. Instead we do the following, which is copied from 11 # https://github.com/abseil/abseil-cpp/blob/1112609635037a32435de7aa70a9188dcb591458/absl/base/BUILD.bazel#L155 12 return select({ 13 "@bazel_tools//src/conditions:windows": [], 14 "//conditions:default": ["-pthread"], 15 }) 16