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

wt: move boost options checks in validate() + bump deps + slightly improve deps handling #4798

Merged
merged 3 commits into from
Mar 9, 2021
Merged
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
31 changes: 21 additions & 10 deletions recipes/wt/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import os
import shutil

required_conan_version = ">=1.28.0"
required_conan_version = ">=1.32.0"


class WtConan(ConanFile):
name = "wt"
Expand Down Expand Up @@ -94,24 +95,23 @@ def _required_boost_components(self):
return ["program_options", "filesystem", "thread"]

def requirements(self):
self.requires("boost/1.74.0")
self.requires("boost/1.75.0")
if self.options.connector_http:
self.requires("zlib/1.2.11")
if self.options.with_ssl:
self.requires("openssl/1.1.1h")
self.requires("openssl/1.1.1j")
if self.options.get_safe("with_sqlite"):
self.requires("sqlite3/3.32.3")
self.requires("sqlite3/3.34.1")
if self.options.get_safe("with_mysql"):
self.requires("libmysqlclient/8.0.17")
if self.options.get_safe("with_postgres"):
self.requires("libpq/12.2")
self.requires("libpq/13.2")
if self.options.get_safe("with_mssql") and self.settings.os != "Windows":
self.requires("odbc/2.3.7")
self.requires("odbc/2.3.9")
if self.options.get_safe("with_unwind"):
self.requires("libunwind/1.5.0")

# TODO: move this logic in method which might be implemented by https://github.com/conan-io/conan/issues/7591
def _validate_dependency_graph(self):
def validate(self):
miss_boost_required_comp = any(getattr(self.options["boost"], "without_{}".format(boost_comp), True) for boost_comp in self._required_boost_components)
if self.options["boost"].header_only or miss_boost_required_comp:
raise ConanInvalidConfiguration("Wt requires these boost components: {}".format(", ".join(self._required_boost_components)))
Expand Down Expand Up @@ -159,24 +159,36 @@ def _gather_libs(p):
libs.append(l)
return libs

# FIXME: all this logic coming from upstream custom find module files seems fragile, to improve later !
# we can't even inject cmake_find_package generator, it breaks the all upstream logic
self._cmake.definitions["BOOST_PREFIX"] = self.deps_cpp_info["boost"].rootpath
if self.options.connector_http:
self._cmake.definitions["ZLIB_PREFIX"] = self.deps_cpp_info["zlib"].rootpath
if self.options.with_ssl:
self._cmake.definitions["OPENSSL_PREFIX"] = self.deps_cpp_info["openssl"].rootpath
self._cmake.definitions["SSL_PREFIX"] = self.deps_cpp_info["openssl"].rootpath
self._cmake.definitions["OPENSSL_LIBRARIES"] = ";".join(_gather_libs("openssl"))
self._cmake.definitions["OPENSSL_INCLUDE_DIR"] = ";".join(self.deps_cpp_info["openssl"].include_paths)
self._cmake.definitions["OPENSSL_FOUND"] = True
if self.options.get_safe("with_sqlite"):
self._cmake.definitions["SQLITE3_PREFIX"] = self.deps_cpp_info["sqlite3"].rootpath
if self.options.get_safe("with_mysql"):
self._cmake.definitions["MYSQL_PREFIX"] = self.deps_cpp_info["libmysqlclient"].rootpath
self._cmake.definitions["MYSQL_LIBRARIES"] = ";".join(_gather_libs("libmysqlclient"))
self._cmake.definitions["MYSQL_INCLUDE"] = ";".join(self.deps_cpp_info["libmysqlclient"].include_paths)
self._cmake.definitions["MYSQL_DEFINITIONS"] = ";".join("-D%s" % d for d in self.deps_cpp_info["libmysqlclient"].defines)
self._cmake.definitions["MYSQL_FOUND"] = True
if self.options.get_safe("with_postgres"):
self._cmake.definitions["POSTGRES_PREFIX"] = self.deps_cpp_info["libpq"].rootpath
self._cmake.definitions["POSTGRES_LIBRARIES"] = ";".join(_gather_libs("libpq"))
self._cmake.definitions["POSTGRES_INCLUDE"] = ";".join(self.deps_cpp_info["libpq"].include_paths)
self._cmake.definitions["POSTGRES_FOUND"] = True
if self.options.get_safe("with_mssql") and self.settings.os != "Windows":
self._cmake.definitions["ODBC_PREFIX"] = self.deps_cpp_info["odbc"].rootpath
self._cmake.definitions["ODBC_LIBRARIES"] = ";".join(_gather_libs("odbc"))
self._cmake.definitions["ODBC_INCLUDE"] = ";".join(self.deps_cpp_info["odbc"].include_paths)
self._cmake.definitions["ODBC_FOUND"] = True
if self.options.get_safe("with_unwind"):
self._cmake.definitions["UNWIND_PREFIX"] = self.deps_cpp_info["libunwind"].rootpath
if self.settings.os == "Windows":
self._cmake.definitions["CONNECTOR_FCGI"] = False
self._cmake.definitions["CONNECTOR_ISAPI"] = self.options.connector_isapi
Expand All @@ -187,7 +199,6 @@ def _gather_libs(p):
return self._cmake

def build(self):
self._validate_dependency_graph()
tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "find_package(OpenSSL)", "#find_package(OpenSSL)")
tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "INCLUDE(cmake/WtFindMysql.txt)", "#INCLUDE(cmake/WtFindMysql.txt)")
tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "INCLUDE(cmake/WtFindPostgresql.txt)", "#INCLUDE(cmake/WtFindPostgresql.txt)")
Expand Down