[portmidi] update to 2.0.1; add Linux support (#22256)

The original PortMidi author moved it to GitHub and made the first
release in many years. The build system now works without hacks.
This commit is contained in:
Be 2022-01-03 15:23:35 -06:00 committed by GitHub
parent cccfe836db
commit c849f331d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 68 additions and 232 deletions

View File

@ -1,50 +0,0 @@
diff --git a/portmidi/trunk/CMakeLists.txt b/portmidi/trunk/CMakeLists.txt
index e5e01b6..483b900 100644
--- a/portmidi/trunk/CMakeLists.txt
+++ b/portmidi/trunk/CMakeLists.txt
@@ -72,10 +72,14 @@ endif(0)
include_directories(pm_common porttime)
add_subdirectory(pm_common)
+if (0)
add_subdirectory(pm_test)
+endif()
add_subdirectory(pm_dylib)
# Cannot figure out how to make an xcode Java application with CMake
+if (JAVA_SUPPORT)
add_subdirectory(pm_java)
+endif()
diff --git a/portmidi/trunk/pm_common/CMakeLists.txt b/portmidi/trunk/pm_common/CMakeLists.txt
index c829063..2597bea 100644
--- a/portmidi/trunk/pm_common/CMakeLists.txt
+++ b/portmidi/trunk/pm_common/CMakeLists.txt
@@ -111,17 +111,25 @@ target_link_libraries(portmidi-static ${PM_NEEDED_LIBS})
# define the jni library
include_directories(${JAVA_INCLUDE_PATHS})
+if (JAVA_SUPPORT)
set(JNISRC ${LIBSRC} ../pm_java/pmjni/pmjni.c)
add_library(pmjni SHARED ${JNISRC})
target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")
+endif()
# install the libraries (Linux and Mac OS X command line)
if(1)
- INSTALL(TARGETS portmidi-static pmjni
+ INSTALL(TARGETS portmidi-static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
+ if (JAVA_SUPPORT)
+ INSTALL(TARGETS pmjni
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+ endif()
# .h files installed by pm_dylib/CMakeLists.txt, so don't need them here
INSTALL(FILES portmidi.h ../porttime/porttime.h
DESTINATION include)

View File

@ -1,148 +0,0 @@
diff --git a/portmidi/trunk/CMakeLists.txt b/portmidi/trunk/CMakeLists.txt
index 4919b78..e5e01b6 100644
--- a/portmidi/trunk/CMakeLists.txt
+++ b/portmidi/trunk/CMakeLists.txt
@@ -4,6 +4,7 @@
cmake_minimum_required(VERSION 2.6)
+if (0)
if(UNIX)
# allow user to set Release or Debug
set(CMAKE_BUILD_TYPE Release CACHE STRING
@@ -22,11 +23,13 @@ else(UNIX)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING
"Semicolon-separate list of supported configuration types")
endif(UNIX)
+endif()
#set(CMAKE_RELATIVE_PATHS ON CACHE STRING "avoid absolute paths" FORCE)
# Clear out the built-in C++ compiler and link flags for each of the
# unused configurations.
+if (0)
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused")
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused")
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused")
@@ -37,10 +40,11 @@ set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused")
set(CMAKE_OSX_ARCHITECTURES i386 ppc x86_64 CACHE STRING "change to needed architecture for a smaller library" FORCE)
+endif()
PROJECT(portmidi)
-if(UNIX)
+if(0)
# Problem: if there was an old Debug build and you change
# CMAKE_BUILD_TYPE to Release, then the OUTPUT_DIRECTORY's will
# still be Debug. Try to fix this by checking if the DIRECTORY's
@@ -63,7 +67,7 @@ if(UNIX)
${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE}
CACHE STRING "libraries go here" FORCE)
endif(CMAKE_LIBRARY_OUTPUT_DIRECTORY MATCHES ${BAD_DIR})
-endif(UNIX)
+endif(0)
include_directories(pm_common porttime)
add_subdirectory(pm_common)
diff --git a/portmidi/trunk/pm_common/CMakeLists.txt b/portmidi/trunk/pm_common/CMakeLists.txt
index cbeeade..c829063 100644
--- a/portmidi/trunk/pm_common/CMakeLists.txt
+++ b/portmidi/trunk/pm_common/CMakeLists.txt
@@ -5,8 +5,6 @@
if(APPLE OR WIN32)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
# set the build directory for .dylib libraries
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
# the first time CMake configures, save off CMake's built-in flags
if(NOT DEFAULT_DEBUG_FLAGS)
@@ -104,8 +102,9 @@ set(JNI_EXTRA_LIBS ${PM_NEEDED_LIBS} ${JAVA_JVM_LIBRARY})
# this completes the list of library sources by adding shared code
list(APPEND LIBSRC pmutil portmidi)
+if (NOT BUILD_SHARED_LIBS)
# now add the shared files to make the complete list of library sources
-add_library(portmidi-static ${LIBSRC})
+add_library(portmidi-static STATIC ${LIBSRC})
set_target_properties(portmidi-static PROPERTIES OUTPUT_NAME "portmidi_s")
target_link_libraries(portmidi-static ${PM_NEEDED_LIBS})
@@ -118,11 +117,13 @@ target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")
# install the libraries (Linux and Mac OS X command line)
-if(UNIX)
+if(1)
INSTALL(TARGETS portmidi-static pmjni
- LIBRARY DESTINATION /usr/local/lib
- ARCHIVE DESTINATION /usr/local/lib)
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
# .h files installed by pm_dylib/CMakeLists.txt, so don't need them here
-# INSTALL(FILES portmidi.h ../porttime/porttime.h
-# DESTINATION /usr/local/include)
-endif(UNIX)
+ INSTALL(FILES portmidi.h ../porttime/porttime.h
+ DESTINATION include)
+endif(1)
+endif()
diff --git a/portmidi/trunk/pm_common/portmidi.h b/portmidi/trunk/pm_common/portmidi.h
index e07991e..6f48927 100644
--- a/portmidi/trunk/pm_common/portmidi.h
+++ b/portmidi/trunk/pm_common/portmidi.h
@@ -108,6 +108,8 @@ typedef unsigned int uint32_t;
#ifdef _WINDLL
#define PMEXPORT __declspec(dllexport)
+#elif defined _PM_USEDLL
+#define PMEXPORT __declspec(dllimport)
#else
#define PMEXPORT
#endif
diff --git a/portmidi/trunk/pm_dylib/CMakeLists.txt b/portmidi/trunk/pm_dylib/CMakeLists.txt
index f693dd6..69d4d24 100644
--- a/portmidi/trunk/pm_dylib/CMakeLists.txt
+++ b/portmidi/trunk/pm_dylib/CMakeLists.txt
@@ -4,11 +4,8 @@
# portmidi/pm_dylib
if(APPLE OR WIN32)
# set the build directory for .dylib libraries
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
# the "archive" output directory says where to put portmidi.lib, the
# static part of the lib/dll pair:
- set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
# the first time CMake configures, save off CMake's built-in flags
if(NOT DEFAULT_DEBUG_FLAGS)
@@ -113,15 +110,21 @@ set(SHARED_FILES pmutil portmidi)
prepend_path(SHARED_PATHS ../pm_common/ ${SHARED_FILES})
list(APPEND LIBSRC ${SHARED_PATHS})
+if (BUILD_SHARED_LIBS)
add_library(portmidi-dynamic SHARED ${LIBSRC})
set_target_properties(portmidi-dynamic PROPERTIES OUTPUT_NAME "portmidi")
target_link_libraries(portmidi-dynamic ${PM_NEEDED_LIBS})
+if (MSVC)
+ target_compile_definitions(portmidi-dynamic PRIVATE _WINDLL)
+endif()
# install the libraries (Linux and Mac OS X command line)
-if(UNIX)
+if(1)
INSTALL(TARGETS portmidi-dynamic
- LIBRARY DESTINATION /usr/local/lib
- ARCHIVE DESTINATION /usr/local/lib)
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
INSTALL(FILES ../pm_common/portmidi.h ../porttime/porttime.h
- DESTINATION /usr/local/include)
-endif(UNIX)
+ DESTINATION include)
+endif(1)
+endif()

View File

@ -0,0 +1,37 @@
From 7a53214dd18a664eea96c9e9265374195d94a405 Mon Sep 17 00:00:00 2001
From: Be <be@mixxx.org>
Date: Thu, 30 Dec 2021 13:06:58 -0600
Subject: [PATCH] CMake: remove unnecessary macOS stuff
There is no reason for this to be there and it breaks vcpkg.
---
pm_common/CMakeLists.txt | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/pm_common/CMakeLists.txt b/pm_common/CMakeLists.txt
index 990b0e6..63d4fa1 100644
--- a/pm_common/CMakeLists.txt
+++ b/pm_common/CMakeLists.txt
@@ -52,19 +52,6 @@ if(PM_CHECK_ERRORS)
target_compile_definitions(portmidi PRIVATE PM_CHECK_ERRORS)
endif(PM_CHECK_ERRORS)
-
-if(APPLE)
-# set(PM_OSX_VERSION "10.7" CACHE STRING
-# "selects PM_OSX_SDK and macosx-version-min C flag")
- set(PM_OSX_SDK "/Developer/SDKs/MacOSX${PM_OSX_VERSION}.sdk")
- set(CMAKE_OSX_SYSROOT ${PM_OSC_SDK} CACHE
- PATH "-isysroot parameter for compiler")
- set(CMAKE_C_FLAGS "-mmacosx-version-min=${PM_OSC_VERSION}" CACHE
- STRING "needed in conjunction with CMAKE_OSX_SYSROOT" FORCE)
- # option(OSX_RPATH "control CMake policy for finding macOS dynamic libraries"
- # ON) # enabled here to match CMake default. Is this correct?
-endif()
-
macro(prepend_path RESULT PATH)
set(${RESULT})
foreach(FILE ${ARGN})
--
2.33.1

View File

@ -1,35 +1,19 @@
vcpkg_fail_port_install(ON_TARGET "uwp" ON_ARCH "arm")
vcpkg_fail_port_install(ON_TARGET "UWP")
vcpkg_from_sourceforge(
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO portmedia
FILENAME "portmedia-code-r234.zip"
SHA512 cbc332d89bc465450b38245a83cc300dfd2e1e6de7c62284edf754ff4d8a9aa3dc49a395dcee535ed9688befb019186fa87fd6d8a3698898c2acbf3e6b7a0794
PATCHES
fix-build-install.patch
add-feature-options.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/portmidi/trunk"
OPTIONS
-DJAVA_SUPPORT=OFF
-DJAVA_INCLUDE_PATH=
-DJAVA_INCLUDE_PATH2=
-DJAVA_JVM_LIBRARY=
MAYBE_UNUSED_VARIABLES
JAVA_INCLUDE_PATH
JAVA_INCLUDE_PATH2
REPO PortMidi/portmidi
REF v2.0.1
SHA512 2c412e5b2e90fb375fbd14f22adbf31e0f3ca8ffbb421185e58bd2564da7e431395a9b50c4ba9a1330b2b17b08f0f9e31730f3a57bf8cd14210f3128c70c57a3
HEAD_REF master
PATCHES fix-macOS.patch
)
vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")
vcpkg_cmake_install()
if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/portmidi.h"
"#elif defined _PM_USEDLL" "#elif 1"
)
endif()
vcpkg_fixup_pkgconfig()
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(INSTALL "${SOURCE_PATH}/portmidi/trunk/license.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,14 +1,22 @@
{
"name": "portmidi",
"version": "0.234",
"port-version": 3,
"description": "Free, cross-platform, open-source I/O library for MIDI",
"homepage": "https://sourceforge.net/projects/portmedia/",
"supports": "!uwp & !linux",
"version": "2.0.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.",
"homepage": "https://github.com/PortMidi/portmidi",
"license": "MIT",
"supports": "!uwp",
"dependencies": [
{
"name": "alsa",
"platform": "!(windows | osx)"
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -5393,8 +5393,8 @@
"port-version": 2
},
"portmidi": {
"baseline": "0.234",
"port-version": 3
"baseline": "2.0.1",
"port-version": 0
},
"portsmf": {
"baseline": "0.238",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4d58125fb4cf188de9f9485bc5064ae2eaf982c4",
"version": "2.0.1",
"port-version": 0
},
{
"git-tree": "e4d17cd16212900720faf6d5895734341e5b269d",
"version": "0.234",