Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimalloc: add version 1.7.9, 2.0.9 #14931

Merged
merged 6 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 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,10 @@ 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"
"2.0.7":
- patch_file: "patches/2.0.7-0001-change-install-paths.patch"
patch_description: "fix install paths"
Expand All @@ -50,6 +60,10 @@ 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"
"1.7.7":
- patch_file: "patches/1.7.7-0001-change-install-paths.patch"
patch_description: "fix install paths"
Expand Down
22 changes: 14 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.info.settings.compiler), False)
toge marked this conversation as resolved.
Show resolved Hide resolved
if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
toge marked this conversation as resolved.
Show resolved Hide resolved
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 All @@ -144,6 +143,13 @@ def build(self):
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"mimalloc-redirect.lib",
"mimalloc-redirect32.lib")
if self.version in ["1.7.9", "2.0.9"]:
replace_in_file(self, os.path.join(self.source_folder, "include", "mimalloc.h"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a patch please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prince-chrismc
I agree with you!
I create patches for it.

"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); }")
replace_in_file(self, os.path.join(self.source_folder, "include", "mimalloc.h"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a patch please?

"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) { }")
cmake = CMake(self)
cmake.configure()
cmake.build()
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()

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()

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