floooh / sokol-nim

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

Check for NDEBUG flag when defining SOKOL_ASSERT #25

Closed geotre closed 7 months ago

geotre commented 7 months ago

See issue #24 . This only adds the check for NDEBUG, it does not add the switch in release mode as it seems that would need to be added to the code generator which is in a separate repository.

floooh commented 7 months ago

Oops, I fat-fingered the merge (looked good to me though) :)

Quick question: does Nim automatically define NDEBUG when building in release mode here in this compile statement?

{.passc:"-DSOKOL_NIM_IMPL".}
{.compile:"c/sokol_app.c".}

PS: just saw that you had the same question in the issue, can you maybe check and verify if Nim does this automatically? If not it might make sense to add a little blurb to the readme.

geotre commented 7 months ago

Quick question: does Nim automatically define NDEBUG when building in release mode here in this compile statement?

It does not, but it should be as simple as adding

when defined(release):
  {.passc:"-DNDEBUG".}

To the code generator. I've opened a PR with this change here