floooh / sokol-nim

nim bindings for https://github.com/floooh/sokol
MIT License
76 stars 14 forks source link

No way to disable assertions #24

Closed geotre closed 7 months ago

geotre commented 7 months ago

this file defines SOKOL_ASSERT in a way that cannot be disabled, meaning that even in release mode it is not possible to turn off assertions and reduce calls to e.g. glGetError. Compiling with --passC:-DNDEBUG does not have an effect as it would with C/C++ usage of Sokol.

I would propose wrapping in a similar check to assert.h:

#ifndef NDEBUG
    #define SOKOL_ASSERT...
#endif

We may want to also check if the Nim app is compiled in release mode, in which case we can pass -DNDEBUG when compiling sokol_gfx.c

floooh commented 7 months ago

Merged, many thanks for the PR! (I have a small question in the PR though, nothing critical though)