xref: /aosp_15_r20/external/executorch/backends/xnnpack/third-party/pthreadpool_defs.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1def define_pthreadpool():
2    # @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode.
3    native.cxx_library(
4        name = "pthreadpool",
5        srcs = ["pthreadpool/src/legacy-api.c", "pthreadpool/src/memory.c", "pthreadpool/src/portable-api.c", "pthreadpool/src/pthreads.c"],
6        deps = [
7            ":FXdiv",
8        ],
9        exported_deps = [
10            ":pthreadpool_header",
11        ],
12        compiler_flags = [
13            "-w",
14            "-Os",
15            "-fstack-protector-strong",
16            "-fno-delete-null-pointer-checks",
17        ],
18        headers = {
19            "threadpool-atomics.h": "pthreadpool/src/threadpool-atomics.h",
20            "threadpool-common.h": "pthreadpool/src/threadpool-common.h",
21            "threadpool-object.h": "pthreadpool/src/threadpool-object.h",
22            "threadpool-utils.h": "pthreadpool/src/threadpool-utils.h",
23        },
24        header_namespace = "",
25        preferred_linkage = "static",
26        platform_preprocessor_flags = [["windows", ["-D_WINDOWS", "-D_WIN32", "-DWIN32", "-DNOMINMAX", "-D_CRT_SECURE_NO_WARNINGS", "-D_USE_MATH_DEFINES"]], ["windows.*64$", ["-D_WIN64"]]],
27        preprocessor_flags = ["-DPTHREADPOOL_USE_FUTEX=0", "-DPTHREADPOOL_USE_GCD=0"],
28        visibility = ["PUBLIC"],
29    )
30
31    # @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode.
32    native.cxx_library(
33        name = "pthreadpool_header",
34        header_namespace = "",
35        exported_headers = {
36            "pthreadpool.h": "pthreadpool/include/pthreadpool.h",
37        },
38        visibility = ["PUBLIC"],
39    )
40