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

mysql-connector-cpp:8.3.0 #17594

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
c73e448
add mysql connector cpp
samuaz May 17, 2023
e677ff6
Merge branch 'master' into master
samuaz May 17, 2023
cc55bca
fix topic
samuaz May 17, 2023
359e741
fix topic
samuaz May 17, 2023
c10f75c
clean
samuaz May 17, 2023
cc9ac82
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz May 17, 2023
c1b519e
apply suggestions
samuaz May 17, 2023
35ebf16
Merge branch 'master' into master
samuaz May 17, 2023
5824edf
apply suggestions
samuaz May 17, 2023
a79b652
Merge branch 'master' into master
samuaz May 20, 2023
979d848
Merge branch 'master' into master
samuaz May 24, 2023
d9bd970
update minimal gcc version
samuaz May 25, 2023
a3118df
update minimal gcc version
samuaz May 25, 2023
b5c5e24
Merge branch 'master' into master
samuaz May 25, 2023
3b99960
remove protobuf dep
samuaz May 25, 2023
9302cda
fix mac build
samuaz May 25, 2023
e3c36a3
fix mac build
samuaz May 25, 2023
6a20bad
Merge branch 'master' into master
samuaz May 25, 2023
67baac8
fix mac build
samuaz May 25, 2023
37cf658
Merge branch 'master' of github-samuaz:samuaz/conan-center-index
samuaz May 25, 2023
2dbfc42
fix mac build
samuaz May 25, 2023
7987a44
Merge branch 'master' into master
samuaz Jun 15, 2023
f75015e
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Aug 15, 2023
b0b24ca
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Aug 15, 2023
ad19c6f
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Aug 15, 2023
391ebc3
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Aug 15, 2023
df6cff8
Merge branch 'master' into master
samuaz Aug 16, 2023
fc5ee7e
Update conanfile.py
samuaz Aug 16, 2023
4414110
Merge branch 'master' into master
samuaz Aug 16, 2023
6fb64fd
force to use openssl 1.1.1u for mac due to conan ci fails
samuaz Aug 16, 2023
d47f42d
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Aug 27, 2023
1843fbe
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Aug 27, 2023
a498fa7
Merge branch 'master' into master
samuaz Aug 27, 2023
bada841
Improve recipe support
uilianries Sep 4, 2023
b35b8ce
Merge pull request #2 from uilianries/mysql-connector
samuaz Feb 7, 2024
43b2859
Merge branch 'master' into master
samuaz Feb 7, 2024
4dd8ac7
Merge branch 'master' into master
samuaz Feb 7, 2024
ab680bc
Solve comments and update to 8.3.0 and mac support
samuaz Feb 15, 2024
d83ebac
Solve comments and update to 8.3.0 and mac support
samuaz Feb 15, 2024
461540f
Solve comments and update to 8.3.0 and mac support
samuaz Feb 15, 2024
8db4c5c
Solve comments and update to 8.3.0 and mac support
samuaz Feb 15, 2024
2864a1c
Merge branch 'master' into master
samuaz Feb 15, 2024
9f58017
Update libmysql dep to 8.1.0
samuaz Feb 15, 2024
72e6a94
Solve comments
samuaz Feb 16, 2024
cede1ff
Merge branch 'master' of github-samuaz:samuaz/conan-center-index
samuaz Feb 17, 2024
fd33645
fix tests
samuaz Feb 17, 2024
4c88722
Merge branch 'master' into master
samuaz Feb 17, 2024
ba130a8
mysql-connector-cpp add licenses to package
samuaz Feb 23, 2024
6575909
FIX license
samuaz Mar 3, 2024
811958b
Merge branch 'master' into master
samuaz Mar 3, 2024
294ae18
FIX IMPORT
samuaz Mar 3, 2024
d8fe9de
Merge branch 'master' of github-samuaz:samuaz/conan-center-index
samuaz Mar 3, 2024
f7f9385
clean up test
samuaz Mar 3, 2024
1049b14
fix build clean cmake config
samuaz Mar 3, 2024
2014f03
fix test withjdbc
samuaz Mar 3, 2024
f2c6f41
Update recipes/mysql-connector-cpp/all/test_package/conanfile.py
samuaz Mar 7, 2024
495e6d3
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Mar 7, 2024
9dc26b6
Update recipes/mysql-connector-cpp/all/test_package/CMakeLists.txt
samuaz Mar 7, 2024
057ae9c
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Mar 7, 2024
a1bd617
Update recipes/mysql-connector-cpp/all/conanfile.py
samuaz Mar 7, 2024
4095a04
Updates
samuaz Mar 7, 2024
19f769b
Fix string check
uilianries Mar 11, 2024
d88c42d
mysql-connector-cpp remove oldest versions
samuaz Mar 11, 2024
b6efc0a
Merge branch 'master' of github-samuaz:samuaz/conan-center-index
samuaz Mar 11, 2024
f0b993d
Merge branch 'master' into master
samuaz Mar 11, 2024
0ae0935
mysql-connector-cpp remove oldest versions
samuaz Mar 12, 2024
17b55d6
mysql-connector-cpp remove oldest versions
samuaz Mar 12, 2024
a3b7502
mysql-connector-cpp remove oldest versions
samuaz Mar 12, 2024
e0e885a
mysql-connector-cpp remove oldest versions
samuaz Mar 12, 2024
cecbd17
mysql-connector-cpp remove oldest versions
samuaz Mar 12, 2024
f261d2c
Merge branch 'master' into master
samuaz Apr 20, 2024
0aa219c
add openssl
samuaz Apr 20, 2024
25487cf
add openssl
samuaz Apr 20, 2024
e51018c
Merge branch 'master' into master
samuaz May 26, 2024
09e8071
Merge branch 'master' into master
samuaz Jun 7, 2024
2863b27
mysql-connector-cpp just restart the build
samuaz Aug 1, 2024
64ad1d7
avoid duplicated symbols on ssl
samuaz Aug 1, 2024
86a5df4
mysql-connector-cpp try to avoid duplicated symbols in libcrypto
samuaz Aug 1, 2024
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
4 changes: 4 additions & 0 deletions recipes/mysql-connector-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"8.0.33":
url: "https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-8.0.33-src.tar.gz"
sha256: "160cf6881fbde9bd46cd11aaf12930b676bc6e27589ac5c7ba49c196b97e053b"
116 changes: 116 additions & 0 deletions recipes/mysql-connector-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake
from conan.tools.files import get
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd, cross_building, stdcpp_library

