wjakob / nanobind

nanobind: tiny and efficient C++/Python bindings
BSD 3-Clause "New" or "Revised" License
2.14k stars 161 forks source link

Allow custom dying words in fail_unspecified(). #484

Closed hpkfft closed 3 months ago

hpkfft commented 3 months ago

This is a simpler alternative to PR #482.

The CMake build system is not changed and does not define the macro NB_COMPACT_ASSERTION_MESSAGE. The default output will be:

Critical nanobind error: encountered an unrecoverable error condition.
Recompile using the 'Debug' or 'RelWithDebInfo' modes to obtain further information about this problem.
Aborted

I'm not expert enough with CMake to suggest the best way for a top-level project to set compile definitions for the targets in a subproject. Perhaps it cannot be done using "modern" Cmake target-specific commands? For my purposes, the older style command works:

add_definitions("-DNB_COMPACT_ASSERTION_MESSAGE=\"For help regarding ${CMAKE_PROJECT_NAME}, please visit ${CMAKE_PROJECT_HOMEPAGE_URL}\"")

and, given the settings in my particular project(), results in:

Critical nanobind error: encountered an unrecoverable error condition.
For help regarding hpk.fft, please visit https://hpkfft.com
Aborted
wjakob commented 3 months ago

I merged a variant of this in 94d09cacbe594698d6f2d1daf728e239a34075b7.

hpkfft commented 3 months ago

Thanks!