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

mariadb-conector-cpp::1.1.3 #22865

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 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
1c19520
ADD MARIADB-CONNECTOR-CPP support
samuaz Feb 22, 2024
35f7af0
mariadb-connector-cpp cleanup
samuaz Feb 22, 2024
dfc2ea1
ADD licenses
samuaz Feb 29, 2024
16bdcce
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz Feb 29, 2024
e34639f
Fix licenses and shared build
samuaz Mar 1, 2024
3dea424
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz Mar 1, 2024
b089591
FIX PATCH FOR 1.1.3
samuaz Mar 2, 2024
23e2aab
Merge branch 'mariadb-connector-cpp-using-mariadblib' of github-samua…
samuaz Mar 2, 2024
efc30fb
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz Mar 2, 2024
6f4c041
FIX PATCH FOR 1.1.3
samuaz Mar 2, 2024
8b0a2bb
FIX PATCH FOR 1.1.3
samuaz Mar 2, 2024
f1f0fd2
add patch type
samuaz Mar 2, 2024
6497b94
UPDATE LICENSE
samuaz Mar 2, 2024
79ce5c6
remove share folder
samuaz Mar 2, 2024
314cc55
FIX DEBUG BUILD
samuaz Mar 2, 2024
5375e0b
FIX TEST CXX
samuaz Mar 2, 2024
fbf4865
Update recipes/mariadb-connector-cpp/all/conanfile.py
samuaz Mar 19, 2024
3afec58
Update recipes/mariadb-connector-cpp/all/conanfile.py
samuaz Mar 20, 2024
e0d1172
solve some comments
samuaz Mar 21, 2024
7761437
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz Mar 21, 2024
0f65f43
Fix build requirements
samuaz Mar 21, 2024
2d5916d
Update recipes/mariadb-connector-cpp/all/conanfile.py
samuaz Apr 20, 2024
337407f
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz Apr 20, 2024
c2b04f5
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz Apr 20, 2024
c3d491f
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz May 26, 2024
53b5c5b
Merge branch 'master' into mariadb-connector-cpp-using-mariadblib
samuaz Jun 7, 2024
495e78a
Update conanfile.py
samuaz Jun 7, 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
16 changes: 16 additions & 0 deletions recipes/mariadb-connector-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sources:
"1.1.3":
url: "https://dlm.mariadb.com/3752091/Connectors/cpp/connector-cpp-1.1.3/mariadb-connector-cpp-1.1.3-src.tar.gz"
sha256: "8100ea7f49bb25bea70aa5e6eced95f855b1cfce9b03fe1c95162f40722e803e"
"1.0.3":
url: "https://dlm.mariadb.com/3700669/Connectors/cpp/connector-cpp-1.0.3/mariadb-connector-cpp-1.0.3-src.tar.gz"
sha256: "706462facc982f5c9aeacaf8c1613055ec5961b2d121bed9da34cb88f666b068"
patches:
"1.1.3":
- patch_file: "patches/1.1.3-0001-fix-static-or-shared.patch"
patch_type: "portability"
patch_description: "creates shared or static build but not both"
"1.0.3":
- patch_file: "patches/1.0.3-0001-fix-static-or-shared.patch"
patch_type: "portability"
patch_description: "creates shared or static build but not both"
145 changes: 145 additions & 0 deletions recipes/mariadb-connector-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeDeps, cmake_layout, CMakeToolchain
from conan.tools.files import get, collect_libs, replace_in_file, rm, copy, apply_conandata_patches, export_conandata_patches, rmdir
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv
from conan.tools.build import check_min_cppstd
import os

requird_conan_version = ">=1.54.0"

class MariadbConnectorCPPRecipe(ConanFile):
name = "mariadb-connector-cpp"
license = "GPL-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://mariadb.com/docs/server/connect/programming-languages/cpp/"
description = "A Mariadb database connector for C++ applications that connect to MySQL servers"
topics = ("mariadb", "connector", "jdbc")
package_type = "library"
settings = "os", "compiler", "build_type", "arch"

