[mimalloc] Update to 1.6.1 (#10062)

* [mimalloc] Update to 1.6.0

* Update patch

* Update ci baseline file

* Add message for the arch and platform that doesn't support

* Update the ci baseline file

* Update to latest revision 1.6.1
This commit is contained in:
Phoebe 2020-03-19 15:39:00 +08:00 committed by GitHub
parent 3d82def504
commit b3bdac11f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 60 deletions

View File

@ -1,5 +1,5 @@
Source: mimalloc
Version: 2019-06-25-1
Version: 1.6.1
Description: Compact general purpose allocator with excellent performance
Homepage: https://github.com/microsoft/mimalloc

View File

@ -1,52 +1,62 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a35e885..76b6f60 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,7 +105,7 @@ else()
list(APPEND mi_libraries pthread)
endif()
-
+if(BUILD_SHARED_LIBS)
# shared library
add_library(mimalloc SHARED ${mi_sources})
set_target_properties(mimalloc PROPERTIES VERSION ${mi_version} NO_SONAME "YES" OUTPUT_NAME ${mi_basename} )
@@ -116,7 +116,7 @@ endif()
target_compile_options(mimalloc PRIVATE ${mi_cflags})
target_include_directories(mimalloc PRIVATE include PUBLIC $<INSTALL_INTERFACE:${mi_install_dir}/include>)
target_link_libraries(mimalloc PUBLIC ${mi_libraries})
-
+else()
# static library
add_library(mimalloc-static STATIC ${mi_sources})
if(WIN32)
@@ -135,15 +135,18 @@ endif()
target_compile_options(mimalloc-static PRIVATE ${mi_cflags})
target_include_directories(mimalloc-static PRIVATE include PUBLIC $<INSTALL_INTERFACE:${mi_install_dir}/include>)
target_link_libraries(mimalloc-static PUBLIC ${mi_libraries})
+endif()
# install static and shared library, and the include files
-install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_dir} LIBRARY NAMELINK_SKIP)
-install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_dir})
+if(BUILD_SHARED_LIBS)
+install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP)
+else()
+install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION lib)
+endif()
install(FILES include/mimalloc.h DESTINATION ${mi_install_dir}/include)
install(FILES cmake/mimalloc-config.cmake DESTINATION ${mi_install_dir}/cmake)
install(FILES cmake/mimalloc-config-version.cmake DESTINATION ${mi_install_dir}/cmake)
install(EXPORT mimalloc DESTINATION ${mi_install_dir}/cmake)
-install(FILES "$<TARGET_FILE:mimalloc>" DESTINATION lib) # duplicate the .so in the lib directory (unversioned)
# single object file for more predictable static overriding
add_library(mimalloc-obj OBJECT src/static.c)
@@ -154,7 +157,3 @@ if(NOT WIN32 AND MI_OVERRIDE MATCHES "ON")
endif()
target_compile_options(mimalloc-obj PRIVATE ${mi_cflags})
target_include_directories(mimalloc-obj PRIVATE include PUBLIC $<INSTALL_INTERFACE:include>)
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/mimalloc-obj.dir/src/static.c${CMAKE_C_OUTPUT_EXTENSION}
- DESTINATION ${mi_install_dir}
- RENAME ${mi_basename}${CMAKE_C_OUTPUT_EXTENSION} )
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e16830a..c68ae65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,6 +166,7 @@ message(STATUS "")
# Main targets
# -----------------------------------------------------------------------------
+if(BUILD_SHARED_LIBS)
# shared library
add_library(mimalloc SHARED ${mi_sources})
set_target_properties(mimalloc PROPERTIES VERSION ${mi_version} OUTPUT_NAME ${mi_basename} )
@@ -178,12 +179,19 @@ target_include_directories(mimalloc PUBLIC
)
if(WIN32)
# On windows copy the mimalloc redirection dll too.
- target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect.lib)
- add_custom_command(TARGET mimalloc POST_BUILD
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect.lib)
+ add_custom_command(TARGET mimalloc POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect.dll" $<TARGET_FILE_DIR:mimalloc>
COMMENT "Copy mimalloc-redirect.dll to output directory")
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ target_link_libraries(mimalloc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect32.lib)
+ add_custom_command(TARGET mimalloc POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/bin/mimalloc-redirect32.dll" $<TARGET_FILE_DIR:mimalloc>
+ COMMENT "Copy mimalloc-redirect32.dll to output directory")
+ endif()
endif()
-
+else()
# static library
add_library(mimalloc-static STATIC ${mi_sources})
target_compile_definitions(mimalloc-static PRIVATE ${mi_defines} MI_STATIC_LIB)
@@ -201,10 +209,13 @@ if(WIN32)
else()
set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename})
endif()
-
+endif()
# install static and shared library, and the include files
-install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_dir} LIBRARY)
-install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_dir})
+if(BUILD_SHARED_LIBS)
+install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib NAMELINK_SKIP)
+else()
+install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION lib)
+endif()
install(FILES include/mimalloc.h DESTINATION ${mi_install_dir}/include)
install(FILES include/mimalloc-override.h DESTINATION ${mi_install_dir}/include)
install(FILES include/mimalloc-new-delete.h DESTINATION ${mi_install_dir}/include)
@@ -234,9 +245,6 @@ target_include_directories(mimalloc-obj PUBLIC
# the FILES expression can also be: $<TARGET_OBJECTS:mimalloc-obj>
# but that fails cmake versions less than 3.10 so we leave it as is for now
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/mimalloc-obj.dir/src/static.c${CMAKE_C_OUTPUT_EXTENSION}
- DESTINATION ${mi_install_dir}
- RENAME ${mi_basename}${CMAKE_C_OUTPUT_EXTENSION} )
# -----------------------------------------------------------------------------
# API surface testing

View File

@ -1,10 +1,10 @@
include(vcpkg_common_functions)
vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "uwp")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/mimalloc
REF c6c1d5fffd0cf8dcb2ab969cde8fd170af44fdef
SHA512 3b9ce5d7dd70dd5ea56b70833c842068312a739e6131d956fd733e9893441e7e3340b6734bea0b799ac292533b0082975c08facd963961062dac821ccc44f9a9
REF 82684042be1be44d34caecc915fb51755278d843 # v1.6.1
SHA512 82477501a5fafa4df22c911039b74943275d0932404526692419b5c49d6ccfdd95c1c5a3689211db5cc2a845af039fda4892262b538ac7cdfb5bb35787dd355c
HEAD_REF master
PATCHES
fix-cmake.patch
@ -26,6 +26,7 @@ vcpkg_configure_cmake(
OPTIONS
-DMI_INTERPOSE=ON
-DMI_USE_CXX=OFF
-DMI_BUILD_TESTS=OFF
${FEATURE_OPTIONS}
)
@ -64,8 +65,5 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
)
endif()
# Handle copyright
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
# CMake integration test
vcpkg_test_cmake(PACKAGE_NAME ${PORT})

View File

@ -1071,6 +1071,9 @@ mhook:x64-uwp=fail
milerius-sfml-imgui:x64-osx=fail
milerius-sfml-imgui:x64-windows-static=fail
milerius-sfml-imgui:x64-linux=ignore
mimalloc:arm64-windows=fail
mimalloc:arm-uwp=fail
mimalloc:x64-uwp=fail
minhook:arm64-windows=fail
minhook:arm-uwp=fail
minhook:x64-linux=fail