From 27b3b09f52b886e33d05aac56ce54bafdbb19163 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 30 Jan 2023 18:36:06 +0900 Subject: [PATCH] (#14931) mimalloc: add version 1.7.9, 2.0.9 * mimalloc: add version 1.7.9, 2.0.9 * fix compilation error on msvc * use self.settings instead self.info.settings Co-authored-by: Chris Mc * use self.settings instead of self.info.settings Co-authored-by: Chris Mc * create patches for older compilers --------- Co-authored-by: Chris Mc --- recipes/mimalloc/all/conandata.yml | 20 +++++++++++++++++ recipes/mimalloc/all/conanfile.py | 15 ++++++------- .../1.7.9-0001-change-install-paths.patch | 22 +++++++++++++++++++ .../1.7.9-0002-support-older-compiler.patch | 22 +++++++++++++++++++ .../2.0.9-0001-change-install-paths.patch | 22 +++++++++++++++++++ .../2.0.9-0002-support-older-compiler.patch | 22 +++++++++++++++++++ recipes/mimalloc/config.yml | 4 ++++ 7 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch create mode 100644 recipes/mimalloc/all/patches/1.7.9-0002-support-older-compiler.patch create mode 100644 recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch create mode 100644 recipes/mimalloc/all/patches/2.0.9-0002-support-older-compiler.patch diff --git a/recipes/mimalloc/all/conandata.yml b/recipes/mimalloc/all/conandata.yml index a4ff4095992ef..c25b069c45c60 100644 --- a/recipes/mimalloc/all/conandata.yml +++ b/recipes/mimalloc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.9": + url: "https://github.com/microsoft/mimalloc/archive/v2.0.9.tar.gz" + sha256: "4a29edae32a914a706715e2ac8e7e4109e25353212edeed0888f4e3e15db5850" "2.0.7": url: "https://github.com/microsoft/mimalloc/archive/v2.0.7.tar.gz" sha256: "f23aac6c73594e417af50cb38f1efed88ef1dc14a490f0eff07c7f7b079810a4" @@ -14,6 +17,9 @@ sources: "2.0.2": url: "https://github.com/microsoft/mimalloc/archive/v2.0.2.tar.gz" sha256: "c81a5f443f72373e3105172d6a935e29b0dabd13ba387c080bc444586cbe3021" + "1.7.9": + url: "https://github.com/microsoft/mimalloc/archive/v1.7.9.tar.gz" + sha256: "45e05be518363d32b2cdcce1a1fac3580895ea2e4524e1a3c7e71145cb58659f" "1.7.7": url: "https://github.com/microsoft/mimalloc/archive/v1.7.7.tar.gz" sha256: "0f6663be1e1764851bf9563fcf7a6b3330e23b933eb4737dd07e3289b87895fe" @@ -27,6 +33,13 @@ sources: url: "https://github.com/microsoft/mimalloc/archive/v1.6.7.tar.gz" sha256: "111b718b496f297f128d842880e72e90e33953cf00b45ba0ccd2167e7340ed17" patches: + "2.0.9": + - patch_file: "patches/2.0.9-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" + - patch_file: "patches/2.0.9-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" "2.0.7": - patch_file: "patches/2.0.7-0001-change-install-paths.patch" patch_description: "fix install paths" @@ -50,6 +63,13 @@ patches: - patch_file: "patches/2.0.2-0002-include-cstddef-to-get-std-size-t.patch" patch_description: "include stddef" patch_type: "portability" + "1.7.9": + - patch_file: "patches/1.7.9-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" + - patch_file: "patches/1.7.9-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" "1.7.7": - patch_file: "patches/1.7.7-0001-change-install-paths.patch" patch_description: "fix install paths" diff --git a/recipes/mimalloc/all/conanfile.py b/recipes/mimalloc/all/conanfile.py index 47efa6d568998..392d44fdee88c 100644 --- a/recipes/mimalloc/all/conanfile.py +++ b/recipes/mimalloc/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, is_msvc, msvc_runtime_flag, VCVars +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, VCVars from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file, save, collect_libs from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -48,6 +48,7 @@ def _compilers_minimum_version(self): return { "gcc": "7", "Visual Studio": "15", + "msvc": "191", "clang": "5", "apple-clang": "10", } @@ -111,13 +112,11 @@ def validate(self): if self.info.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) - check_min_vs(self, 191) - if not is_msvc(self): - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." - ) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch new file mode 100644 index 0000000000000..1091c508194e2 --- /dev/null +++ b/recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0011b87..41a15a2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -383,7 +383,7 @@ if(MI_BUILD_SHARED) + install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir}) + endif() + +- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) ++ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + +@@ -407,7 +407,7 @@ if (MI_BUILD_STATIC) + set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) + endif() + +- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) ++ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + diff --git a/recipes/mimalloc/all/patches/1.7.9-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/1.7.9-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..7a9f7edb032b6 --- /dev/null +++ b/recipes/mimalloc/all/patches/1.7.9-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index f590033..a4275c5 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -493,7 +493,7 @@ template struct _mi_heap_stl_allocator_common : public _m + #endif + + void collect(bool force) { mi_heap_collect(this->heap.get(), force); } +- template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } ++ template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } + + protected: + std::shared_ptr heap; +@@ -504,7 +504,7 @@ protected: + this->heap.reset(hp, (destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */ + } + _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } +- template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } ++ template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } + + private: + static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } } diff --git a/recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch new file mode 100644 index 0000000000000..91c4b6fa129dd --- /dev/null +++ b/recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74c1f29..d657144 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -383,7 +383,7 @@ if(MI_BUILD_SHARED) + install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir}) + endif() + +- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) ++ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + +@@ -407,7 +407,7 @@ if (MI_BUILD_STATIC) + set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) + endif() + +- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) ++ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + diff --git a/recipes/mimalloc/all/patches/2.0.9-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/2.0.9-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..d8c391792f463 --- /dev/null +++ b/recipes/mimalloc/all/patches/2.0.9-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index 9b72fbf..b34362f 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -500,7 +500,7 @@ template struct _mi_heap_stl_allocator_common : public _m + #endif + + void collect(bool force) { mi_heap_collect(this->heap.get(), force); } +- template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } ++ template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } + + protected: + std::shared_ptr heap; +@@ -511,7 +511,7 @@ protected: + this->heap.reset(hp, (destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */ + } + _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } +- template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } ++ template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } + + private: + static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } } diff --git a/recipes/mimalloc/config.yml b/recipes/mimalloc/config.yml index 81997d06f09a4..cabec88f14c46 100644 --- a/recipes/mimalloc/config.yml +++ b/recipes/mimalloc/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.9": + folder: all "2.0.7": folder: all "2.0.6": @@ -9,6 +11,8 @@ versions: folder: all "2.0.2": folder: all + "1.7.9": + folder: all "1.7.7": folder: all "1.7.6":