options = {
"shared": [True, False],
"fPIC": [True, False],
"with_ssl": [False, "openssl", "gnutls", "schannel"],
"with_curl": [True, False]
}
default_options = {
"shared": False,
"fPIC": True,
"with_ssl": "openssl",
"with_curl": True
}

def export_sources(self):
export_conandata_patches(self)

@property
def _min_cppstd(self):
return "11"

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("mariadb-connector-c/3.3.3")
self.requires("zlib/[>=1.2.10 <2]")
self.requires("zstd/1.5.5")
if self.options.with_ssl == "openssl":
self.requires("openssl/[>=1.1 <4]")

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

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

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
# I dont have a windows computer to test it
if self.settings.os == "Windows":
raise ConanInvalidConfiguration(f"{self.ref} doesn't support windows for now")

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")
# if we are compiling as shared, we need to also compile the mariadbclient as shared
self.options["mariadb-connector-c"].shared = self.options.shared
Comment on lines +71 to +72
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# if we are compiling as shared, we need to also compile the mariadbclient as shared
self.options["mariadb-connector-c"].shared = self.options.shared
# if we are compiling as shared, we need to also compile the mariadbclient as shared
self.options["mariadb-connector-c"].shared = self.options.shared

What error do you have in case having it mixed? Need to validate it as well, because it can be overridden manually.

Copy link
Author

Choose a reason for hiding this comment

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

@uilianries

i get this error when build shared=true without doing that

[100%] Linking CXX shared library libmariadbcpp.dylib
Undefined symbols for architecture arm64:
  "_ERR_get_error", referenced from:
      _ma_tls_set_error in libmariadb.a[32](openssl.c.o)
  "_ERR_peek_error", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_ERR_reason_error_string", referenced from:
      _ma_tls_set_error in libmariadb.a[32](openssl.c.o)
  "_EVP_PKEY_free", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_EVP_PKEY_new", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_EVP_sha1", referenced from:
      _ma_tls_get_finger_print in libmariadb.a[32](openssl.c.o)
  "_OPENSSL_init_ssl", referenced from:
      _ma_tls_start in libmariadb.a[32](openssl.c.o)
  "_OpenSSL_version", referenced from:
      _ma_tls_start in libmariadb.a[32](openssl.c.o)
  "_PEM_read_PrivateKey", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CIPHER_get_name", referenced from:
      _ma_tls_get_cipher in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_check_private_key", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_free", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_get_cert_store", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_load_verify_locations", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_new", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_set_cipher_list", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_set_ciphersuites", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_set_default_verify_paths", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_set_options", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_set_verify", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_use_PrivateKey", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_CTX_use_certificate_chain_file", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_clear", referenced from:
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
  "_SSL_connect", referenced from:
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
  "_SSL_free", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
  "_SSL_get1_peer_certificate", referenced from:
      _ma_tls_verify_server_cert in libmariadb.a[32](openssl.c.o)
      _ma_tls_get_finger_print in libmariadb.a[32](openssl.c.o)
  "_SSL_get_SSL_CTX", referenced from:
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
  "_SSL_get_current_cipher", referenced from:
      _ma_tls_get_cipher in libmariadb.a[32](openssl.c.o)
  "_SSL_get_error", referenced from:
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
      _ma_tls_read_async in libmariadb.a[32](openssl.c.o)
      _ma_tls_write_async in libmariadb.a[32](openssl.c.o)
      _ma_tls_read in libmariadb.a[32](openssl.c.o)
      _ma_tls_write in libmariadb.a[32](openssl.c.o)
  "_SSL_get_ex_data", referenced from:
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
      _ma_tls_read in libmariadb.a[32](openssl.c.o)
      _ma_tls_write in libmariadb.a[32](openssl.c.o)
      _ma_tls_verify_server_cert in libmariadb.a[32](openssl.c.o)
      _ma_tls_get_finger_print in libmariadb.a[32](openssl.c.o)
  "_SSL_get_verify_result", referenced from:
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
  "_SSL_new", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_SSL_read", referenced from:
      _ma_tls_read_async in libmariadb.a[32](openssl.c.o)
      _ma_tls_read_async in libmariadb.a[32](openssl.c.o)
      _ma_tls_read in libmariadb.a[32](openssl.c.o)
  "_SSL_set_ex_data", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
      _ma_tls_set_connection in libmariadb.a[32](openssl.c.o)
  "_SSL_set_fd", referenced from:
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
  "_SSL_set_quiet_shutdown", referenced from:
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
  "_SSL_shutdown", referenced from:
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
      _ma_tls_close in libmariadb.a[32](openssl.c.o)
  "_SSL_version", referenced from:
      _ma_tls_get_protocol_version in libmariadb.a[32](openssl.c.o)
  "_SSL_write", referenced from:
      _ma_tls_write_async in libmariadb.a[32](openssl.c.o)
      _ma_tls_write_async in libmariadb.a[32](openssl.c.o)
      _ma_tls_write in libmariadb.a[32](openssl.c.o)
  "_TLS_client_method", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_X509_STORE_load_locations", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_X509_STORE_set_flags", referenced from:
      _ma_tls_init in libmariadb.a[32](openssl.c.o)
  "_X509_check_host", referenced from:
      _ma_tls_verify_server_cert in libmariadb.a[32](openssl.c.o)
  "_X509_check_ip_asc", referenced from:
      _ma_tls_verify_server_cert in libmariadb.a[32](openssl.c.o)
  "_X509_digest", referenced from:
      _ma_tls_get_finger_print in libmariadb.a[32](openssl.c.o)
  "_X509_free", referenced from:
      _ma_tls_verify_server_cert in libmariadb.a[32](openssl.c.o)
      _ma_tls_verify_server_cert in libmariadb.a[32](openssl.c.o)
      _ma_tls_get_finger_print in libmariadb.a[32](openssl.c.o)
      _ma_tls_get_finger_print in libmariadb.a[32](openssl.c.o)
  "_X509_verify_cert_error_string", referenced from:
      _ma_tls_connect in libmariadb.a[32](openssl.c.o)
  "_compress2", referenced from:
      _ma_zlib_compress in libmariadb.a[4](c_zlib.c.o)
  "_uncompress", referenced from:
      _ma_zlib_decompress in libmariadb.a[4](c_zlib.c.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libmariadbcpp.dylib] Error 1
