-
Notifications
You must be signed in to change notification settings - Fork 254
[WIP] Interoperability with other Python binding frameworks #1140
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
base: master
Are you sure you want to change the base?
Changes from all commits
036c91c
26971e0
940500d
6769a72
54c5e11
2c5e718
4fb9c85
245fa5a
6fe43c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,6 +190,7 @@ function (nanobind_build_library TARGET_NAME) | |
${NB_DIR}/src/nb_static_property.cpp | ||
${NB_DIR}/src/nb_ft.h | ||
${NB_DIR}/src/nb_ft.cpp | ||
${NB_DIR}/src/nb_foreign.cpp | ||
${NB_DIR}/src/common.cpp | ||
${NB_DIR}/src/error.cpp | ||
${NB_DIR}/src/trampoline.cpp | ||
|
@@ -236,6 +237,10 @@ function (nanobind_build_library TARGET_NAME) | |
target_compile_definitions(${TARGET_NAME} PUBLIC NB_FREE_THREADED) | ||
endif() | ||
|
||
if (TARGET_NAME MATCHES "-local") | ||
target_compile_definitions(${TARGET_NAME} PRIVATE NB_DISABLE_INTEROP) | ||
endif() | ||
|
||
# Nanobind performs many assertion checks -- detailed error messages aren't | ||
# included in Release/MinSizeRel/RelWithDebInfo modes | ||
target_compile_definitions(${TARGET_NAME} PRIVATE | ||
|
@@ -330,7 +335,7 @@ endfunction() | |
|
||
function(nanobind_add_module name) | ||
cmake_parse_arguments(PARSE_ARGV 1 ARG | ||
"STABLE_ABI;FREE_THREADED;NB_STATIC;NB_SHARED;PROTECT_STACK;LTO;NOMINSIZE;NOSTRIP;MUSL_DYNAMIC_LIBCPP;NB_SUPPRESS_WARNINGS" | ||
"STABLE_ABI;FREE_THREADED;NB_STATIC;NB_SHARED;PROTECT_STACK;LTO;NOMINSIZE;NOSTRIP;MUSL_DYNAMIC_LIBCPP;NB_SUPPRESS_WARNINGS;NO_INTEROP" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A general question is whether this feature should be opt-in or opt-out. Given that it adds overheads (even if small), my tendency would be to make it opt-in. (e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the feature becomes opt-in, would you reverse the polarity of the macro as well? In other words, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just chiming in for another vote for opt-in. I imagine that most projects don't need to pay the cost (as the bindings will be self contained), and the ones that do would probably just use it to use as a transition period and then turn it off again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The authors of a particular extension module don't generally know when they build it whether anyone will want to use its types from a different framework (or a different ABI version of the same framework). I think this is what pybind11 was referring to in their rationale for adding the |
||
"NB_DOMAIN" "") | ||
|
||
add_library(${name} MODULE ${ARG_UNPARSED_ARGUMENTS}) | ||
|
@@ -375,6 +380,10 @@ function(nanobind_add_module name) | |
set(libname "${libname}-ft") | ||
endif() | ||
|
||
if (ARG_NO_INTEROP) | ||
set(libname "${libname}-local") | ||
endif() | ||
|
||
if (ARG_NB_DOMAIN AND ARG_NB_SHARED) | ||
set(libname ${libname}-${ARG_NB_DOMAIN}) | ||
endif() | ||
|
Uh oh!
There was an error while loading. Please reload this page.