xref: /aosp_15_r20/external/executorch/shim/xplat/executorch/backends/xnnpack/third-party/third_party_libs.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2
3# Dictionary mappping third-party library name to the correct OSS/Internal target dependencies.
4# the values of the dictionary are lists where the first element is the internal dep and the
5# second element is the OSS dep
6_THIRD_PARTY_LIBS = {
7    "FP16": ["fbsource//xplat/third-party/FP16:FP16Fbcode", "//backends/xnnpack/third-party:FP16"],
8    "FXdiv": ["//xplat/third-party/FXdiv:FXdiv", "//backends/xnnpack/third-party:FXdiv"],
9    "XNNPACK": ["//xplat/third-party/XNNPACK:XNNPACK", "//backends/xnnpack/third-party:XNNPACK"],
10    "clog": ["//xplat/third-party/clog:clog", "//backends/xnnpack/third-party:clog"],
11    "cpuinfo": ["fbsource//third-party/cpuinfo:cpuinfo", "//backends/xnnpack/third-party:cpuinfo"],
12    "pthreadpool": ["//xplat/third-party/pthreadpool:pthreadpool", "//backends/xnnpack/third-party:pthreadpool"],
13    "pthreadpool_header": ["//xplat/third-party/pthreadpool:pthreadpool_header", "//backends/xnnpack/third-party:pthreadpool_header"],
14}
15
16def third_party_dep(name):
17    if name not in _THIRD_PARTY_LIBS:
18        fail("Cannot find third party library " + name + ", please register it in THIRD_PARTY_LIBS first!")
19
20    return _THIRD_PARTY_LIBS[name][1] if runtime.is_oss else _THIRD_PARTY_LIBS[name][0]
21