Skip to content

Commit

Permalink
(#14931) mimalloc: add version 1.7.9, 2.0.9
Browse files Browse the repository at this point in the history
* 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 <prince.chrismc@gmail.com>

* use self.settings instead of self.info.settings

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* create patches for older compilers

---------

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
  • Loading branch information
toge and prince-chrismc authored Jan 30, 2023
1 parent d23a113 commit 27b3b09
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 8 deletions.
20 changes: 20 additions & 0 deletions recipes/mimalloc/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
15 changes: 7 additions & 8 deletions recipes/mimalloc/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -48,6 +48,7 @@ def _compilers_minimum_version(self):
return {
"gcc": "7",
"Visual Studio": "15",
"msvc": "191",
"clang": "5",
"apple-clang": "10",
}
Expand Down Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch
Original file line number Diff line number Diff line change
@@ -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 "$<TARGET_FILE_DIR:mimalloc>/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()

Original file line number Diff line number Diff line change
@@ -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<class T, bool destroy> struct _mi_heap_stl_allocator_common : public _m
#endif

void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }

protected:
std::shared_ptr<mi_heap_t> 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<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }

private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }
22 changes: 22 additions & 0 deletions recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch
Original file line number Diff line number Diff line change
@@ -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 "$<TARGET_FILE_DIR:mimalloc>/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()

Original file line number Diff line number Diff line change
@@ -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<class T, bool destroy> struct _mi_heap_stl_allocator_common : public _m
#endif

void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }

protected:
std::shared_ptr<mi_heap_t> 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<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }

private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }
4 changes: 4 additions & 0 deletions recipes/mimalloc/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.0.9":
folder: all
"2.0.7":
folder: all
"2.0.6":
Expand All @@ -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":
Expand Down

0 comments on commit 27b3b09

Please sign in to comment.