initial sources for vcpkg support

This commit is contained in:
Daan 2025-01-09 23:29:57 -08:00
parent 3f91c9f937
commit 4e5a6d2136
5 changed files with 176 additions and 0 deletions

21
contrib/vcpkg/usage Normal file
View file

@ -0,0 +1,21 @@
Use the following CMake targets to import mimalloc:
find_package(mimalloc CONFIG REQUIRED)
target_link_libraries(main PRIVATE mimalloc)
And use mimalloc in your sources as:
#include <mimalloc.h>
#include <stdio.h>
int main(int argc, char** argv) {
int* p = mi_malloc_tp(int);
*p = mi_version();
printf("mimalloc version: %d\n", *p);
mi_free(p);
return 0;
}
When dynamically overriding on Windows, ensure `mimalloc.dll` is linked
through some call to the mimalloc API, e.g. `mi_version()`, and that
the `mimalloc-redirect.dll` is in the same directory.
See https://github.com/microsoft/mimalloc/blob/dev/bin/readme.md for detailed information.