Skip to content

Commit 7623c38

Browse files
authored
[pistache] Proper manage libevent dependency (#28376)
* Do not install libevent by default Signed-off-by: Uilian Ries <uilianries@gmail.com> * Libevent is only optional for Linux Signed-off-by: Uilian Ries <uilianr@jfrog.com> * Convert Conan option value to bool - fix Conan warning Signed-off-by: Uilian Ries <uilianr@jfrog.com> --------- Signed-off-by: Uilian Ries <uilianries@gmail.com> Signed-off-by: Uilian Ries <uilianr@jfrog.com>
1 parent 8c95534 commit 7623c38

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

recipes/pistache/all/conanfile.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PistacheConan(ConanFile):
3131
"shared": False,
3232
"fPIC": True,
3333
"with_ssl": False,
34-
"with_libevent": True
34+
"with_libevent": False
3535
}
3636
implements = ["auto_shared_fpic"]
3737

@@ -56,15 +56,16 @@ def requirements(self):
5656
self.requires("date/3.0.1")
5757
if self.options.with_ssl:
5858
self.requires("openssl/[>=1.1 <4]")
59-
if self.options.get_safe("with_libevent", True):
59+
if self.settings.os != "Linux" or self.options.get_safe("with_libevent"):
60+
# INFO: meson.build:188: Linux can use native epoll support. Other OS need libevent always
6061
self.requires("libevent/2.1.12")
6162

6263
def validate(self):
6364
if self.settings.os != "Linux" and Version(self.version) < "0.4.25":
6465
raise ConanInvalidConfiguration(f"{self.ref} is only support on Linux.")
6566
if self.settings.compiler == "clang" and Version(self.version) < "0.4.25":
6667
raise ConanInvalidConfiguration(f"{self.ref}'s clang support is broken. See pistacheio/pistache#835.")
67-
68+
6869
if Version(self.version) == "0.4.25" and self.settings.os == "Windows":
6970
# See https://github.com/conan-io/conan-center-index/pull/26463#issuecomment-2962541819
7071
raise ConanInvalidConfiguration("Windows builds are broken - contributions welcome")
@@ -83,12 +84,12 @@ def source(self):
8384

8485
def generate(self):
8586
tc = MesonToolchain(self)
86-
tc.project_options["PISTACHE_USE_SSL"] = self.options.with_ssl
87+
tc.project_options["PISTACHE_USE_SSL"] = bool(self.options.with_ssl)
8788
tc.project_options["PISTACHE_BUILD_EXAMPLES"] = False
8889
tc.project_options["PISTACHE_BUILD_TESTS"] = False
8990
tc.project_options["PISTACHE_BUILD_DOCS"] = False
90-
if self._supports_libevent:
91-
tc.project_options["PISTACHE_FORCE_LIBEVENT"] = self.options.get_safe("with_libevent", True)
91+
if self.settings.os == "Linux" and self._supports_libevent:
92+
tc.project_options["PISTACHE_FORCE_LIBEVENT"] = bool(self.options.with_libevent)
9293
tc.generate()
9394
deps = PkgConfigDeps(self)
9495
deps.generate()
@@ -121,7 +122,7 @@ def package_info(self):
121122

122123
self.cpp_info.components["libpistache"].libs = collect_libs(self)
123124
self.cpp_info.components["libpistache"].requires = ["rapidjson::rapidjson"]
124-
if self.options.get_safe("with_libevent", True):
125+
if self.settings.os != "Linux" or self.options.get_safe("with_libevent"):
125126
self.cpp_info.components["libpistache"].requires.append("libevent::libevent")
126127
self.cpp_info.components["libpistache"].requires.append("date::date")
127128
if self.options.with_ssl:

0 commit comments

Comments
 (0)