From 378e30bef0a06c99cda86c805af0e91cb99df621 Mon Sep 17 00:00:00 2001 From: ArthurSonzogni Date: Sat, 26 Apr 2025 01:25:29 +0200 Subject: [PATCH] update workflow --- BUILD.bazel | 3 ++- bazel/ftxui.bzl | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 40beed62..1eda9326 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -18,6 +18,7 @@ load(":bazel/ftxui.bzl", "ftxui_cc_library") load(":bazel/ftxui.bzl", "generate_examples") load(":bazel/ftxui.bzl", "cpp20") load(":bazel/ftxui.bzl", "msvc_copts") +load(":bazel/ftxui.bzl", "pthread_linkopts") package(default_visibility = ["//visibility:public"]) @@ -184,7 +185,7 @@ ftxui_cc_library( "include/ftxui/component/screen_interactive.hpp", "include/ftxui/component/task.hpp", ], - linkopts = ["-lpthread"], + linkopts = pthread_linkopts(), deps = [":dom"], ) diff --git a/bazel/ftxui.bzl b/bazel/ftxui.bzl index d0ddf68f..0f5e0c89 100644 --- a/bazel/ftxui.bzl +++ b/bazel/ftxui.bzl @@ -40,6 +40,16 @@ def msvc_copts(): "//conditions:default": [], }) +def pthread_linkopts(): + return select({ + # With MSVC, threading is already built-in (you don't need -pthread. + "@rules_cc//cc/compiler:msvc-cl": [], + "@rules_cc//cc/compiler:clang-cl": [], + "@rules_cc//cc/compiler:clang": ["-pthread"], + "@rules_cc//cc/compiler:gcc": ["-pthread"], + "//conditions:default": ["-pthread"], + }) + def ftxui_cc_library( name, srcs,