class MysqlConnectorCPPRecipe(ConanFile):
name = "mysql-connector-cpp"
license = "GPL-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://dev.mysql.com/doc/connector-cpp/8.0"
description = "A Conan package for MySQL Connector/C++ with OpenSSL, Boost, and libmysqlclient"
topics = ("mysql", "connector", "cpp", "openssl", "boost", "libmysqlclient", "jdbc", "static")
settings = "os", "compiler", "build_type", "arch"
samuaz marked this conversation as resolved.
Show resolved Hide resolved
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}

@property
def _min_cppstd(self):
return "17"
samuaz marked this conversation as resolved.
Show resolved Hide resolved

@property
def _compilers_minimum_version(self):
return {
"Visual Studio": "16",
"msvc": "192",
"gcc": "9" if Version(self.version) >= "8.0.27" else "5.3",
"clang": "6",
}

def requirements(self):
self.requires("boost/1.82.0")
# build faiils on mac with openssl 3x
samuaz marked this conversation as resolved.
Show resolved Hide resolved
if self.settings.os == "Macos":
self.requires("openssl/[>=1.1.1. <3]")
samuaz marked this conversation as resolved.
Show resolved Hide resolved
else:
self.requires("openssl/[>=1.1.1 <4]")
self.requires("libmysqlclient/8.0.31")
samuaz marked this conversation as resolved.
Show resolved Hide resolved

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

def validate_build(self):
if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True):
raise ConanInvalidConfiguration("Cross compilation not yet supported by the recipe. Contributions are welcomed.")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)

def loose_lt_semver(v1, v2):
lv1 = [int(v) for v in v1.split(".")]
lv2 = [int(v) for v in v2.split(".")]
min_length = min(len(lv1), len(lv2))
return lv1[:min_length] < lv2[:min_length]

minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version):
raise ConanInvalidConfiguration(f"{self.ref} requires {self.settings.compiler} {minimum_version} or newer")

# I dont have a windows computer to test it
samuaz marked this conversation as resolved.
Show resolved Hide resolved
if self.settings.os == "Windows":
raise ConanInvalidConfiguration(f"{self.ref} doesn't support windows for now")

# Sice 8.0.17 this doesn't support shared library on MacOS.
# https://github.com/mysql/mysql-server/blob/mysql-8.0.17/cmake/libutils.cmake#L333-L335
if self.settings.compiler == "apple-clang" and self.options.shared:
raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared library on apple-clang")

# mysql < 8.0.29 uses `requires` in source code. It is the reserved keyword in C++20.
# https://github.com/mysql/mysql-server/blob/mysql-8.0.0/include/mysql/components/services/dynamic_loader.h#L270
if self.settings.compiler.get_safe("cppstd") == "20" and Version(self.version) < "8.0.29":
samuaz marked this conversation as resolved.
Show resolved Hide resolved
raise ConanInvalidConfiguration(f"{self.ref} doesn't support C++20")

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["WITH_JDBC"] = "ON"
tc.cache_variables["WITHOUT_SERVER"] = "ON"
if not self.options.shared:
tc.cache_variables["BUILD_STATIC"] = "ON"
tc.cache_variables["MYSQL_LIB_DIR"] = self.dependencies["libmysqlclient"].cpp_info.aggregated_components().libdirs[0].replace("\\", "/")
tc.cache_variables["MYSQL_INCLUDE_DIR"] = self.dependencies["libmysqlclient"].cpp_info.aggregated_components().includedirs[0].replace("\\", "/")
tc.cache_variables["WITH_SSL"] = self.dependencies["openssl"].package_folder.replace("\\", "/")
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libdirs = ["lib","lib64"]
if not self.options.shared:
self.cpp_info.libs = ["mysqlcppconn-static", "mysqlcppconn8-static"]
stdcpplib = stdcpp_library(self)
samuaz marked this conversation as resolved.
Show resolved Hide resolved
if stdcpplib:
self.cpp_info.system_libs.append(stdcpplib)
if self.settings.os in ["Linux", "FreeBSD", "Macos"]:
self.cpp_info.system_libs.extend(["m", "resolv"])
else:
self.cpp_info.libs = ["mysqlcppconn", "mysqlcppconn8"]
self.cpp_info.names["cmake_find_package"] = "mysql-connector-cpp"
self.cpp_info.names["cmake_find_package_multi"] = "mysql-connector-cpp"
6 changes: 6 additions & 0 deletions recipes/mysql-connector-cpp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.15)
project(MySQLConnectorCPPTest CXX)

find_package(mysql-connector-cpp REQUIRED CONFIG)
add_executable(test_package src/test_package.cpp)
target_link_libraries(test_package mysql-connector-cpp::mysql-connector-cpp)
25 changes: 25 additions & 0 deletions recipes/mysql-connector-cpp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run

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

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

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def layout(self):
cmake_layout(self)

def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "test_package")
self.run(cmd, env="conanrun")
11 changes: 11 additions & 0 deletions recipes/mysql-connector-cpp/all/test_package/src/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <iostream>
#include <mysql/jdbc.h>
#include <jdbc/mysql_driver.h>
#include <jdbc/cppconn/driver.h>
#include <jdbc/cppconn/exception.h>

int main() {
auto driver = sql::mysql::get_mysql_driver_instance();
std::cout << "MySQL connector cpp works" << std::endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
Copy link
Member

Choose a reason for hiding this comment

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

The test_v1_package can be removed: #17406

project(test_package LANGUAGES C)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
find_package(mysql-connector-cpp REQUIRED CONFIG)
add_executable(test_package src/test_package.cpp)
target_link_libraries(test_package mysql-connector-cpp::mysql-connector-cpp)
18 changes: 18 additions & 0 deletions recipes/mysql-connector-cpp/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from conans import ConanFile, CMake
from conan.tools.build import cross_building
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
3 changes: 3 additions & 0 deletions recipes/mysql-connector-cpp/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"8.0.33":
folder: all