mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 23:19:31 +03:00
more comments
This commit is contained in:
parent
e4caee5f55
commit
86cadca059
1 changed files with 6 additions and 4 deletions
|
@ -14,29 +14,31 @@ endif()
|
||||||
|
|
||||||
# Import mimalloc (if installed)
|
# Import mimalloc (if installed)
|
||||||
find_package(mimalloc 1.0 REQUIRED NO_SYSTEM_ENVIRONMENT_PATH)
|
find_package(mimalloc 1.0 REQUIRED NO_SYSTEM_ENVIRONMENT_PATH)
|
||||||
|
message(STATUS "Found mimalloc installed at: ${MIMALLOC_TARGET_DIR}")
|
||||||
|
|
||||||
message(STATUS "${MIMALLOC_INCLUDE_DIR}")
|
# overriding with a dynamic library
|
||||||
|
|
||||||
# Tests
|
|
||||||
add_executable(dynamic-override main-override.c)
|
add_executable(dynamic-override main-override.c)
|
||||||
target_link_libraries(dynamic-override PUBLIC mimalloc)
|
target_link_libraries(dynamic-override PUBLIC mimalloc)
|
||||||
|
|
||||||
add_executable(dynamic-override-cxx main-override.cpp)
|
add_executable(dynamic-override-cxx main-override.cpp)
|
||||||
target_link_libraries(dynamic-override-cxx PUBLIC mimalloc)
|
target_link_libraries(dynamic-override-cxx PUBLIC mimalloc)
|
||||||
|
|
||||||
|
|
||||||
# overriding with a static object file works reliable as the symbols in the
|
# overriding with a static object file works reliable as the symbols in the
|
||||||
# object file have priority over those in library files
|
# object file have priority over those in library files
|
||||||
add_executable(static-override-obj main-override.c ${MIMALLOC_TARGET_DIR}/mimalloc.o)
|
add_executable(static-override-obj main-override.c ${MIMALLOC_TARGET_DIR}/mimalloc.o)
|
||||||
target_include_directories(static-override-obj PUBLIC ${MIMALLOC_TARGET_DIR}/include)
|
target_include_directories(static-override-obj PUBLIC ${MIMALLOC_TARGET_DIR}/include)
|
||||||
target_link_libraries(static-override-obj PUBLIC pthread)
|
target_link_libraries(static-override-obj PUBLIC pthread)
|
||||||
|
|
||||||
|
|
||||||
# overriding with a static library works too if using the `mimalloc-override.h`
|
# overriding with a static library works too if using the `mimalloc-override.h`
|
||||||
# header to redefine malloc/free.
|
# header to redefine malloc/free. (the library already overrides new/delete)
|
||||||
add_executable(static-override-static main-override-static.c)
|
add_executable(static-override-static main-override-static.c)
|
||||||
target_link_libraries(static-override-static PUBLIC mimalloc-static)
|
target_link_libraries(static-override-static PUBLIC mimalloc-static)
|
||||||
|
|
||||||
|
|
||||||
# overriding with a static library: this may not work if the library is linked too late
|
# overriding with a static library: this may not work if the library is linked too late
|
||||||
|
# on the command line after the C runtime library; but we cannot control that well in CMake
|
||||||
add_executable(static-override main-override.c)
|
add_executable(static-override main-override.c)
|
||||||
target_link_libraries(static-override PUBLIC mimalloc-static)
|
target_link_libraries(static-override PUBLIC mimalloc-static)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue