update vcpkg instructions

This commit is contained in:
daanx 2025-01-10 09:19:08 -08:00
parent be05b232e8
commit 11e64c5c42
3 changed files with 14 additions and 11 deletions

View file

@ -2,14 +2,14 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/mimalloc REPO microsoft/mimalloc
HEAD_REF master HEAD_REF master
# The "REF" can be a commit hash, branch name (dev2), or a version (v2.2.1). # The "REF" can be a commit hash, branch name (dev2), or a version (v2.2.1).
# REF "v${VERSION}" # REF "v${VERSION}"
REF 3f91c9f937d9a7b26c130393925e7364a26c7880 REF be05b232e8a51e076aae6d8f4a5c3049ce51cb01
# The sha512 is the hash of the tar.gz bundle. # The sha512 is the hash of the tar.gz bundle.
# (To get the sha512, run `./vcpkg install mimalloc --overlay-ports=<dir of this file>` and copy the sha from the error message.) # (To get the sha512, run `vcpkg install mimalloc[override] --overlay-ports=<dir of this file>` and copy the sha from the error message.)
SHA512 bb29283e95786c064ce6fa5a36488dafa85f7e979afe3d8fc1361997c978d13557ed27904dda9b8d29c576ad32d7dff5c674dc60c7a5891224e3f1f56bbae73c SHA512 24f640db050d6263e557fe9d024e6c0435762118605c0d04801efbcb32e96382b0b995000715fc0c2dcd67c67825a100a6690ecf0ef097b0a3ae107a82d74f7d
) )
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -19,7 +19,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
secure MI_SECURE secure MI_SECURE
override MI_OVERRIDE override MI_OVERRIDE
xmalloc MI_XMALLOC xmalloc MI_XMALLOC
asm MI_SEE_ASM asm MI_SEE_ASM
) )
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" MI_BUILD_STATIC) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" MI_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" MI_BUILD_SHARED) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" MI_BUILD_SHARED)

View file

@ -7,12 +7,14 @@ your own variant.
For example, you can edit the [`portfile.cmake`](portfile.cmake) For example, you can edit the [`portfile.cmake`](portfile.cmake)
to check out a specific commit, version, or branch of mimalloc, or set further options. to check out a specific commit, version, or branch of mimalloc, or set further options.
You can install such custom port as: You can install such custom port as:
```sh ```sh
$ vcpkg install mimalloc --overlay-ports=./contrib/vcpkg $ vcpkg install mimalloc[override] --recurse --overlay-ports=./contrib/vcpkg
``` ```
This will also show the correct sha512 hash if you use a custom version. This will also show the correct sha512 hash if you use a custom version.
See the vcpkg [documentation](https://learn.microsoft.com/en-us/vcpkg/produce/update-package-version) for more information. Another way is to refer to the overlay from the [vcpkg-configuration.json](https://learn.microsoft.com/en-us/vcpkg/reference/vcpkg-configuration-json) file.
See also the vcpkg [documentation](https://learn.microsoft.com/en-us/vcpkg/produce/update-package-version) for more information.
# Using mimalloc from vcpkg # Using mimalloc from vcpkg
@ -25,6 +27,8 @@ find_package(mimalloc CONFIG REQUIRED)
target_link_libraries(main PRIVATE mimalloc) target_link_libraries(main PRIVATE mimalloc)
``` ```
See [`test/CMakeLists.txt](../../test/CMakeLists.txt) for more examples.
# Acknowledgements # Acknowledgements

View file

@ -15,7 +15,6 @@ And use mimalloc in your sources as:
return 0; return 0;
} }
When dynamically overriding on Windows, ensure `mimalloc.dll` is linked When dynamically overriding on Windows, ensure `mimalloc.dll` is linked through some call to
through some call to the mimalloc API, e.g. `mi_version()`, and that mimalloc (e.g. `mi_version()`), and that the `mimalloc-redirect.dll` is in the same directory.
the `mimalloc-redirect.dll` is in the same directory.
See https://github.com/microsoft/mimalloc/blob/dev/bin/readme.md for detailed information. See https://github.com/microsoft/mimalloc/blob/dev/bin/readme.md for detailed information.