Skip to content

Make nanobind work well in rev.ng #1

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mrjackv
Copy link

@mrjackv mrjackv commented Jul 9, 2025

No description provided.

@mrjackv mrjackv force-pushed the feature/nanobind branch from 80caec2 to ac56f7b Compare July 16, 2025 16:00
@mrjackv mrjackv marked this pull request as ready for review July 23, 2025 14:37
@mrjackv mrjackv force-pushed the feature/nanobind branch 3 times, most recently from d4bf98f to 9248a2d Compare July 30, 2025 07:29
mrjackv added 3 commits July 30, 2025 09:35
Add an additional `CMakeLists.txt` file which allows building nanobind
as a standalone project, installing `libnanobind.so` under `/lib` and
headers under `/include`.
Drop the use of `typeid` and `std::type_info` from the codebase, they
are now replaced with a thin shim through `shimTypeid<T>` and
`shim::type_info`.
Search and replace all uses of uses of `std::type_info` and
`typeid(...)` from the codebase and replace them with the shimmed
functions/classes implemented in the previous commit. This commit can
be regenerated during a rebase by running the following command:

```
find src include -type f \
    \( -name '*.h' -or -name '*.cpp' \) \
    -exec sed -i \
        -e 's;std::type_info;shim::type_info;g' \
        -e 's;typeid(\*ptr);typeidShim(*ptr);g' \
        -e 's;typeid(\([^)]\+\));typeidShim<\1>();g' {} \;
```
@mrjackv mrjackv force-pushed the feature/nanobind branch 2 times, most recently from c93ef27 to f1b1a59 Compare July 30, 2025 11:42
@mrjackv mrjackv force-pushed the feature/nanobind branch 2 times, most recently from 361092a to 7f4d1fb Compare July 30, 2025 13:00
Drop the use of exceptions from the codebase. Where needed add an
`abort`.
Search and replace all exception-related code (`try`, `catch`, `throw`)
and replace their use with functions/classes implemented in the previous
commit. This commit can be regenerated during a rebase by running the
following command:

```
find src include -type f \
    \( -name '*.h' -or -name '*.cpp' \) \
    -exec sed -i \
        -e 's|try {|if (true) {|g' \
        -e 's|catch (.*&\s*\(.\+\)) {|if (false) { shim::exception_placeholder \1;|g' \
        -e 's|catch (.*) {|if (false) {|g' \
        -e 's|throw \(.*\);$|throwShim(\1);|g' {} \;
```
Add extra compiler flags that make the compiler stricter.
Remove the `hidden` attribute from the nanobind namespace, as it was
causing linking problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants