diff --git a/CMakeLists.txt b/CMakeLists.txt index d1bca9668..520848989 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,13 @@ if(nanobind_FOUND) "[${nanobind_DIR},${nanobind_VERSION}]") endif() +# shared nanobind linking seems broken on windows for unknown reasons +if(WIN32) + set(freud_nanobind_linking "NB_STATIC") +else() + set(freud_nanobind_linking "NB_SHARED") +endif() + # Fail fast if users have not cloned submodules. if(NOT WIN32) string(ASCII 27 Esc) diff --git a/cpp/box/CMakeLists.txt b/cpp/box/CMakeLists.txt index 78808beb1..b61bac398 100644 --- a/cpp/box/CMakeLists.txt +++ b/cpp/box/CMakeLists.txt @@ -1,5 +1,5 @@ # create the target and add the needed properties -nanobind_add_module(_box NB_SHARED module-box.cc export_Box.cc) +nanobind_add_module(_box ${freud_nanobind_linking} module-box.cc export_Box.cc) target_link_libraries(_box PUBLIC libfreud) if(APPLE) diff --git a/cpp/parallel/CMakeLists.txt b/cpp/parallel/CMakeLists.txt index 5c6af0059..e938ca5a0 100644 --- a/cpp/parallel/CMakeLists.txt +++ b/cpp/parallel/CMakeLists.txt @@ -1,4 +1,4 @@ -nanobind_add_module(_parallel NB_SHARED module-parallel.cc) +nanobind_add_module(_parallel ${freud_nanobind_linking} module-parallel.cc) target_link_libraries(_parallel PUBLIC libfreud) if(APPLE)