diff --git a/nanobind.BUILD b/nanobind.BUILD index 094a5a8..541bd19 100644 --- a/nanobind.BUILD +++ b/nanobind.BUILD @@ -14,13 +14,7 @@ package(default_visibility = ["//visibility:public"]) _NB_DEPS = [ "@robin_map", "@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. - # TODO: This seems Windows-specific, so change to `@platforms//os:windows`? - "@rules_cc//cc/compiler:msvc-cl": ["@rules_python//python/cc:current_py_cc_libs"], - "//conditions:default": [], -}) +] cc_library( name = "nanobind", @@ -31,13 +25,11 @@ cc_library( }), copts = select({ "@rules_cc//cc/compiler:msvc-cl": [ - "/EHsc", # exceptions - "/GL", # LTO / whole program optimization + "/EHsc", # exceptions. ], # clang and gcc, across all platforms. "//conditions:default": [ "-fexceptions", - "-flto", "-fno-strict-aliasing", ], }) + sizeopts(), @@ -49,9 +41,7 @@ cc_library( ], "@platforms//os:macos": [ "-Wl,@$(location :cmake/darwin-ld-cpython.sym)", # Apple. - "-Wl,-dead_strip", ], - "@rules_cc//cc/compiler:msvc-cl": ["/LTCG"], # MSVC. "//conditions:default": [], }), local_defines = sizedefs(), # sizeopts apply to nanobind only.