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

nanobind: request add package #5363

Open
star-hengxing opened this issue Sep 28, 2024 · 0 comments · May be fixed by #5634
Open

nanobind: request add package #5363

star-hengxing opened this issue Sep 28, 2024 · 0 comments · May be fixed by #5634

Comments

@star-hengxing
Copy link
Contributor

Is your feature request related to a problem? Please describe.

https://github.com/wjakob/nanobind

Describe the solution you'd like

package("nanobind")
    set_kind("library", {headeronly = true})
    set_homepage("https://github.com/wjakob/nanobind")
    set_description("nanobind: tiny and efficient C++/Python bindings")
    set_license("BSD-3-Clause")

    set_urls("https://github.com/wjakob/nanobind/archive/refs/tags/$(version).tar.gz",
             "https://github.com/wjakob/nanobind.git", {submodules = false})

    add_versions("v2.1.0", "c37c53c60ada5fe1c956e24bd4b83af669a2309bf952bd251f36a7d2fa3bacf0")

    add_deps("cmake")
    add_deps("robin-map", "python 3.x")

    on_install(function (package)
        local configs = {
            "-DNB_CREATE_INSTALL_RULES=ON",
            "-DNB_USE_SUBMODULE_DEPS=OFF",
            "-DNB_TEST=OFF",
            "-DNB_INSTALL_DATADIR=" .. package:installdir(),
        }
        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
        import("package.tools.cmake").install(package, configs)
        os.mv(package:installdir("*.py"), package:installdir("python"))
    end)

    on_test(function (package)
        assert(package:check_cxxsnippets({test = [[
            int add(int a, int b) { return a + b; }
            NB_MODULE(my_ext, m) {
                m.def("add", &add);
            }
            void test() {}
        ]]}, {configs = {languages = "c++17"}, includes = "nanobind/nanobind.h"}))
    end)

Describe alternatives you've considered

No response

Additional context

No response

@star-hengxing star-hengxing linked a pull request Nov 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant