[portmidi] Fix dependency searching (#30265)

* [portmidi] Search for Threads in the CMake config.

Without this, consuming the library in CMake would result in the
following error:

The link interface of target "PortMidi::portmidi" contains:

  Threads::Threads

but the target was not found.

* [portmidi] Cleanup portfile.

- Copy pdbs
- Use vcpkg_install_copyright
- Use ${VERSION}

* [portmidi] Install a usage file.

* [portmidi] Bump port-version.

* [portmidi] Update baseline.
This commit is contained in:
Pierre Wendling 2023-03-20 02:18:59 -04:00 committed by GitHub
parent 023974c3db
commit ca64b91070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 7 deletions

View File

@ -1,26 +1,31 @@
vcpkg_from_github( vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
REPO PortMidi/portmidi REPO PortMidi/portmidi
REF v2.0.4 REF "v${VERSION}"
SHA512 d9f22d161e1dd9a4bde1971bb2b6e5352da51545f4fe5ecad11c55e7a535f0d88efce18d1c8fd91e93b70a7926150f86a0f53972ad92370e86556a8dd72dc194 SHA512 d9f22d161e1dd9a4bde1971bb2b6e5352da51545f4fe5ecad11c55e7a535f0d88efce18d1c8fd91e93b70a7926150f86a0f53972ad92370e86556a8dd72dc194
HEAD_REF master HEAD_REF master
PATCHES
"search-for-threads-in-config.patch"
) )
if(VCPKG_CRT_LINKAGE STREQUAL static) if(VCPKG_CRT_LINKAGE STREQUAL static)
SET(PM_USE_STATIC_RUNTIME ON) set(PM_USE_STATIC_RUNTIME ON)
else() else()
SET(PM_USE_STATIC_RUNTIME OFF) set(PM_USE_STATIC_RUNTIME OFF)
endif() endif()
vcpkg_cmake_configure( vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}" SOURCE_PATH "${SOURCE_PATH}"
OPTIONS OPTIONS
-DPM_USE_STATIC_RUNTIME="${PM_USE_STATIC_RUNTIME}" -DPM_USE_STATIC_RUNTIME="${PM_USE_STATIC_RUNTIME}"
) )
vcpkg_cmake_install()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig() vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/PortMidi) vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/PortMidi)
file(INSTALL "${SOURCE_PATH}/license.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.txt")

View File

@ -0,0 +1,12 @@
diff --git a/packaging/PortMidiConfig.cmake.in b/packaging/PortMidiConfig.cmake.in
index a04928a..203ba30 100644
--- a/packaging/PortMidiConfig.cmake.in
+++ b/packaging/PortMidiConfig.cmake.in
@@ -4,6 +4,7 @@ include(CMakeFindDependencyMacro)
if(UNIX AND NOT APPLE AND NOT HAIKU AND (@LINUX_DEFINES@ MATCHES ".*PMALSA.*"))
find_dependency(ALSA)
endif()
+find_dependency(Threads)
include("${CMAKE_CURRENT_LIST_DIR}/PortMidiTargets.cmake")

4
ports/portmidi/usage Normal file
View File

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

View File

@ -1,6 +1,7 @@
{ {
"name": "portmidi", "name": "portmidi",
"version": "2.0.4", "version": "2.0.4",
"port-version": 1,
"description": "PortMidi is a cross platform (Windows, macOS, Linux, and BSDs which support alsalib) library for interfacing with operating systems' MIDI I/O APIs.", "description": "PortMidi is a cross platform (Windows, macOS, Linux, and BSDs which support alsalib) library for interfacing with operating systems' MIDI I/O APIs.",
"homepage": "https://github.com/PortMidi/portmidi", "homepage": "https://github.com/PortMidi/portmidi",
"license": "MIT", "license": "MIT",

View File

@ -6186,7 +6186,7 @@
}, },
"portmidi": { "portmidi": {
"baseline": "2.0.4", "baseline": "2.0.4",
"port-version": 0 "port-version": 1
}, },
"portsmf": { "portsmf": {
"baseline": "0.238", "baseline": "0.238",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "b8607f833773d8d45e83a3390c2096d28226c1d2",
"version": "2.0.4",
"port-version": 1
},
{ {
"git-tree": "80e9d16ce38c591b483a1d5b84eeb96a00a4d4ff", "git-tree": "80e9d16ce38c591b483a1d5b84eeb96a00a4d4ff",
"version": "2.0.4", "version": "2.0.4",