make[1]: *** [CMakeFiles/mariadbcpp.dir/all] Error 2
make: *** [all] Error 2



def _package_folder_dep(self, dep):
return self.dependencies[dep].package_folder.replace("\\", "/")

def _include_folder_dep(self, dep):
return self.dependencies[dep].cpp_info.includedirs[0].replace("\\", "/")

def _lib_folder_dep(self, dep):
return self.dependencies[dep].cpp_info.libdirs[0].replace("\\", "/")

def generate(self):
env = VirtualBuildEnv(self)
env.generate(scope="build")
tc = CMakeDeps(self)
tc.generate()
tc = CMakeToolchain(self)
tc.variables["USE_SYSTEM_INSTALLED_LIB"] = True
tc.variables["WITH_UNIT_TESTS"] = False
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["MARIADB_LINK_DYNAMIC"] = self.options.shared
tc.variables["CONC_WITH_UNIT_TESTS"] = False
tc.variables["WITH_SSL"] = self.options.with_ssl
tc.variables["WITH_EXTERNAL_ZLIB"] = True
tc.variables["INSTALL_BINDIR"] = "bin"
tc.variables["INSTALL_LIBDIR"] = "lib"
tc.variables["INSTALL_PLUGINDIR"] = os.path.join("lib", "plugin").replace("\\", "/")
# To install relocatable shared libs on Macos
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
samuaz marked this conversation as resolved.
Show resolved Hide resolved
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()

def _patch_sources(self):
apply_conandata_patches(self)
root_cmake = os.path.join(self.source_folder, "CMakeLists.txt")
libmysqlclient_dir = self._include_folder_dep("mariadb-connector-c")

