From 61ae96ea0657912514714e1ae5f1ae9d04f4439c Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 22 Feb 2022 22:08:24 +0100 Subject: [PATCH] [qhull] Fix copyright, pc files, cmake usage (#23129) * Modernize portfile * Install COPYING.txt for copyright * Create uniform pc file names for all configurations * Provide uniform and documented CMake config * Update versions * Use version field * Update versions * CI --- ports/qhull/portfile.cmake | 54 ++++++++++++++++++++++---------------- ports/qhull/usage | 9 +++++++ ports/qhull/vcpkg.json | 17 +++++++++--- versions/baseline.json | 2 +- versions/q-/qhull.json | 5 ++++ 5 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 ports/qhull/usage diff --git a/ports/qhull/portfile.cmake b/ports/qhull/portfile.cmake index 5584c7b192..6aa76096c6 100644 --- a/ports/qhull/portfile.cmake +++ b/ports/qhull/portfile.cmake @@ -11,38 +11,45 @@ vcpkg_from_github( string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS} ) -vcpkg_install_cmake() +vcpkg_cmake_install() file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/share/man - ${CURRENT_PACKAGES_DIR}/share/doc - ${CURRENT_PACKAGES_DIR}/debug/include - ${CURRENT_PACKAGES_DIR}/debug/share/man - ${CURRENT_PACKAGES_DIR}/debug/share/doc + "${CURRENT_PACKAGES_DIR}/share/man" + "${CURRENT_PACKAGES_DIR}/share/doc" + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share/man" + "${CURRENT_PACKAGES_DIR}/debug/share/doc" ) -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/Qhull) -file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/qhullstatic.pc - ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/qhullstatic_d.pc -) +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Qhull) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/qhull_r.pc - ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/qhull_rd.pc - ) + file(WRITE "${CURRENT_PACKAGES_DIR}/share/qhull/QhullTargets-interface.cmake" [[ + add_library(Qhull::qhull_r IMPORTED INTERFACE) + set_target_properties(Qhull::qhull_r PROPERTIES INTERFACE_LINK_LIBRARIES Qhull::qhullstatic_r) +]]) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(active_basename "qhullstatic") + set(inactive_basename "qhull") else() - file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/qhullstatic_r.pc - ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/qhullstatic_rd.pc - ) + set(active_basename "qhull") + set(inactive_basename "qhullstatic") +endif() +file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${inactive_basename}_r.pc") +file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${inactive_basename}.pc") # qhullstatic.pc in dynamic build +if(NOT DEFINED VCPKG_BUILD_TYPE) + file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${inactive_basename}_rd.pc") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${active_basename}_rd.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${active_basename}_r.pc") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/qhullstatic_d.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/qhullstatic.pc") + file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${inactive_basename}.pc") # qhullstatic.pc in dynamic build + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/qhullcpp_d.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/qhullcpp.pc") endif() vcpkg_fixup_pkgconfig() @@ -56,4 +63,5 @@ vcpkg_copy_tools(TOOL_NAMES AUTO_CLEAN ) -file(INSTALL ${SOURCE_PATH}/README.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME usage) +file(INSTALL "${SOURCE_PATH}/COPYING.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/qhull/usage b/ports/qhull/usage new file mode 100644 index 0000000000..94dbcafa68 --- /dev/null +++ b/ports/qhull/usage @@ -0,0 +1,9 @@ +The package qhull provides CMake targets: + + # Reentrant C API + find_package(Qhull CONFIG REQUIRED) + target_link_libraries(main PRIVATE Qhull::qhull_r) + + # C++ API + find_package(Qhull CONFIG REQUIRED) + target_link_libraries(main PRIVATE Qhull::qhullcpp) diff --git a/ports/qhull/vcpkg.json b/ports/qhull/vcpkg.json index b115f1331a..7f6e7e32fc 100644 --- a/ports/qhull/vcpkg.json +++ b/ports/qhull/vcpkg.json @@ -1,7 +1,18 @@ { "name": "qhull", - "version-string": "8.0.2", - "port-version": 2, + "version": "8.0.2", + "port-version": 3, "description": "computes the convex hull, Delaunay triangulation, Voronoi diagram", - "homepage": "https://github.com/qhull/qhull" + "homepage": "https://github.com/qhull/qhull", + "license": null, + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/versions/baseline.json b/versions/baseline.json index 12327a08a5..1d26c75d66 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5558,7 +5558,7 @@ }, "qhull": { "baseline": "8.0.2", - "port-version": 2 + "port-version": 3 }, "qnnpack": { "baseline": "2021-02-26", diff --git a/versions/q-/qhull.json b/versions/q-/qhull.json index 52eb5af946..69b98685f1 100644 --- a/versions/q-/qhull.json +++ b/versions/q-/qhull.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "afe7d7f235d72db1da52a99ebe085cafd21577b3", + "version": "8.0.2", + "port-version": 3 + }, { "git-tree": "574301a0f60d743f5ea7165dda5e45bd0f1082ba", "version-string": "8.0.2",