Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions cmake/SetupPostgresqlDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ _userver_macos_set_default_dir(USERVER_PG_LIBRARY_DIR "pg_config;--libdir")
_userver_macos_set_default_dir(USERVER_PG_SERVER_INCLUDE_DIR "pg_config;--includedir-server")
_userver_macos_set_default_dir(USERVER_PG_SERVER_LIBRARY_DIR "pg_config;--pkglibdir")

# We need libldap to statically link with libpq There is no FindLdap.cmake and no package config files for ldap library,
# so need to search for it by hand.
find_library(LDAP_LIBRARY NAMES libldap.so libldap.dylib libldap.framework)
find_package(OpenLDAP CONFIG QUIET)
if(OpenLDAP_FOUND)
set(LDAP_LIBRARY openldap::openldap)
endif()

if(NOT LDAP_LIBRARY)
find_library(LDAP_LIBRARY NAMES libldap.so libldap.dylib libldap.framework)
endif()

if(NOT LDAP_LIBRARY)
message(
FATAL_ERROR
Expand Down
19 changes: 19 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ def requirements(self):
# `run=True` required to find `pg_config` binary during `psycopg2` python module build
# without system package. We use system package.
self.requires('libpq/[>=14.9 <20]')
if self.options.with_postgresql_extra:
self.requires('openldap/[^2.6]')
self.requires('krb5/[^1.21]')
if self.options.with_mongodb or self.options.with_kafka:
self.requires('cyrus-sasl/[^2.1]')
if self.options.with_mongodb:
Expand Down Expand Up @@ -222,6 +225,13 @@ def generate(self):
tool_ch.cache_variables['USERVER_FEATURE_GRPC_PROTOVALIDATE'] = self.options.with_grpc_protovalidate
tool_ch.cache_variables['USERVER_DISABLE_PHDR_CACHE'] = not self.options.with_phdr_cache

cmake_modules_path = os.path.join(self.source_folder, 'cmake', 'modules')
existing_module_path = tool_ch.cache_variables.get('CMAKE_MODULE_PATH', '')
if existing_module_path:
tool_ch.cache_variables['CMAKE_MODULE_PATH'] = f'{cmake_modules_path};{existing_module_path}'
else:
tool_ch.cache_variables['CMAKE_MODULE_PATH'] = cmake_modules_path
Comment on lines +228 to +233
Copy link
Contributor Author

@vasily-sviridov vasily-sviridov Feb 25, 2026

Choose a reason for hiding this comment

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

Этот код мне совсем не нравится, мб это в какой-нибудь cmake-файл перенести? Посоветуйте место, пожалуйста.


if self.options.with_grpc:
tool_ch.cache_variables['USERVER_GOOGLE_COMMON_PROTOS'] = (
self.dependencies['googleapis'].cpp_info.components['google_rpc_status_proto'].resdirs[0]
Expand All @@ -234,6 +244,15 @@ def generate(self):
'user.opentelemetry-proto:proto_root',
)

if self.options.with_postgresql_extra:
libpq = self.dependencies['libpq']
libpq_package_folder = libpq.package_folder

tool_ch.cache_variables['USERVER_PG_SERVER_INCLUDE_DIR'] = os.path.join(
libpq_package_folder, 'include', 'postgresql', 'server'
)
tool_ch.cache_variables['USERVER_PG_SERVER_LIBRARY_DIR'] = os.path.join(libpq_package_folder, 'lib')
Comment on lines +247 to +254
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Не совсем очевидно, как это тестировать в рамках ci. libpq patch требует завендоренной версии libpq


tool_ch.generate()

CMakeDeps(self).generate()
Expand Down
Loading