Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qhull] Fix copyright, pc files, cmake usage #23129

Merged
merged 8 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 31 additions & 23 deletions ports/qhull/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
9 changes: 9 additions & 0 deletions ports/qhull/usage
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 14 additions & 3 deletions ports/qhull/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5554,7 +5554,7 @@
},
"qhull": {
"baseline": "8.0.2",
"port-version": 2
"port-version": 3
},
"qnnpack": {
"baseline": "2021-02-26",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qhull.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "afe7d7f235d72db1da52a99ebe085cafd21577b3",
"version": "8.0.2",
"port-version": 3
},
{
"git-tree": "574301a0f60d743f5ea7165dda5e45bd0f1082ba",
"version-string": "8.0.2",
Expand Down