# we need to inject into mariadb-connector-cpp the headers of conan mariadb-connector-c
replace_in_file(self,
root_cmake,
"INCLUDE(SetValueMacro)",
"INCLUDE(SetValueMacro)\n" + f"INCLUDE_DIRECTORIES({libmysqlclient_dir}/mariadb)"
)

# find the correct library
replace_in_file(self,
root_cmake,
"FIND_LIBRARY(CCLIB libmariadb.so)",
"FIND_LIBRARY(CCLIB mariadb)"
)

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

def package(self):
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rm(self, "INFO_SRC", self.package_folder)
rm(self, "INFO_BIN", self.package_folder)
rmdir(self, os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.set_property("pkg_config_name", "libmariadbcpp")
self.cpp_info.includedirs.append(os.path.join("include", "mariadb"))
self.cpp_info.libs = collect_libs(self)
if self.settings.os in ["Linux", "FreeBSD", "Macos"]:
self.cpp_info.system_libs = ["m", "resolv"]
plugin_dir = os.path.join(self.package_folder, "lib", "plugin").replace("\\", "/")
self.runenv_info.prepend_path("MARIADB_PLUGIN_DIR", plugin_dir)
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e563c7e..babb3cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -466,11 +466,13 @@ IF(NOT USE_SYSTEM_INSTALLED_LIB)
FOREACH(CC_PLUGIN ${PLUGINS_LIST})
IF(NOT PLUGINS_DYNAMIC OR "${PLUGIN_${CC_PLUGIN}_TYPE}" STREQUAL "MARIADB_CLIENT_PLUGIN_AUTH")
MESSAGE(STATUS "Configuring to install ${CC_PLUGIN} to ${INSTALL_PLUGINDIR}")
+ IF(BUILD_SHARED_LIBS)
ADD_DEPENDENCIES(DEPENDENCIES_FOR_PACKAGE ${CC_PLUGIN})
INSTALL(FILES
$<TARGET_FILE:${CC_PLUGIN}>
DESTINATION ${INSTALL_PLUGINDIR}
COMPONENT ConCPlugins)
+ ENDIF()
ENDIF()
ENDFOREACH()
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libmariadb/include)
@@ -566,15 +568,16 @@ ENDIF()
SET(${LIBRARY_NAME}_OBJECTS $<TARGET_OBJECTS:${LIBRARY_NAME}_obj>)

IF(WIN32 AND NOT MINGW)
+IF(BUILD_SHARED_LIBS)
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${CMAKE_SOURCE_DIR}/src/maconncpp.rc ${${LIBRARY_NAME}_OBJECTS} ${CMAKE_SOURCE_DIR}/src/maconncpp.def)
- ADD_LIBRARY(${STATIC_LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_OBJECTS} ${CMAKE_SOURCE_DIR}/src/maconncpp.rc)
-
TARGET_COMPILE_DEFINITIONS(${LIBRARY_NAME}_obj PRIVATE "MARIADB_EXPORTED=__declspec(dllexport)")
-
TARGET_COMPILE_DEFINITIONS(${LIBRARY_NAME} PRIVATE "MARIADB_EXPORTED=__declspec(dllexport)")
TARGET_COMPILE_DEFINITIONS(${LIBRARY_NAME} INTERFACE "MARIADB_EXPORTED=__declspec(dllimport)")
-
+ELSE()
+ ADD_LIBRARY(${STATIC_LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_OBJECTS} ${CMAKE_SOURCE_DIR}/src/maconncpp.rc)
TARGET_COMPILE_DEFINITIONS(${STATIC_LIBRARY_NAME} PUBLIC MARIADB_STATIC_LINK)
+ENDIF()
+
ELSE()
# Xcode doesn't support targets that have only object files,
# so let's add an empty file to keep Xcode happy
@@ -583,36 +586,51 @@ ELSE()
SET(EMPTY_FILE ${CMAKE_BINARY_DIR}/empty.cpp)
ENDIF()
# MESSAGE(STATUS "Version script: ${CMAKE_SOURCE_DIR}/src/maconncpp.def")
+IF(BUILD_SHARED_LIBS)
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${${LIBRARY_NAME}_OBJECTS} ${EMPTY_FILE})
+ELSE()
ADD_LIBRARY(${STATIC_LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_OBJECTS} ${EMPTY_FILE})
+ENDIF()

