diff --git a/build_defs.bzl b/build_defs.bzl index 9ea6e38..2a88873 100644 --- a/build_defs.bzl +++ b/build_defs.bzl @@ -26,7 +26,12 @@ NANOBIND_FEATURES = [ NANOBIND_DEPS = [ Label("@nanobind"), "@rules_python//python/cc:current_py_cc_headers", -] +] + select({ + # we need to link in the Python libs only on Windows to signal to the linker that it + # needs to go searching for these symbols at runtime. + "@rules_cc//cc/compiler:msvc-cl": ["@rules_python//python/cc:current_py_cc_libs"], + "//conditions:default": [], +}) # A C++ Python extension library built with nanobind. # Given a name $NAME, defines the following targets: