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: Added recipe option for MI_WIN_REDIRECT #26647

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
15 changes: 14 additions & 1 deletion recipes/mimalloc/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -35,6 +36,7 @@ class MimallocConan(ConanFile):
"override": False,
"inject": False,
"single_object": False,
"win_redirect": False,
}

def export_sources(self):
Expand All @@ -43,6 +45,8 @@ def export_sources(self):
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:
Expand All @@ -68,6 +72,7 @@ def configure(self):
self.options.rm_safe("single_object")
self.options.rm_safe("inject")


def layout(self):
cmake_layout(self, src_folder="src")

Expand All @@ -88,6 +93,14 @@ def validate(self):
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 \
Expand All @@ -108,7 +121,7 @@ def generate(self):
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)
Expand Down