purpleprotocol / mimalloc_rust

A Rust wrapper over Microsoft's MiMalloc memory allocator
MIT License
503 stars 41 forks source link

Mirror cmake-rs build type selection logic #16

Closed athre0z closed 4 years ago

athre0z commented 4 years ago

This is an implementation of the fix proposed in #15:

I would honestly go with option 2. We can read the PROFILE and OPT_LEVEL env variables and determine the correct paths according to the same logic the cmake-rs crate follows.

I believe this might also provide a fix for #9.

I left cmake-rs' decision logic mostly unchanged and just reworked the error handling to better fit a build.rs and then use the result to determine whether we are doing a debug/release build. I figured that would reduce the chance of messing something up compared to adapting the function to return release/debug directly.

I verified that this indeed also fixes #9. :)

athre0z commented 4 years ago

Nice -- thanks for the quick response. I'd appreciate a ping once this is included in a new version. :)

octavonce commented 4 years ago

@athre0z Version 0.1.17 has just been released ;)

athre0z commented 4 years ago

Thanks!