mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-04-30 15:56:41 +00:00
mimalloc: Added recipe option for MI_WIN_REDIRECT (#26647)
* added recipe option for MI_WIN_REDIRECT * Added validation for win_redirect
This commit is contained in:
@ -27,6 +27,7 @@ class MimallocConan(ConanFile):
|
||||
"override": [True, False],
|
||||
"inject": [True, False],
|
||||
"single_object": [True, False],
|
||||
"win_redirect": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
@ -35,6 +36,7 @@ class MimallocConan(ConanFile):
|
||||
"override": False,
|
||||
"inject": False,
|
||||
"single_object": False,
|
||||
"win_redirect": False,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
@ -43,6 +45,8 @@ class MimallocConan(ConanFile):
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
else:
|
||||
del self.options.win_redirect
|
||||
|
||||
# single_object and inject are options
|
||||
# only when overriding on Unix-like platforms:
|
||||
@ -68,6 +72,7 @@ class MimallocConan(ConanFile):
|
||||
self.options.rm_safe("single_object")
|
||||
self.options.rm_safe("inject")
|
||||
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
@ -88,6 +93,14 @@ class MimallocConan(ConanFile):
|
||||
is_msvc_static_runtime(self):
|
||||
raise ConanInvalidConfiguration(
|
||||
"Dynamic runtime (MD/MDd) is required when using mimalloc as a shared library for override")
|
||||
|
||||
if self.options.get_safe("win_redirect") and not (
|
||||
self.options.override and \
|
||||
self.options.shared and \
|
||||
is_msvc(self) and \
|
||||
not is_msvc_static_runtime(self)):
|
||||
raise ConanInvalidConfiguration(
|
||||
"Windows redirect requires 'override', 'shared' and building against a dynamic runtime (MD/MDd)")
|
||||
|
||||
if self.options.override and \
|
||||
self.options.get_safe("single_object") and \
|
||||
@ -108,7 +121,7 @@ class MimallocConan(ConanFile):
|
||||
tc.variables["MI_BUILD_OBJECT"] = self.options.get_safe("single_object", False)
|
||||
tc.variables["MI_OVERRIDE"] = "ON" if self.options.override else "OFF"
|
||||
tc.variables["MI_SECURE"] = "ON" if self.options.secure else "OFF"
|
||||
tc.variables["MI_WIN_REDIRECT"] = "OFF"
|
||||
tc.variables["MI_WIN_REDIRECT"] = "ON" if self.options.get_safe("win_redirect") else "OFF"
|
||||
tc.variables["MI_INSTALL_TOPLEVEL"] = "ON"
|
||||
tc.generate()
|
||||
venv = VirtualBuildEnv(self)
|
||||
|
Reference in New Issue
Block a user