mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-13 20:28:26 +08:00
[mysql-connector-cpp] Revise, add test port (#42586)
This commit is contained in:
parent
8d0005f837
commit
96b5ced828
61
ports/mysql-connector-cpp/cmake-project-include.cmake
Normal file
61
ports/mysql-connector-cpp/cmake-project-include.cmake
Normal file
@ -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()
|
@ -1,167 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f24eb57..ec7c53d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -469,7 +469,7 @@ endif()
|
||||
# system-wide). Here we arrange for the OpenSSL DLLs to be copied to the build
|
||||
# location of the connector library after building it.
|
||||
|
||||
-if(WIN32 AND OPENSSL_LIB_DIR)
|
||||
+if(WIN32 AND OPENSSL_LIB_DIR AND 0)
|
||||
|
||||
# Note: For simplicity we just copy any DLLs we can find at the given
|
||||
# OpenSSL location.
|
||||
diff --git a/cdk/cmake/DepFindCompression.cmake b/cdk/cmake/DepFindCompression.cmake
|
||||
index 68f8e10..ebe7e31 100644
|
||||
--- a/cdk/cmake/DepFindCompression.cmake
|
||||
+++ b/cdk/cmake/DepFindCompression.cmake
|
||||
@@ -48,7 +48,12 @@ message(STATUS "Setting up compression libraries.")
|
||||
#######
|
||||
# ZLIB
|
||||
#
|
||||
-add_ext(zlib zlib.h z ext_zlib)
|
||||
+if (WIN32)
|
||||
+ set(ZLIB_NAME zlib)
|
||||
+else()
|
||||
+ set(ZLIB_NAME z)
|
||||
+endif()
|
||||
+add_ext(zlib zlib.h ${ZLIB_NAME} ext_zlib)
|
||||
if(NOT ZLIB_FOUND)
|
||||
message(FATAL_ERROR "Can't build without zlib support")
|
||||
endif()
|
||||
diff --git a/cdk/cmake/dependency.cmake b/cdk/cmake/dependency.cmake
|
||||
index 8370d81..a111219 100644
|
||||
--- a/cdk/cmake/dependency.cmake
|
||||
+++ b/cdk/cmake/dependency.cmake
|
||||
@@ -497,10 +497,18 @@ endfunction(add_ext_targets)
|
||||
function(add_ext_lib EXT target name)
|
||||
# Search for the library
|
||||
if(DEFINED ${EXT}_ROOT_DIR)
|
||||
- set(suffix PATHS ${${EXT}_ROOT_DIR}
|
||||
- PATH_SUFFIXES lib lib64 dll
|
||||
- NO_DEFAULT_PATH
|
||||
- )
|
||||
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
+ set(name "${name}d;${name}")
|
||||
+ set(suffix PATHS "${${EXT}_ROOT_DIR}/debug"
|
||||
+ PATH_SUFFIXES lib lib64 dll
|
||||
+ NO_DEFAULT_PATH
|
||||
+ )
|
||||
+ else()
|
||||
+ set(suffix PATHS ${${EXT}_ROOT_DIR}
|
||||
+ PATH_SUFFIXES lib lib64 dll
|
||||
+ NO_DEFAULT_PATH
|
||||
+ )
|
||||
+ endif()
|
||||
elseif(DEFINED ${EXT}_LIB_DIR)
|
||||
set(suffix
|
||||
PATHS ${${EXT}_LIB_DIR}
|
||||
@@ -542,9 +550,10 @@ endfunction(add_ext_lib)
|
||||
|
||||
function(add_ext_exec EXT target name)
|
||||
# Search for the library
|
||||
+ string(TOLOWER ${EXT} EXT_LOWER)
|
||||
if(DEFINED ${EXT}_ROOT_DIR)
|
||||
set(suffix PATHS ${${EXT}_ROOT_DIR}
|
||||
- PATH_SUFFIXES bin
|
||||
+ PATH_SUFFIXES tools/${EXT_LOWER}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
diff --git a/cdk/protocol/mysqlx/CMakeLists.txt b/cdk/protocol/mysqlx/CMakeLists.txt
|
||||
index a987312..666b3a2 100644
|
||||
--- a/cdk/protocol/mysqlx/CMakeLists.txt
|
||||
+++ b/cdk/protocol/mysqlx/CMakeLists.txt
|
||||
@@ -135,8 +135,13 @@ else()
|
||||
target_link_libraries(cdk_proto_mysqlx PRIVATE ext::protobuf-lite)
|
||||
endif()
|
||||
|
||||
+if (WIN32)
|
||||
+ set(EXT_ZLIB_NAME ext::zlib)
|
||||
+else()
|
||||
+ set(EXT_ZLIB_NAME ext::z)
|
||||
+endif()
|
||||
target_link_libraries(cdk_proto_mysqlx
|
||||
- PRIVATE cdk_foundation ext::z ext::lz4 ext::zstd
|
||||
+ PRIVATE cdk_foundation ${EXT_ZLIB_NAME} ext::lz4 ext::zstd
|
||||
)
|
||||
|
||||
ADD_COVERAGE(cdk_proto_mysqlx)
|
||||
diff --git a/jdbc/cmake/DepFindMySQL.cmake b/jdbc/cmake/DepFindMySQL.cmake
|
||||
index 971bfd5..0639b79 100644
|
||||
--- a/jdbc/cmake/DepFindMySQL.cmake
|
||||
+++ b/jdbc/cmake/DepFindMySQL.cmake
|
||||
@@ -167,13 +167,13 @@ function(main)
|
||||
|
||||
find_library(MYSQL_LIB
|
||||
NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
- PATHS ${MYSQL_LIB_DIR}
|
||||
+ PATHS "${MYSQL_LIB_DIR}/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(MYSQL_LIB_DEBUG
|
||||
NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
- PATHS "${MYSQL_LIB_DIR}/debug"
|
||||
+ PATHS "${MYSQL_LIB_DIR}/debug/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
@@ -181,39 +181,39 @@ function(main)
|
||||
|
||||
find_library(MYSQL_DLL
|
||||
NAMES ${CMAKE_DYNAMIC_LIBRARY_PREFIX}mysqlclient${CMAKE_DYNAMIC_LIBRARY_SUFFIX}
|
||||
- PATHS ${MYSQL_LIB_DIR}
|
||||
+ PATHS "${MYSQL_LIB_DIR}/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(MYSQL_DLL_DEBUG
|
||||
NAMES ${CMAKE_DYNAMIC_LIBRARY_PREFIX}mysqlclient${CMAKE_DYNAMIC_LIBRARY_SUFFIX}
|
||||
- PATHS "${MYSQL_LIB_DIR}/debug"
|
||||
+ PATHS "${MYSQL_LIB_DIR}/debug/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
else() #WIN32
|
||||
|
||||
- find_library(MYSQL_DLL
|
||||
- NAMES libmysql
|
||||
- PATHS ${MYSQL_LIB_DIR}
|
||||
+ find_file(MYSQL_DLL
|
||||
+ NAMES libmysql.dll
|
||||
+ PATHS "${MYSQL_LIB_DIR}/bin"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
- find_library(MYSQL_DLL_DEBUG
|
||||
- NAMES libmysql
|
||||
- PATHS "${MYSQL_LIB_DIR}/debug"
|
||||
+ find_file(MYSQL_DLL_DEBUG
|
||||
+ NAMES libmysql.dll
|
||||
+ PATHS "${MYSQL_LIB_DIR}/debug/bin"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(MYSQL_DLL_IMP
|
||||
NAMES libmysql.lib
|
||||
- PATHS ${MYSQL_LIB_DIR}
|
||||
+ PATHS "${MYSQL_LIB_DIR}/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
find_library(MYSQL_DLL_IMP_DEBUG
|
||||
NAMES libmysql.lib
|
||||
- PATHS "${MYSQL_LIB_DIR}/debug"
|
||||
+ PATHS "${MYSQL_LIB_DIR}/debug/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
endif()
|
||||
@@ -383,6 +383,7 @@ function(main)
|
||||
# external dependencies.
|
||||
#
|
||||
|
||||
+ find_package(OpenSSL)
|
||||
target_link_libraries(MySQL::client-static INTERFACE ${MYSQL_EXTERNAL_DEPENDENCIES})
|
||||
|
||||
endif()
|
24
ports/mysql-connector-cpp/depfindprotobuf.diff
Normal file
24
ports/mysql-connector-cpp/depfindprotobuf.diff
Normal file
@ -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)
|
14
ports/mysql-connector-cpp/disable-telemetry.diff
Normal file
14
ports/mysql-connector-cpp/disable-telemetry.diff
Normal file
@ -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"
|
||||
)
|
20
ports/mysql-connector-cpp/dont-preload-cache.diff
Normal file
20
ports/mysql-connector-cpp/dont-preload-cache.diff
Normal file
@ -0,0 +1,20 @@
|
||||
diff --git a/cdk/cmake/bootstrap.cmake b/cdk/cmake/bootstrap.cmake
|
||||
index dd597dd..3d9a41f 100644
|
||||
--- a/cdk/cmake/bootstrap.cmake
|
||||
+++ b/cdk/cmake/bootstrap.cmake
|
||||
@@ -93,14 +93,7 @@ function(bootstrap)
|
||||
|
||||
message("-- ----")
|
||||
|
||||
- execute_process(
|
||||
- COMMAND ${CMAKE_COMMAND}
|
||||
- -G ${CMAKE_GENERATOR}
|
||||
- ${cmake_opts}
|
||||
- ${src_dir}
|
||||
- WORKING_DIRECTORY ${bin_dir}
|
||||
- RESULT_VARIABLE res
|
||||
- )
|
||||
+ set(res "Cache breaks vcpkg toolchain")
|
||||
|
||||
#message(FATAL_ERROR "!!! STOP")
|
||||
|
@ -1,60 +1,60 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 341ed2d..6afa198 100644
|
||||
index 341ed2d..686b859 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -416,12 +416,7 @@ add_version_info(connector
|
||||
"Implements MySQL Connector/C++ XDevAPI."
|
||||
@@ -356,9 +356,11 @@ if(WITH_JDBC)
|
||||
# we use a copy of them placed inside the build tree.
|
||||
|
||||
target_include_directories(connector-jdbc
|
||||
- PUBLIC "${PROJECT_BINARY_DIR}/include/jdbc"
|
||||
- PUBLIC "${PROJECT_BINARY_DIR}/include/jdbc/cppconn"
|
||||
- PUBLIC "${PROJECT_SOURCE_DIR}/include"
|
||||
+ PUBLIC
|
||||
+ "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/jdbc>"
|
||||
+ "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/jdbc/cppconn>"
|
||||
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
+ "$<INSTALL_INTERFACE:include>"
|
||||
)
|
||||
|
||||
endif()
|
||||
@@ -417,7 +419,8 @@ add_version_info(connector
|
||||
)
|
||||
|
||||
-target_include_directories(connector PUBLIC
|
||||
target_include_directories(connector PUBLIC
|
||||
- "${PROJECT_SOURCE_DIR}/include"
|
||||
- # Note: This is needed when using connector directly from the build tree to
|
||||
- # find headers generated by the build process.
|
||||
- $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/mysqlx>
|
||||
-)
|
||||
+target_include_directories(connector PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
|
||||
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
+ $<INSTALL_INTERFACE:include>
|
||||
# Note: This is needed when using connector directly from the build tree to
|
||||
# find headers generated by the build process.
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/mysqlx>
|
||||
@@ -537,23 +540,18 @@ set_target_properties(connector PROPERTIES
|
||||
|
||||
|
||||
#
|
||||
@@ -536,31 +531,22 @@ set_target_properties(connector PROPERTIES
|
||||
install(TARGETS connector
|
||||
- CONFIGURATIONS Release RelWithDebInfo
|
||||
+ EXPORT unofficial-mysql-connector-cpp-targets
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC}" COMPONENT XDevAPIDev
|
||||
- RUNTIME DESTINATION "${INSTALL_LIB_DIR}" COMPONENT XDevAPIDll
|
||||
+ RUNTIME DESTINATION "bin" COMPONENT XDevAPIDll
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT XDevAPIDll
|
||||
)
|
||||
|
||||
|
||||
-install(TARGETS connector
|
||||
- CONFIGURATIONS Release RelWithDebInfo
|
||||
- ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC}" COMPONENT XDevAPIDev
|
||||
- RUNTIME DESTINATION "${INSTALL_LIB_DIR}" COMPONENT XDevAPIDll
|
||||
- LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT XDevAPIDll
|
||||
-)
|
||||
-
|
||||
-install(TARGETS connector
|
||||
- CONFIGURATIONS Debug
|
||||
- ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC_DEBUG}" COMPONENT XDevAPIDev
|
||||
- RUNTIME DESTINATION "${INSTALL_LIB_DIR_DEBUG}" COMPONENT XDevAPIDll
|
||||
- LIBRARY DESTINATION "${INSTALL_LIB_DIR_DEBUG}" COMPONENT XDevAPIDll
|
||||
-)
|
||||
+install(TARGETS connector EXPORT unofficial-mysql-connector-cpp-targets
|
||||
+ ARCHIVE DESTINATION lib COMPONENT XDevAPIDev
|
||||
+ RUNTIME DESTINATION bin COMPONENT XDevAPIDll
|
||||
+ LIBRARY DESTINATION lib COMPONENT XDevAPIDll)
|
||||
|
||||
if(MSVC AND NOT BUILD_STATIC)
|
||||
|
||||
install(FILES $<TARGET_PDB_FILE:connector>
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
- DESTINATION "${INSTALL_LIB_DIR}"
|
||||
+ DESTINATION bin
|
||||
+ Release
|
||||
DESTINATION "${INSTALL_LIB_DIR}"
|
||||
COMPONENT Debuginfo
|
||||
)
|
||||
|
||||
install(FILES $<TARGET_PDB_FILE:connector>
|
||||
CONFIGURATIONS Debug
|
||||
- DESTINATION "${INSTALL_LIB_DIR_DEBUG}"
|
||||
+ DESTINATION bin
|
||||
COMPONENT Debuginfo
|
||||
)
|
||||
|
||||
@@ -667,3 +653,15 @@ endif()
|
||||
@@ -667,3 +665,15 @@ endif()
|
||||
|
||||
|
||||
show_config_options()
|
||||
@ -70,4 +70,51 @@ index 341ed2d..6afa198 100644
|
||||
+ NAMESPACE unofficial::mysql-connector-cpp::
|
||||
+ DESTINATION share/unofficial-mysql-connector-cpp
|
||||
+)
|
||||
\ No newline at end of file
|
||||
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
|
||||
index 159145f..4d4f7fe 100644
|
||||
--- a/cmake/libutils.cmake
|
||||
+++ b/cmake/libutils.cmake
|
||||
@@ -164,7 +164,11 @@ function(merge_libraries TARGET)
|
||||
set_property(SOURCE "${LIBUTILS_SCRIPT_DIR}/empty.cc" PROPERTY LANGUAGE CXX)
|
||||
|
||||
add_library(${TARGET} ${TYPE} "${LIBUTILS_SCRIPT_DIR}/empty.cc")
|
||||
+ if(TYPE STREQUAL "SHARED")
|
||||
target_link_libraries(${TARGET} PRIVATE ${ARGN})
|
||||
+ else() # merged into whole archive
|
||||
+ add_dependencies(${TARGET} ${ARGN})
|
||||
+ endif()
|
||||
|
||||
#
|
||||
# Arrange for marge_archives.cmake script to be executed in a POST_BUILD
|
||||
diff --git a/jdbc/CMakeLists.txt b/jdbc/CMakeLists.txt
|
||||
index 60e36e4..7117213 100644
|
||||
--- a/jdbc/CMakeLists.txt
|
||||
+++ b/jdbc/CMakeLists.txt
|
||||
@@ -341,24 +341,19 @@ endif()
|
||||
|
||||
|
||||
install(TARGETS connector-jdbc
|
||||
- CONFIGURATIONS Release RelWithDebInfo
|
||||
+ EXPORT unofficial-mysql-connector-cpp-targets
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC}" COMPONENT JDBCDev
|
||||
- RUNTIME DESTINATION "${INSTALL_LIB_DIR}" COMPONENT JDBCDll
|
||||
+ RUNTIME DESTINATION "bin" COMPONENT JDBCDll
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT JDBCDll
|
||||
)
|
||||
|
||||
-install(TARGETS connector-jdbc
|
||||
- CONFIGURATIONS Debug
|
||||
- ARCHIVE DESTINATION "${INSTALL_LIB_DIR_STATIC_DEBUG}" COMPONENT JDBCDev
|
||||
- RUNTIME DESTINATION "${INSTALL_LIB_DIR_DEBUG}" COMPONENT JDBCDll
|
||||
- LIBRARY DESTINATION "${INSTALL_LIB_DIR_DEBUG}" COMPONENT JDBCDll
|
||||
-)
|
||||
|
||||
|
||||
if(MSVC AND NOT BUILD_STATIC)
|
||||
|
||||
install(FILES $<TARGET_PDB_FILE:connector-jdbc>
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
+ Release
|
||||
DESTINATION "${INSTALL_LIB_DIR}"
|
||||
COMPONENT Debuginfo
|
||||
)
|
||||
|
@ -1,96 +0,0 @@
|
||||
diff --git a/cdk/cmake/dependency.cmake b/cdk/cmake/dependency.cmake
|
||||
index e3fec4e..8370d81 100644
|
||||
--- a/cdk/cmake/dependency.cmake
|
||||
+++ b/cdk/cmake/dependency.cmake
|
||||
@@ -59,6 +59,7 @@ set(EXT_FWD
|
||||
CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION
|
||||
CMAKE_SYSTEM_PROCESSOR
|
||||
CMAKE_C_COMPILER CMAKE_CXX_COMPILER
|
||||
+ BUILD_SHARED_LIBS STATIC_MSVCRT BUILD_STATIC
|
||||
MSVC
|
||||
)
|
||||
|
||||
@@ -304,7 +305,7 @@ function(add_ext_build_targets NAME)
|
||||
endif()
|
||||
|
||||
foreach(var ${EXT_FWD})
|
||||
- if(${var})
|
||||
+ if(DEFINED ${var})
|
||||
message("-- option ${var}: ${${var}}")
|
||||
list(APPEND cmake_opts -D${var}=${${var}})
|
||||
endif()
|
||||
diff --git a/cdk/extra/lz4/CMakeLists.txt b/cdk/extra/lz4/CMakeLists.txt
|
||||
index 7e5db85..9375fcd 100644
|
||||
--- a/cdk/extra/lz4/CMakeLists.txt
|
||||
+++ b/cdk/extra/lz4/CMakeLists.txt
|
||||
@@ -34,6 +34,10 @@ include(platform)
|
||||
|
||||
enable_pic()
|
||||
|
||||
+if (MSVC AND STATIC_MSVCRT)
|
||||
+ message("lz4 using static runtime library")
|
||||
+ set_msvcrt(STATIC)
|
||||
+endif (MSVC AND STATIC_MSVCRT)
|
||||
add_library(lz4 STATIC
|
||||
lib/lz4.c
|
||||
lib/lz4frame.c
|
||||
diff --git a/cdk/extra/zlib/CMakeLists.txt b/cdk/extra/zlib/CMakeLists.txt
|
||||
index b3ebd21..fc93b70 100644
|
||||
--- a/cdk/extra/zlib/CMakeLists.txt
|
||||
+++ b/cdk/extra/zlib/CMakeLists.txt
|
||||
@@ -150,6 +150,10 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
|
||||
|
||||
add_compile_options(-fPIC)
|
||||
|
||||
+if (MSVC AND STATIC_MSVCRT)
|
||||
+ message("zlib using static runtime library")
|
||||
+ set_msvcrt(STATIC)
|
||||
+endif (MSVC AND STATIC_MSVCRT)
|
||||
add_library(zlib STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
|
||||
target_include_directories(zlib PUBLIC
|
||||
diff --git a/cdk/extra/zstd/CMakeLists.txt b/cdk/extra/zstd/CMakeLists.txt
|
||||
index 0ed58f6..9f6f1d2 100644
|
||||
--- a/cdk/extra/zstd/CMakeLists.txt
|
||||
+++ b/cdk/extra/zstd/CMakeLists.txt
|
||||
@@ -63,6 +63,10 @@ IF((LINUX OR APPLE) AND NOT ARM_CPU)
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
+if (MSVC AND STATIC_MSVCRT)
|
||||
+ message("zstd using static runtime library")
|
||||
+ set_msvcrt(STATIC)
|
||||
+endif (MSVC AND STATIC_MSVCRT)
|
||||
ADD_LIBRARY(zstd STATIC ${ZSTD_SRCS})
|
||||
set_target_properties(zstd PROPERTIES FOLDER "Misc")
|
||||
|
||||
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
|
||||
index 848b7cf..a122044 100644
|
||||
--- a/cmake/libutils.cmake
|
||||
+++ b/cmake/libutils.cmake
|
||||
@@ -164,7 +164,11 @@ function(merge_libraries TARGET)
|
||||
set_property(SOURCE "${LIBUTILS_SCRIPT_DIR}/empty.cc" PROPERTY LANGUAGE CXX)
|
||||
|
||||
add_library(${TARGET} ${TYPE} "${LIBUTILS_SCRIPT_DIR}/empty.cc")
|
||||
- target_link_libraries(${TARGET} PRIVATE ${ARGN})
|
||||
+ if(TYPE STREQUAL "SHARED")
|
||||
+ target_link_libraries(${TARGET} PRIVATE ${ARGN})
|
||||
+ else()
|
||||
+ add_dependencies(${TARGET} ${ARGN})
|
||||
+ endif()
|
||||
|
||||
#
|
||||
# Arrange for marge_archives.cmake script to be executed in a POST_BUILD
|
||||
diff --git a/install_layout.cmake b/install_layout.cmake
|
||||
index 4a8a511..ee091da 100644
|
||||
--- a/install_layout.cmake
|
||||
+++ b/install_layout.cmake
|
||||
@@ -219,7 +219,7 @@ set(LIB_NAME_BASE "mysqlcppconnx")
|
||||
set(LIB_NAME_STATIC "${LIB_NAME_BASE}-static")
|
||||
|
||||
if(WIN32 AND STATIC_MSVCRT)
|
||||
- set(LIB_NAME_STATIC "${LIB_NAME}-mt")
|
||||
+ set(LIB_NAME_STATIC "${LIB_NAME_STATIC}-mt")
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC)
|
25
ports/mysql-connector-cpp/merge-archives.diff
Normal file
25
ports/mysql-connector-cpp/merge-archives.diff
Normal file
@ -0,0 +1,25 @@
|
||||
diff --git a/cmake/libutils/merge_archives.cmake.in b/cmake/libutils/merge_archives.cmake.in
|
||||
index 33094a6..5b256c6 100644
|
||||
--- a/cmake/libutils/merge_archives.cmake.in
|
||||
+++ b/cmake/libutils/merge_archives.cmake.in
|
||||
@@ -299,7 +299,7 @@ function(merge_libraries_gcc)
|
||||
|
||||
get_filename_component(name "${lib}" NAME_WE)
|
||||
# Make sure path is absolute
|
||||
- get_filename_component(lib "${lib}" ABSOLUTE)
|
||||
+ get_filename_component(lib "${lib}" ABSOLUTE BASE_DIR "@PROJECT_BINARY_DIR@")
|
||||
|
||||
#message("-- processing lib: ${name} (${lib})")
|
||||
|
||||
@@ -564,6 +564,11 @@ function(process_deps)
|
||||
# ninja, for example.
|
||||
|
||||
get_filename_component(libpath "${lib}" ABSOLUTE BASE_DIR "${BUILD_DIR}")
|
||||
+ string(FIND "${libpath}/" "@PROJECT_BINARY_DIR@/" index)
|
||||
+ if(NOT index STREQUAL "0")
|
||||
+ message( "! Omitting ${lib}")
|
||||
+ continue()
|
||||
+ endif()
|
||||
|
||||
if(
|
||||
lib MATCHES "${libext}$"
|
17
ports/mysql-connector-cpp/mysql-concpp-config.cmake
Normal file
17
ports/mysql-connector-cpp/mysql-concpp-config.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
# Partial reimplementation of official interface
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(unofficial-mysql-connector-cpp)
|
||||
set(suffix "")
|
||||
if("@BUILD_STATIC@")
|
||||
set(suffix "-static")
|
||||
endif()
|
||||
if(NOT TARGET mysql::concpp-xdevapi${suffix})
|
||||
add_library(mysql::concpp${suffix} ALIAS unofficial::mysql-connector-cpp::connector)
|
||||
add_library(mysql::concpp-xdevapi${suffix} ALIAS unofficial::mysql-connector-cpp::connector)
|
||||
if(TARGET unofficial::mysql-connector-cpp::connector-jdbc)
|
||||
add_library(mysql::concpp-jdbc${suffix} ALIAS unofficial::mysql-connector-cpp::connector-jdbc)
|
||||
endif()
|
||||
endif()
|
||||
set(MYSQL_CONCPP_FOUND 1)
|
||||
set(MYSQL_CONCPP_VERSION "@VERSION@")
|
||||
set(mysql-concpp_VERSION "@VERSION@")
|
@ -1,9 +1,48 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(OpenSSL)
|
||||
find_dependency(Protobuf CONFIG)
|
||||
if(NOT "@BUILD_SHARED_LIBS@")
|
||||
find_dependency(Threads)
|
||||
find_dependency(OpenSSL)
|
||||
find_dependency(RapidJSON CONFIG)
|
||||
find_dependency(ZLIB)
|
||||
find_dependency(lz4)
|
||||
find_dependency(zstd)
|
||||
if("@WITH_JDBC@")
|
||||
find_dependency(unofficial-libmysql)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-mysql-connector-cpp-targets.cmake")
|
||||
|
||||
if(NOT UNOFFICIAL_MYSQL_CONNECTOR_CPP_INITIALIZED)
|
||||
if(NOT "@BUILD_SHARED_LIBS@")
|
||||
set_target_properties(unofficial::mysql-connector-cpp::connector PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "$<LINK_ONLY:Threads::Threads>;$<LINK_ONLY:OpenSSL::SSL>;$<LINK_ONLY:rapidjson>;$<LINK_ONLY:ZLIB::ZLIB>;$<LINK_ONLY:>;$<LINK_ONLY:lz4::lz4>;$<LINK_ONLY:zstd::libzstd>"
|
||||
)
|
||||
# Cf. mysql-concpp-config.cmake.in
|
||||
if(WIN32)
|
||||
set_property(TARGET unofficial::mysql-connector-cpp::connector APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dnsapi")
|
||||
elseif(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set_property(TARGET unofficial::mysql-connector-cpp::connector APPEND PROPERTY INTERFACE_LINK_LIBRARIES "resolv;dl")
|
||||
endif()
|
||||
if("@WITH_JDBC@")
|
||||
set_target_properties(unofficial::mysql-connector-cpp::connector-jdbc PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "$<LINK_ONLY:unofficial::libmysql::libmysql>"
|
||||
)
|
||||
# Cf. jdbc/driver/CMakeLists.txt
|
||||
if(WIN32)
|
||||
set_property(TARGET unofficial::mysql-connector-cpp::connector-jdbc APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dnsapi")
|
||||
elseif(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set_property(TARGET unofficial::mysql-connector-cpp::connector-jdbc APPEND PROPERTY INTERFACE_LINK_LIBRARIES "resolv;dl")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set_property(TARGET unofficial::mysql-connector-cpp::connector APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "$<LINK_ONLY:protobuf::libprotobuf-lite>"
|
||||
)
|
||||
set(UNOFFICIAL_MYSQL_CONNECTOR_CPP_INITIALIZED 1 CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
check_required_components(mysql-connector-cpp)
|
||||
|
@ -5,23 +5,39 @@ vcpkg_from_github(
|
||||
SHA512 aa432822d4c9d7f1328bf59e261c362570f6b2237a5a9f730f96f079aba14bdc689f400ab2857c4cdd1dca025eb09eaaf2b26328f3b42d117f24b9182dc2cc0a
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-static-build8.patch
|
||||
depfindprotobuf.diff
|
||||
disable-telemetry.diff
|
||||
dont-preload-cache.diff
|
||||
merge-archives.diff
|
||||
save-linker-opts.diff
|
||||
export-targets.patch
|
||||
dependencies.patch
|
||||
protobuf-cmake.patch
|
||||
protobuf-source.patch
|
||||
protobuf-source.patch # Disables upstream log event handling!
|
||||
)
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/mysql-connector-cpp-config.cmake.in" DESTINATION "${SOURCE_PATH}")
|
||||
file(REMOVE_RECURSE
|
||||
"${SOURCE_PATH}/cdk/extra/common"
|
||||
"${SOURCE_PATH}/cdk/extra/exprtest"
|
||||
"${SOURCE_PATH}/cdk/extra/lz4"
|
||||
"${SOURCE_PATH}/cdk/extra/ngs_mockup"
|
||||
"${SOURCE_PATH}/cdk/extra/process_launcher"
|
||||
"${SOURCE_PATH}/cdk/extra/protobuf"
|
||||
"${SOURCE_PATH}/cdk/extra/rapidjson"
|
||||
"${SOURCE_PATH}/cdk/extra/zlib"
|
||||
"${SOURCE_PATH}/cdk/extra/zstd"
|
||||
"${SOURCE_PATH}/jdbc/extra/otel/opentelemetry-cpp-1.12.0"
|
||||
)
|
||||
|
||||
vcpkg_check_features(
|
||||
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
OUT_FEATURE_OPTIONS options
|
||||
FEATURES
|
||||
jdbc WITH_JDBC
|
||||
jdbc WITH_JDBC
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/mysql-connector-cpp-config.cmake.in" DESTINATION "${SOURCE_PATH}")
|
||||
if(VCPKG_CROSSCOMPILING AND EXISTS "${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}/save_linker_opts${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
||||
vcpkg_list(APPEND options "-DWITH_SAVE_LINKER_OPTS=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}/save_linker_opts${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIBS)
|
||||
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_MSVCRT)
|
||||
|
||||
# Preparing to merge STATIC library: connector (xapi;devapi)
|
||||
@ -39,43 +55,53 @@ vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
${USE_MSBUILD_ARG}
|
||||
OPTIONS
|
||||
"-DWITH_SSL=${CURRENT_INSTALLED_DIR}"
|
||||
"-DWITH_LZ4=${CURRENT_INSTALLED_DIR}"
|
||||
"-DWITH_ZSTD=${CURRENT_INSTALLED_DIR}"
|
||||
"-DWITH_ZLIB=${CURRENT_INSTALLED_DIR}"
|
||||
"-DProtobuf_DIR=${CURRENT_INSTALLED_DIR}/share/protobuf" # Without these Windows is unable to find protobuf
|
||||
"-Dabsl_DIR=${CURRENT_INSTALLED_DIR}/share/absl"
|
||||
"-Dutf8_range_DIR=${CURRENT_INSTALLED_DIR}/share/utf8_range"
|
||||
"-DProtobuf_PROTOC_EXECUTABLE=${CURRENT_INSTALLED_DIR}/tools/protobuf/protoc"
|
||||
${options}
|
||||
"-DCMAKE_PROJECT_INCLUDE=${CURRENT_PORT_DIR}/cmake-project-include.cmake"
|
||||
"-DWITH_PROTOC=${CURRENT_HOST_INSTALLED_DIR}/tools/protobuf/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}"
|
||||
-DBUILD_STATIC=${BUILD_STATIC}
|
||||
-DMYSQLCLIENT_STATIC_LINKING=${BUILD_STATIC}
|
||||
-DSTATIC_MSVCRT=${STATIC_MSVCRT}
|
||||
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
|
||||
-DWITH_JDBC=${WITH_JDBC} # the following variables are only used by jdbc
|
||||
"-DMYSQL_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/mysql"
|
||||
"-DMYSQL_LIB_DIR=${CURRENT_INSTALLED_DIR}"
|
||||
"-DWITH_BOOST=${CURRENT_INSTALLED_DIR}"
|
||||
"-DWITH_TESTS=OFF"
|
||||
MAYBE_UNUSED_VARIABLES # and they are windows only
|
||||
MYSQL_INCLUDE_DIR
|
||||
MYSQL_LIB_DIR
|
||||
WITH_BOOST
|
||||
-DINSTALL_LIB_DIR=lib
|
||||
-DINSTALL_LIB_DIR_DEBUG=lib
|
||||
-DINSTALL_LIB_DIR_STATIC=lib
|
||||
-DINSTALL_LIB_DIR_STATIC_DEBUG=lib
|
||||
-DTELEMETRY=OFF
|
||||
-DWITH_DOC=OFF
|
||||
-DWITH_HEADER_CHECKS=OFF
|
||||
-DWITH_SSL=system
|
||||
-DWITH_TESTS=OFF
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
TELEMETRY
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-mysql-connector-cpp)
|
||||
configure_file("${CURRENT_PORT_DIR}/mysql-concpp-config.cmake" "${CURRENT_PACKAGES_DIR}/share/mysql-concpp/mysql-concpp-config.cmake" @ONLY)
|
||||
|
||||
file(REMOVE
|
||||
if(NOT VCPKG_CROSSCOMPILING AND EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libutils/save_linker_opts${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
|
||||
vcpkg_copy_tools(TOOL_NAMES save_linker_opts
|
||||
SEARCH_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libutils"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC)
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/mysqlx/common/api.h" "defined STATIC_CONCPP" "(1)")
|
||||
if(WITH_JDBC)
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/jdbc/cppconn/build_config.h" "ifdef STATIC_CONCPP" "if 1")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/INFO_BIN"
|
||||
"${CURRENT_PACKAGES_DIR}/INFO_SRC"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/INFO_BIN"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/INFO_SRC"
|
||||
"${CURRENT_PACKAGES_DIR}/INFO_BIN"
|
||||
"${CURRENT_PACKAGES_DIR}/mysql-concpp-config.cmake"
|
||||
"${CURRENT_PACKAGES_DIR}/mysql-concpp-config-version.cmake"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/mysql-concpp-config.cmake"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/mysql-concpp-config-version.cmake"
|
||||
)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
|
||||
|
@ -1,76 +0,0 @@
|
||||
diff --git a/cdk/cmake/DepFindProtobuf.cmake b/cdk/cmake/DepFindProtobuf.cmake
|
||||
index 730389de..7c3fd78b 100644
|
||||
--- a/cdk/cmake/DepFindProtobuf.cmake
|
||||
+++ b/cdk/cmake/DepFindProtobuf.cmake
|
||||
@@ -44,6 +44,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
+if(0)
|
||||
if(TARGET ext::protobuf)
|
||||
return()
|
||||
endif()
|
||||
@@ -64,7 +65,7 @@ add_ext_targets(protobuf
|
||||
LIBRARY protobuf pb_libprotobuf
|
||||
EXECUTABLE protoc pb_protoc
|
||||
)
|
||||
-
|
||||
+endif()
|
||||
|
||||
# Standard PROTOBUF_GENERATE_CPP modified to our usage
|
||||
function(mysqlx_protobuf_generate_cpp SRCS HDRS)
|
||||
@@ -90,7 +91,7 @@ function(mysqlx_protobuf_generate_cpp SRCS HDRS)
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/protobuf/${FIL_WE}.pb.h"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-E make_directory "${CMAKE_CURRENT_BINARY_DIR}/protobuf"
|
||||
- COMMAND ext::protoc
|
||||
+ COMMAND protobuf::protoc
|
||||
ARGS --cpp_out "${CMAKE_CURRENT_BINARY_DIR}/protobuf"
|
||||
-I ${ABS_PATH} ${ABS_FIL}
|
||||
|
||||
diff --git a/cdk/core/CMakeLists.txt b/cdk/core/CMakeLists.txt
|
||||
index 30f7baf1..2a4a9434 100644
|
||||
--- a/cdk/core/CMakeLists.txt
|
||||
+++ b/cdk/core/CMakeLists.txt
|
||||
@@ -33,6 +33,7 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
#ADD_SUBDIRECTORY(tests)
|
||||
|
||||
+find_package(Protobuf CONFIG REQUIRED)
|
||||
|
||||
SET(cdk_sources
|
||||
session.cc
|
||||
@@ -45,7 +46,7 @@ add_library(cdk STATIC ${cdk_sources} ${HEADERS})
|
||||
|
||||
target_link_libraries(cdk
|
||||
PUBLIC cdk_mysqlx cdk_parser
|
||||
- PRIVATE ext::protobuf-lite # required by codecc.cc
|
||||
+ PRIVATE protobuf::libprotobuf-lite # required by codecc.cc
|
||||
)
|
||||
|
||||
add_coverage(cdk)
|
||||
diff --git a/cdk/protocol/mysqlx/CMakeLists.txt b/cdk/protocol/mysqlx/CMakeLists.txt
|
||||
index cfc81daf..6c484575 100644
|
||||
--- a/cdk/protocol/mysqlx/CMakeLists.txt
|
||||
+++ b/cdk/protocol/mysqlx/CMakeLists.txt
|
||||
@@ -26,8 +26,9 @@
|
||||
# along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
-find_dependency(Protobuf)
|
||||
-find_dependency(Compression)
|
||||
+include(DepFindCompression)
|
||||
+find_package(Protobuf CONFIG REQUIRED)
|
||||
+include(DepFindProtobuf)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
|
||||
@@ -132,7 +133,7 @@ target_include_directories(cdk_proto_mysqlx PRIVATE
|
||||
if(use_full_protobuf)
|
||||
target_link_libraries(cdk_proto_mysqlx PRIVATE ext::protobuf)
|
||||
else()
|
||||
- target_link_libraries(cdk_proto_mysqlx PRIVATE ext::protobuf-lite)
|
||||
+ target_link_libraries(cdk_proto_mysqlx PRIVATE protobuf::libprotobuf-lite)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
24
ports/mysql-connector-cpp/save-linker-opts.diff
Normal file
24
ports/mysql-connector-cpp/save-linker-opts.diff
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
|
||||
index 848b7cf..159145f 100644
|
||||
--- a/cmake/libutils.cmake
|
||||
+++ b/cmake/libutils.cmake
|
||||
@@ -236,8 +236,9 @@ function(merge_libraries TARGET)
|
||||
#
|
||||
|
||||
add_dependencies(${TARGET}-deps save_linker_opts)
|
||||
+ set(WITH_SAVE_LINKER_OPTS "${LIBUTILS_BIN_DIR}/save_linker_opts" CACHE FILEPATH "")
|
||||
set_target_properties(${TARGET}-deps PROPERTIES
|
||||
- RULE_LAUNCH_LINK "${LIBUTILS_BIN_DIR}/save_linker_opts ${log_file}.STATIC "
|
||||
+ RULE_LAUNCH_LINK "${WITH_SAVE_LINKER_OPTS} ${log_file}.STATIC "
|
||||
)
|
||||
|
||||
# Arrange for ${TARGET}-deps to be built before ${TARGET}
|
||||
@@ -255,7 +256,7 @@ function(merge_libraries TARGET)
|
||||
#
|
||||
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
- RULE_LAUNCH_LINK "${LIBUTILS_BIN_DIR}/save_linker_opts ${log_file}.SHARED "
|
||||
+ RULE_LAUNCH_LINK "${WITH_SAVE_LINKER_OPTS} ${log_file}.SHARED "
|
||||
)
|
||||
|
||||
else(NOT MSVC)
|
@ -1,15 +1,25 @@
|
||||
{
|
||||
"name": "mysql-connector-cpp",
|
||||
"version": "9.1.0",
|
||||
"port-version": 1,
|
||||
"port-version": 2,
|
||||
"description": "This is a release of MySQL Connector/C++, the C++ interface for communicating with MySQL servers.",
|
||||
"homepage": "https://github.com/mysql/mysql-connector-cpp",
|
||||
"license": null,
|
||||
"supports": "!uwp & !(windows & (arm | arm64))",
|
||||
"supports": "!android & !uwp",
|
||||
"dependencies": [
|
||||
"lz4",
|
||||
{
|
||||
"name": "mysql-connector-cpp",
|
||||
"host": true,
|
||||
"platform": "!windows | mingw"
|
||||
},
|
||||
"openssl",
|
||||
"protobuf",
|
||||
{
|
||||
"name": "protobuf",
|
||||
"host": true
|
||||
},
|
||||
"rapidjson",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
@ -23,7 +33,7 @@
|
||||
],
|
||||
"features": {
|
||||
"jdbc": {
|
||||
"description": "Legacy JDBC support.",
|
||||
"description": "Legacy C++ API based on the JDBC4 specification.",
|
||||
"supports": "static",
|
||||
"dependencies": [
|
||||
"libmysql"
|
||||
|
@ -780,9 +780,6 @@ mpir:x64-linux=skip
|
||||
msmpi:arm64-windows=fail
|
||||
msmpi:arm64-windows-static-md=fail
|
||||
munit:x64-android=fail
|
||||
mysql-connector-cpp:arm-neon-android=fail
|
||||
mysql-connector-cpp:arm64-android=fail
|
||||
mysql-connector-cpp:x64-android=fail
|
||||
nana:arm-neon-android=fail
|
||||
nana:arm64-android=fail
|
||||
nana:x64-android=fail
|
||||
|
@ -0,0 +1,8 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
|
||||
OPTIONS
|
||||
"-DFEATURES=${FEATURES}"
|
||||
)
|
||||
vcpkg_cmake_build()
|
@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.10...3.30)
|
||||
project(mysql-connector-cpp-test CXX)
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
# proper export
|
||||
add_executable(unofficial-mysql-connector-cpp main.cpp)
|
||||
find_package(unofficial-mysql-connector-cpp CONFIG REQUIRED)
|
||||
target_link_libraries(unofficial-mysql-connector-cpp PRIVATE unofficial::mysql-connector-cpp::connector)
|
||||
|
||||
# partial re-implementation
|
||||
add_executable(mysql-concpp-xdevapi main.cpp)
|
||||
find_package(mysql-concpp CONFIG REQUIRED)
|
||||
target_link_libraries(mysql-concpp-xdevapi PRIVATE $<IF:$<TARGET_EXISTS:mysql::concpp-xdevapi>,mysql::concpp-xdevapi,mysql::concpp-xdevapi-static>)
|
||||
|
||||
if("jdbc" IN_LIST FEATURES)
|
||||
# proper export
|
||||
add_executable(unofficial-mysql-connector-cpp-jdbc jdbc.cpp)
|
||||
target_link_libraries(unofficial-mysql-connector-cpp-jdbc PRIVATE unofficial::mysql-connector-cpp::connector-jdbc)
|
||||
|
||||
# partial re-implementation
|
||||
add_executable(mysql-concpp-jdbc jdbc.cpp)
|
||||
target_link_libraries(mysql-concpp-jdbc PRIVATE $<IF:$<TARGET_EXISTS:mysql::concpp-jdbc>,mysql::concpp-jdbc,mysql::concpp-jdbc-static>)
|
||||
endif()
|
@ -0,0 +1,7 @@
|
||||
#include <mysql/jdbc.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
sql::Driver* driver = sql::mysql::get_driver_instance();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
#include <mysqlx/xdevapi.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
mysqlx::Session sess("mysqlx://vcpkg@127.0.0.1");
|
||||
return 0;
|
||||
}
|
31
scripts/test_ports/vcpkg-ci-mysql-connector-cpp/vcpkg.json
Normal file
31
scripts/test_ports/vcpkg-ci-mysql-connector-cpp/vcpkg.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "vcpkg-ci-mysql-connector-cpp",
|
||||
"version-string": "ci",
|
||||
"description": "Validates mysql-connector-cpp",
|
||||
"dependencies": [
|
||||
"mysql-connector-cpp",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
{
|
||||
"name": "jdbc",
|
||||
"platform": "x64 & static"
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"jdbc": {
|
||||
"description": "Test jdbc",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "mysql-connector-cpp",
|
||||
"features": [
|
||||
"jdbc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -6214,7 +6214,7 @@
|
||||
},
|
||||
"mysql-connector-cpp": {
|
||||
"baseline": "9.1.0",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"nameof": {
|
||||
"baseline": "0.10.4",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "30acb048f76e9b63cfd210aa612d7a1bbcc447a3",
|
||||
"version": "9.1.0",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "a1e99552e0b1ff9e507f46cdda63911e77dba19a",
|
||||
"version": "9.1.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user