From 82e4c01b6f855b8cc8ffd5752ae54872a175f3c3 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Fri, 21 Jun 2024 15:56:48 -0400 Subject: [PATCH] Add nanobind --- releases.json | 8 ++++ subprojects/nanobind.wrap | 9 +++++ subprojects/packagefiles/nanobind/meson.build | 39 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 subprojects/nanobind.wrap create mode 100644 subprojects/packagefiles/nanobind/meson.build diff --git a/releases.json b/releases.json index 353d3be9a..7e6114d3b 100644 --- a/releases.json +++ b/releases.json @@ -2326,6 +2326,14 @@ "0.5.0-1" ] }, + "nanobind": { + "dependency_names": [ + "nanobind" + ], + "versions": [ + "2.0.0-1" + ] + }, "nativefiledialog-extended": { "dependency_names": [ "nativefiledialog-extended" diff --git a/subprojects/nanobind.wrap b/subprojects/nanobind.wrap new file mode 100644 index 000000000..64a32f4b7 --- /dev/null +++ b/subprojects/nanobind.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = nanobind-2.0.0 +source_url = https://github.com/wjakob/nanobind/archive/refs/tags/v2.0.0.tar.gz +source_filename = nanobind-2.0.0.tar.gz +source_hash = 2e70727484edb7a8645d26f6a9f67352a668657c34de7a603bf9c68e5cbf8ff9 +patch_directory = nanobind + +[provide] +nanobind = nanobind_dep diff --git a/subprojects/packagefiles/nanobind/meson.build b/subprojects/packagefiles/nanobind/meson.build new file mode 100644 index 000000000..2422161dd --- /dev/null +++ b/subprojects/packagefiles/nanobind/meson.build @@ -0,0 +1,39 @@ +project( + 'nanobind', + 'cpp', + version: '2.0.0', + meson_version: '>=0.53.0', + license: 'BSD-3-Clause', +) + +py_mod = import('python') +py = py_mod.find_installation() +py_dep = py.dependency(embed: true) + +robin_map_dep = dependency('robin-map') + +incdir = include_directories('include') + +nanobind_lib = library( + 'nanobind', + sources: [ + 'src/nb_internals.cpp', + 'src/nb_func.cpp', + 'src/nb_type.cpp', + 'src/nb_enum.cpp', + 'src/nb_ndarray.cpp', + 'src/nb_static_property.cpp', + 'src/common.cpp', + 'src/error.cpp', + 'src/trampoline.cpp', + 'src/implicit.cpp', + ], + include_directories: [incdir], + dependencies: [py_dep, robin_map_dep], +) + +nanobind_dep = declare_dependency( + include_directories: [incdir], + link_with: [nanobind_lib], + dependencies: [py_dep, robin_map_dep], +)