Skip to content

Commit

Permalink
[drogon] Fix libmariadb import/export and usage (#22426)
Browse files Browse the repository at this point in the history
* Add canonical usage

* Use unofficial-libmariadb

* Update versions
  • Loading branch information
dg0yt authored Jan 11, 2022
1 parent 5edd518 commit 9f04533
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ports/drogon/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vcpkg_from_github(
drogon_config.patch
static-brotli.patch
fs.patch
use-libmariadb.patch
)

vcpkg_check_features(
Expand Down Expand Up @@ -56,7 +57,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

# Handle copyright
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

# Copy pdb files
Expand Down
4 changes: 4 additions & 0 deletions ports/drogon/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package drogon provides CMake targets:

find_package(Drogon CONFIG REQUIRED)
target_link_libraries(main PRIVATE Drogon::Drogon)
31 changes: 31 additions & 0 deletions ports/drogon/use-libmariadb.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70b2a0d..7f35626 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -363,10 +363,11 @@ endif (BUILD_POSTGRESQL)

if (BUILD_MYSQL)
# Find mysql, only mariadb client liberary is supported
- find_package(MySQL)
+ find_package(unofficial-libmariadb CONFIG REQUIRED)
+ set(MySQL_FOUND TRUE)
if (MySQL_FOUND)
message(STATUS "Ok! We find the mariadb!")
- target_link_libraries(${PROJECT_NAME} PRIVATE MySQL_lib)
+ target_link_libraries(${PROJECT_NAME} PRIVATE unofficial::libmariadb)
set(DROGON_SOURCES
${DROGON_SOURCES}
orm_lib/src/mysql_impl/MysqlConnection.cc
diff --git a/cmake/templates/DrogonConfig.cmake.in b/cmake/templates/DrogonConfig.cmake.in
index 72d9622..026f1a5 100644
--- a/cmake/templates/DrogonConfig.cmake.in
+++ b/cmake/templates/DrogonConfig.cmake.in
@@ -25,7 +25,7 @@ if(@SQLite3_FOUND@)
find_dependency(SQLite3)
endif()
if(@MySQL_FOUND@)
-find_dependency(MySQL)
+find_dependency(unofficial-libmariadb CONFIG REQUIRED)
endif()
if(@Boost_FOUND@)
find_dependency(Boost)
1 change: 1 addition & 0 deletions ports/drogon/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "drogon",
"version-semver": "1.7.4",
"port-version": 1,
"description": "A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows",
"homepage": "https://github.com/an-tao/drogon",
"documentation": "https://drogon.docsforge.com/master/overview/",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,7 @@
},
"drogon": {
"baseline": "1.7.4",
"port-version": 0
"port-version": 1
},
"dtl": {
"baseline": "1.19",
Expand Down
5 changes: 5 additions & 0 deletions versions/d-/drogon.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e5e1c950e966613f9b867570346f9458bff71826",
"version-semver": "1.7.4",
"port-version": 1
},
{
"git-tree": "275d55a78bb61a79f0d66cd4f71e6b5892566666",
"version-semver": "1.7.4",
Expand Down

0 comments on commit 9f04533

Please sign in to comment.