[civetweb] Dynamic linkage, debug pc file (#34654)

This commit is contained in:
Kai Pastor 2023-10-23 20:26:58 +02:00 committed by GitHub
parent 374023bdbb
commit 2d0bfe54b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 12 deletions

View File

@ -0,0 +1,49 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c5368c0..c297861 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -614,6 +614,10 @@ configure_package_config_file(
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CIVETWEB_ENABLE_CXX
)
+set(PROJECT_VERSION "${VERSION}")
+if(CIVETWEB_ENABLE_SSL)
+ set(REQUIRES_OPENSSL openssl)
+endif()
configure_file(
cmake/${PROJECT_NAME}.pc.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc
@@ -629,13 +633,13 @@ configure_file(
install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-cpp.pc"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake
diff --git a/cmake/civetweb-cpp.pc.in b/cmake/civetweb-cpp.pc.in
index ca1232c..495da46 100644
--- a/cmake/civetweb-cpp.pc.in
+++ b/cmake/civetweb-cpp.pc.in
@@ -10,3 +10,4 @@ Requires:
Libs: -L${libdir} -l@PROJECT_NAME@-cpp
Cflags: -I${includedir}
+Requires.private: civetweb
diff --git a/cmake/civetweb.pc.in b/cmake/civetweb.pc.in
index 27cea8f..0826f61 100644
--- a/cmake/civetweb.pc.in
+++ b/cmake/civetweb.pc.in
@@ -11,3 +11,4 @@ Libs: -L${libdir} -l@PROJECT_NAME@
Cflags: -I${includedir}
+Requires.private: @REQUIRES_OPENSSL@

View File

@ -1,5 +1,3 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO civetweb/civetweb
@ -9,7 +7,9 @@ vcpkg_from_github(
PATCHES
disable_warnings.patch # cl will simply ignore the other invalid options.
fix-fseeko.patch
pkgconfig.patch
)
file(REMOVE_RECURSE "${SOURCE_PATH}/src/third_party")
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
@ -31,22 +31,23 @@ vcpkg_cmake_configure(
-DCIVETWEB_ENABLE_SSL_DYNAMIC_LOADING=OFF
-DCIVETWEB_ENABLE_WEBSOCKETS=ON
-DCIVETWEB_ALLOW_WARNINGS=ON
"-DVERSION=${VERSION}"
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/civetweb)
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/civetweb.h" "defined(CIVETWEB_DLL_IMPORTS)" 1)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/CivetServer.h" "defined(CIVETWEB_CXX_DLL_IMPORTS)" 1)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/civetweb.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/civetweb.pc")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/civetweb-cpp.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/civetweb-cpp.pc")
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/pkgconfig")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_copy_pdbs()
file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")

4
ports/civetweb/usage Normal file
View File

@ -0,0 +1,4 @@
civetweb provides CMake targets:
find_package(civetweb CONFIG REQUIRED)
target_link_libraries(main PRIVATE civetweb::civetweb)

View File

@ -1,6 +1,7 @@
{
"name": "civetweb",
"version": "1.16",
"port-version": 1,
"description": "Easy to use, powerful, C/C++ embeddable web server.",
"homepage": "https://github.com/civetweb/civetweb",
"supports": "!uwp",

View File

@ -1582,7 +1582,7 @@
},
"civetweb": {
"baseline": "1.16",
"port-version": 0
"port-version": 1
},
"cjson": {
"baseline": "1.7.16",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "23fa18e460290d6b0629ca6487f69b56845cfbda",
"version": "1.16",
"port-version": 1
},
{
"git-tree": "46ba5309a5759827c0d729344e8f17cc5f3132b9",
"version": "1.16",