[mariadb-connector-cpp] New port (#40077)

This commit is contained in:
Kai Pastor 2024-08-02 00:22:05 +02:00 committed by GitHub
parent b43e7adc6f
commit 4fbb777929
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,12 @@
diff --git a/include/conncpp/CArray.hpp b/include/conncpp/CArray.hpp
index f3e4634..e0f62eb 100644
--- a/include/conncpp/CArray.hpp
+++ b/include/conncpp/CArray.hpp
@@ -24,6 +24,7 @@
#include "buildconf.hpp"
#include <initializer_list>
#include <vector>
+#include <stdint.h>
namespace sql

View File

@ -0,0 +1,53 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a10e1e..4a4732b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -690,14 +690,16 @@ IF(MINGW)
ENDIF()
INCLUDE(symlink)
+if(NOT BUILD_SHARED_LIBS)
CREATE_SYMLINK(lib${LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} ${STATIC_LIBRARY_NAME} ${INSTALL_LIBDIR})
+endif()
ADD_DEPENDENCIES(${LIBRARY_NAME} DEPENDENCIES_FOR_PACKAGE)
########## Packaging ##########
# MSI
-IF(WIN32)
+IF(0)
IF(WITH_MSI)
ADD_CUSTOM_COMMAND(TARGET ${LIBRARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -DDRIVER_LIB_DIR=$<TARGET_FILE_DIR:${LIBRARY_NAME}>
@@ -714,13 +716,30 @@ ELSE()
#MESSAGE(STATUS "Configuring to generate PKG package")
#ADD_SUBDIRECTORY(osxinstall)
ENDIF()
+ if(BUILD_SHARED_LIBS)
+ set_target_properties(${STATIC_LIBRARY_NAME} PROPERTIES EXCLUDE_FROM_ALL 1)
+ target_include_directories(${LIBRARY_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
INSTALL(TARGETS ${LIBRARY_NAME}
+ EXPORT unofficial-mariadb-connector-cpp
+ RUNTIME DESTINATION ${INSTALL_BINDIR}
LIBRARY DESTINATION ${INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${INSTALL_LIBDIR}
COMPONENT SharedLibraries)
+ else()
+ set_target_properties(${LIBRARY_NAME} PROPERTIES EXCLUDE_FROM_ALL 1)
+ set_target_properties(${STATIC_LIBRARY_NAME} PROPERTIES EXPORT_NAME ${LIBRARY_NAME})
+ target_include_directories(${STATIC_LIBRARY_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
INSTALL(TARGETS
${STATIC_LIBRARY_NAME}
+ EXPORT unofficial-mariadb-connector-cpp
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
COMPONENT Development)
+ endif()
+ install(EXPORT unofficial-mariadb-connector-cpp
+ DESTINATION share/unofficial-mariadb-connector-cpp
+ NAMESPACE unofficial::mariadb-connector-cpp::
+ FILE unofficial-mariadb-connector-cpp-targets.cmake
+ )
MESSAGE(STATUS "Documentation installed to ${INSTALL_DOCDIR}")
MESSAGE(STATUS "License file installed to ${INSTALL_LICENSEDIR}")

View File

@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 43bc4a2..5a10e1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -545,7 +545,11 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/maconncpp.def.in
${CMAKE_SOURCE_DIR}/src/maconncpp.def)
# Dynamic linking is default on non-Windows
-IF(MARIADB_LINK_DYNAMIC)
+IF(1)
+ find_package(unofficial-libmariadb CONFIG REQUIRED)
+ set(MARIADB_CLIENT_TARGET_NAME unofficial::libmariadb)
+ add_library(mariadbclient ALIAS unofficial::libmariadb)
+ELSEIF(MARIADB_LINK_DYNAMIC)
IF(USE_SYSTEM_INSTALLED_LIB)
IF(MINGW)
# I guess -l can be removed here. Also, for build with c/c as submodule this will have to me moved on top level out of this IF's
@@ -601,6 +605,7 @@ ENDIF()
ADD_LIBRARY(${LIBRARY_NAME}_obj OBJECT ${MACPP_SOURCES})
+target_link_libraries(${LIBRARY_NAME}_obj PRIVATE unofficial::libmariadb)
IF(UNIX)
SET_TARGET_PROPERTIES(${LIBRARY_NAME}_obj PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
ENDIF()

View File

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ffa175a..82be8d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -428,7 +428,7 @@ IF(WIN32)
ENDIF()
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN)
SET(INSTALL_PLUGINDIR "${MARIADB_DEFAULT_PLUGINS_SUBDIR}")
- SET(PLATFORM_DEPENDENCIES ${PLATFORM_DEPENDENCIES} version.lib)
+ SET(PLATFORM_DEPENDENCIES ${PLATFORM_DEPENDENCIES} version)
ENDIF()
### Build options, initial settings and platform defaults

View File

@ -0,0 +1,36 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mariadb-corporation/mariadb-connector-cpp
REF ${VERSION}
HEAD_REF master
SHA512 da1a2d28c1c56a14674c500ebc8ab0d0b7d9053335f147c2353832f05c2527f4bddd1fe4fff55f625b9e6085111e3b615f5a1a6484dd1fd61a7e6a8cabfd8c57
PATCHES
fix-carray.diff
libmariadb.diff
mingw.diff
install.diff
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DINSTALL_LIBDIR=lib
-DUSE_SYSTEM_INSTALLED_LIB=ON
-DWITH_MSI=OFF
-DWITH_UNIT_TESTS=OFF
)
vcpkg_cmake_install()
file(INSTALL "${CURRENT_PORT_DIR}/unofficial-${PORT}-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}")
vcpkg_cmake_config_fixup(PACKAGE_NAME "unofficial-${PORT}")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/share/doc"
)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

View File

@ -0,0 +1,3 @@
include(CMakeFindDependencyMacro)
find_dependency(unofficial-libmariadb CONFIG)
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-mariadb-connector-cpp-targets.cmake")

View File

@ -0,0 +1,21 @@
{
"name": "mariadb-connector-cpp",
"version": "1.1.4",
"description": "Connector/c++ for MariaDB.",
"homepage": "https://mariadb.com/docs/appdev/connector-cpp/",
"license": "LGPL-2.1-or-later",
"dependencies": [
{
"name": "libmariadb",
"default-features": false
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -5676,6 +5676,10 @@
"baseline": "24.02.0",
"port-version": 1
},
"mariadb-connector-cpp": {
"baseline": "1.1.4",
"port-version": 0
},
"marisa-trie": {
"baseline": "0.2.6+20200926",
"port-version": 2

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "8cc12b00f195b480d285ebd6e549539db76ed36a",
"version": "1.1.4",
"port-version": 0
}
]
}