-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mysql-connector-cpp] Revise, add test port
- Loading branch information
Showing
19 changed files
with
427 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#[[ | ||
vcpkg overloads find_package(). | ||
mysql-connector-cpp overloads find_dependency(). | ||
To force a strict order of desired effects and to prevent undesired effects, | ||
without heavy patching: | ||
1. All pristine find_package() must be done here first. | ||
This is with pristine vcpkg toolchain find_package()/find_dependency(). | ||
2. After that, find_package is overloaded to prevent loading of CMakeFindDependenyMacro. | ||
3. mysql-connector-cpp installs and uses its custom find_dependency(). | ||
#]] | ||
|
||
set(THREADS_PREFER_PTHREAD_FLAG 1) | ||
find_package(Threads) | ||
|
||
find_package(OpenSSL REQUIRED) | ||
|
||
find_package(Protobuf CONFIG REQUIRED) | ||
#add_library(ext::protobuf ALIAS protobuf::libprotobuf) | ||
add_library(ext::protobuf-lite ALIAS protobuf::libprotobuf-lite) | ||
if(NOT TARGET ext::protoc) | ||
add_executable(ext::protoc IMPORTED) | ||
set_target_properties(ext::protoc PROPERTIES IMPORTED_LOCATION "${WITH_PROTOC}") | ||
endif() | ||
|
||
find_package(RapidJSON CONFIG REQUIRED) | ||
add_library(RapidJSON::rapidjson ALIAS rapidjson) | ||
|
||
find_package(ZLIB REQUIRED) | ||
add_library(ext::z ALIAS ZLIB::ZLIB) | ||
|
||
find_package(lz4 REQUIRED) | ||
add_library(ext::lz4 ALIAS lz4::lz4) | ||
|
||
find_package(zstd REQUIRED) | ||
add_library(ext::zstd ALIAS zstd::libzstd) | ||
|
||
if(WITH_JDBC) | ||
find_package(unofficial-libmysql REQUIRED) | ||
find_path(errmsg_include_dir NAMES errmsg.h PATH_SUFFIXES mysql) | ||
set_property(TARGET unofficial::libmysql::libmysql APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${errmsg_include_dir}") | ||
add_library(MySQL::client ALIAS unofficial::libmysql::libmysql) | ||
|
||
file(READ "${errmsg_include_dir}/mysql_version.h" version_h) | ||
if(NOT version_h MATCHES "#define +MYSQL_SERVER_VERSION +\"([^\"]+)\"") | ||
message(FATAL_ERROR "Failed to detect libmysql version") | ||
endif() | ||
set(MYSQL_VERSION "${CMAKE_MATCH_1}") | ||
if(NOT version_h MATCHES "#define +MYSQL_VERSION_ID +([0-9]+)") | ||
message(FATAL_ERROR "Failed to detect libmysql version ID") | ||
endif() | ||
set(MYSQL_NUM_VERSION "${CMAKE_MATCH_1}") | ||
endif() | ||
|
||
set(known_packages Threads OpenSSL Protobuf RapidJSON ZLIB lz4 zstd unofficial-libmysql) | ||
cmake_policy(SET CMP0057 NEW) | ||
macro(find_package NAME) | ||
if(NOT "${NAME}" IN_LIST known_packages) | ||
message(SEND_ERROR "find_package(${NAME}) not handled in ${CMAKE_CURRENT_LIST_FILE}") | ||
endif() | ||
endmacro() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/cdk/cmake/DepFindProtobuf.cmake b/cdk/cmake/DepFindProtobuf.cmake | ||
index 1fc785e..d9eaecc 100644 | ||
--- a/cdk/cmake/DepFindProtobuf.cmake | ||
+++ b/cdk/cmake/DepFindProtobuf.cmake | ||
@@ -45,8 +45,6 @@ | ||
# | ||
|
||
if(TARGET ext::protobuf) | ||
- return() | ||
-endif() | ||
|
||
message(STATUS "Setting up Protobuf.") | ||
|
||
@@ -65,6 +63,10 @@ add_ext_targets(protobuf | ||
EXECUTABLE protoc pb_protoc | ||
) | ||
|
||
+endif() | ||
+if(COMMAND mysqlx_protobuf_generate_cpp) | ||
+ return() | ||
+endif() | ||
|
||
# Standard PROTOBUF_GENERATE_CPP modified to our usage | ||
function(mysqlx_protobuf_generate_cpp SRCS HDRS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/jdbc/extra/otel/CMakeLists.txt b/jdbc/extra/otel/CMakeLists.txt | ||
index bbed9bd..d03e2ef 100644 | ||
--- a/jdbc/extra/otel/CMakeLists.txt | ||
+++ b/jdbc/extra/otel/CMakeLists.txt | ||
@@ -9,7 +9,9 @@ if(NOT (WIN32 OR APPLE OR CMAKE_SYSTEM_NAME MATCHES "SunOS")) | ||
message(STATUS "Adding OTel support") | ||
|
||
set(TELEMETRY ON CACHE INTERNAL "Whether connector is built with OTel support") | ||
+endif() | ||
|
||
+if(TELEMETRY) | ||
target_include_directories(otel_api INTERFACE | ||
"${PROJECT_SOURCE_DIR}/extra/otel/${OPENTELEMETRY_CPP_TAG}/api/include" | ||
) |
Oops, something went wrong.