Skip to content

soci: add version 4.1.2 #27611

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions recipes/soci/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ sources:
"4.0.3":
url: "https://github.com/SOCI/soci/archive/v4.0.3.tar.gz"
sha256: "4b1ff9c8545c5d802fbe06ee6cd2886630e5c03bf740e269bb625b45cf934928"
"4.1.2":
url: "https://github.com/SOCI/soci/archive/v4.1.2.tar.gz"
sha256: "c0974067e57242f21d9a85677c5f6cc7848fba3cbd5ec58d76c95570a5a7a15b"
patches:
"4.0.3":
- patch_file: "patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch"
Expand Down
33 changes: 20 additions & 13 deletions recipes/soci/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def export_sources(self):
def layout(self):
cmake_layout(self, src_folder="src")

def build_requirements(self):
if Version(self.version) >= "4.1.0":
self.tool_requires("cmake/[>=3.23 <4]")

def requirements(self):
# New versions will not need transitive_headers=True
if self.options.with_sqlite3:
Expand All @@ -57,36 +61,39 @@ def requirements(self):
if self.options.with_mysql:
self.requires("libmysqlclient/8.1.0", transitive_headers=True)
if self.options.with_postgresql:
self.requires("libpq/15.4", transitive_headers=True)
self.requires("libpq/[>=15.4 <17.0]", transitive_headers=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

@uilianries, @AbrilRBS - let's try and aim to release libpq 17 as well

if self.options.with_boost:
self.requires("boost/1.83.0", transitive_headers=True)

def validate(self):
check_min_cppstd(self, 11)
if Version(self.version) < "4.1.0":
check_min_cppstd(self, 11)
else:
check_min_cppstd(self, 14)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)

def generate(self):
tc = CMakeToolchain(self)

backend_prefix = "WITH" if Version(self.version) < "4.1.0" else "SOCI"
# MacOS @rpath
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
tc.cache_variables["SOCI_SHARED"] = self.options.shared
tc.cache_variables["SOCI_STATIC"] = not self.options.shared
tc.cache_variables["SOCI_TESTS"] = False
tc.cache_variables["SOCI_CXX11"] = True
tc.cache_variables["SOCI_EMPTY"] = self.options.empty
tc.cache_variables["WITH_SQLITE3"] = self.options.with_sqlite3
tc.cache_variables["WITH_DB2"] = False
tc.cache_variables["WITH_ODBC"] = self.options.with_odbc
tc.cache_variables["WITH_ORACLE"] = False
tc.cache_variables["WITH_FIREBIRD"] = False
tc.cache_variables["WITH_MYSQL"] = self.options.with_mysql
tc.cache_variables["WITH_POSTGRESQL"] = self.options.with_postgresql
tc.cache_variables["{}_SQLITE3".format(backend_prefix)] = self.options.with_sqlite3
tc.cache_variables["{}_DB2".format(backend_prefix)] = False
tc.cache_variables["{}_ODBC".format(backend_prefix)] = self.options.with_odbc
tc.cache_variables["{}_ORACLE".format(backend_prefix)] = False
tc.cache_variables["{}_FIREBIRD".format(backend_prefix)] = False
tc.cache_variables["{}_MYSQL".format(backend_prefix)] = self.options.with_mysql
tc.cache_variables["{}_POSTGRESQL".format(backend_prefix)] = self.options.with_postgresql
tc.cache_variables["WITH_BOOST"] = self.options.with_boost
if Version(self.version) < "4.1.0": # pylint: disable=conan-condition-evals-to-constant
tc.cache_variables["SOCI_CXX11"] = True
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
tc.generate()

Expand Down Expand Up @@ -114,9 +121,9 @@ def package_info(self):
self.cpp_info.set_property("cmake_file_name", "SOCI")

target_suffix = "" if self.options.shared else "_static"
lib_prefix = "lib" if is_msvc(self) and not self.options.shared else ""
version = Version(self.version)
lib_suffix = "_{}_{}".format(version.major, version.minor) if self.settings.os == "Windows" else ""
lib_prefix = "lib" if version < "4.1.0" and is_msvc(self) and not self.options.shared else ""
lib_suffix = "_{}_{}".format(version.major, version.minor) if (version < "4.1.0" or self.options.shared) and self.settings.os == "Windows" else ""

# soci_core
self.cpp_info.components["soci_core"].set_property("cmake_target_name", "SOCI::soci_core{}".format(target_suffix))
Expand Down
1 change: 0 additions & 1 deletion recipes/soci/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ if(TARGET SOCI::soci_core_static)
else()
target_link_libraries(${PROJECT_NAME} SOCI::soci_core)
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
5 changes: 5 additions & 0 deletions recipes/soci/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.scm import Version
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"

def build_requirements(self):
if Version(self.tested_reference_str.split('/')[1]) >= "4.1.0":
self.tool_requires("cmake/[>=3.23 <4]")

def requirements(self):
self.requires(self.tested_reference_str)

Expand Down
2 changes: 2 additions & 0 deletions recipes/soci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"4.0.3":
folder: all
"4.1.2":
folder: all