Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default LTO options, dead_strip in MacOS linker options #16

Merged
merged 2 commits into from
Mar 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions nanobind.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(),
Expand All @@ -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.
Expand Down
Loading