IF(APPLE)
+ IF(BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-Wl"
INSTALL_RPATH_USE_LINK_PATH 0
BUILD_WITH_INSTALL_RPATH 1
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES
XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--timestamp -f"
INSTALL_RPATH "${MAODBC_INSTALL_RPATH}")
+ ELSE()
SET_TARGET_PROPERTIES(${STATIC_LIBRARY_NAME} PROPERTIES
INSTALL_RPATH_USE_LINK_PATH 0
BUILD_WITH_INSTALL_RPATH 1
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES
XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--timestamp -f"
INSTALL_RPATH "${MAODBC_INSTALL_RPATH}")
+ ENDIF()
IF(WITH_SIGNCODE)
+ IF(BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Developer ID Application: ${DEVELOPER_ID}")
+ ELSE()
SET_TARGET_PROPERTIES(${STATIC_LIBRARY_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Developer ID Application: ${DEVELOPER_ID}")
+ ENDIF()
ELSE()
+ IF(BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+ ELSE()
SET_TARGET_PROPERTIES(${STATIC_LIBRARY_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+ ENDIF()
ENDIF()
ELSE()
# SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/maconncpp.def")
ENDIF()
ENDIF()

+IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${MARIADB_CLIENT_TARGET_NAME} ${PLATFORM_DEPENDENCIES})
+ELSE()
TARGET_LINK_LIBRARIES(${STATIC_LIBRARY_NAME} mariadbclient)
+ENDIF()

# MINGW Specific includes and linking
IF(MINGW)
@@ -634,8 +652,11 @@ IF(MINGW)
ENDIF()

IF(MARIADB_CONNECTORC_LIB)
+ IF(BUILD_SHARED_LIBS)
TARGET_LINK_DIRECTORIES(${LIBRARY_NAME} PUBLIC ${MARIADB_CONNECTORC_LIB})
+ ELSE()
TARGET_LINK_DIRECTORIES(${STATIC_LIBRARY_NAME} PUBLIC ${MARIADB_CONNECTORC_LIB})
+ ENDIF()
MESSAGE(STATUS "Found MariaDB Connector/C libraries - ${MARIADB_CONNECTORC_LIB}")
ELSE()
MESSAGE(WARNING "Did not find MariaDB Connector/C libraries")
@@ -643,10 +664,15 @@ IF(MINGW)

ENDIF()

+IF(NOT BUILD_SHARED_LIBS)
INCLUDE(symlink)
CREATE_SYMLINK(lib${LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} ${STATIC_LIBRARY_NAME} ${INSTALL_LIBDIR})
+ENDIF()

+IF(BUILD_SHARED_LIBS)
ADD_DEPENDENCIES(${LIBRARY_NAME} DEPENDENCIES_FOR_PACKAGE)
+ENDIF()
+

########## Packaging ##########

@@ -668,14 +694,18 @@ ELSE()
#MESSAGE(STATUS "Configuring to generate PKG package")
#ADD_SUBDIRECTORY(osxinstall)
ENDIF()
+
+ IF(BUILD_SHARED_LIBS)
INSTALL(TARGETS
${LIBRARY_NAME}
LIBRARY DESTINATION ${INSTALL_LIBDIR}
COMPONENT SharedLibraries)
+ ELSE()
INSTALL(TARGETS
${STATIC_LIBRARY_NAME}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
COMPONENT Development)
+ ENDIF()

MESSAGE(STATUS "Documentation installed to ${INSTALL_DOCDIR}")
MESSAGE(STATUS "License file installed to ${INSTALL_LICENSEDIR}")
Loading
Loading