aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libopnmidi
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libopnmidi
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libopnmidi')
-rw-r--r--vcpkg/ports/libopnmidi/cmake-build-shared-libs-support.patch24
-rw-r--r--vcpkg/ports/libopnmidi/cmake-package-export.patch127
-rw-r--r--vcpkg/ports/libopnmidi/disable-wopn2hpp.patch35
-rw-r--r--vcpkg/ports/libopnmidi/fix-build-without-sequencer.patch49
-rw-r--r--vcpkg/ports/libopnmidi/fix-c++-standard.patch78
-rw-r--r--vcpkg/ports/libopnmidi/fix-pmdwin-emulator-include.patch29
-rw-r--r--vcpkg/ports/libopnmidi/portfile.cmake54
-rw-r--r--vcpkg/ports/libopnmidi/usage4
-rw-r--r--vcpkg/ports/libopnmidi/vcpkg.json60
9 files changed, 460 insertions, 0 deletions
diff --git a/vcpkg/ports/libopnmidi/cmake-build-shared-libs-support.patch b/vcpkg/ports/libopnmidi/cmake-build-shared-libs-support.patch
new file mode 100644
index 0000000..b17a87f
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/cmake-build-shared-libs-support.patch
@@ -0,0 +1,24 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4276e23..1d6ac82 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -120,8 +120,17 @@ if(NOT EMSCRIPTEN
+ AND NOT NINTENDO_WIIU
+ AND NOT NINTENDO_SWITCH
+ AND NOT MSDOS)
+- option(libOPNMIDI_STATIC "Build static library of libOPNMIDI" ON)
+- option(libOPNMIDI_SHARED "Build shared library of libOPNMIDI" OFF)
++ set(libOPNMIDI_STATIC_ENABLED_BY_DEFAULT ON)
++ set(libOPNMIDI_SHARED_ENABLED_BY_DEFAULT OFF)
++
++ # When defined, respect CMake's BUILD_SHARED_LIBS setting
++ if (BUILD_SHARED_LIBS)
++ set(libOPNMIDI_SHARED_ENABLED_BY_DEFAULT ON)
++ set(libOPNMIDI_STATIC_ENABLED_BY_DEFAULT OFF)
++ endif()
++
++ option(libOPNMIDI_STATIC "Build static library of libOPNMIDI" ${libOPNMIDI_STATIC_ENABLED_BY_DEFAULT})
++ option(libOPNMIDI_SHARED "Build shared library of libOPNMIDI" ${libOPNMIDI_SHARED_ENABLED_BY_DEFAULT})
+ else()
+ set(libOPNMIDI_STATIC ON)
+ set(libOPNMIDI_SHARED OFF)
diff --git a/vcpkg/ports/libopnmidi/cmake-package-export.patch b/vcpkg/ports/libopnmidi/cmake-package-export.patch
new file mode 100644
index 0000000..3a5eb34
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/cmake-package-export.patch
@@ -0,0 +1,127 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 66d4848..4276e23 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -155,8 +155,6 @@ if(WIN32)
+ option(WITH_WINMMDRV "Build a WinMM MIDI driver" OFF)
+ endif()
+
+-set(libOPNMIDI_INSTALLS)
+-
+ include_directories(${libOPNMIDI_SOURCE_DIR}/include)
+ include_directories(${libOPNMIDI_SOURCE_DIR}/src/)
+ link_directories(${libOPNMIDI_BINARY_DIR}/)
+@@ -317,10 +315,9 @@ if(libOPNMIDI_STATIC OR WITH_VLC_PLUGIN)
+ else()
+ set_target_properties(OPNMIDI_static PROPERTIES OUTPUT_NAME OPNMIDI)
+ endif()
+- target_include_directories(OPNMIDI_static PUBLIC ${libOPNMIDI_SOURCE_DIR}/include)
++ target_include_directories(OPNMIDI_static PUBLIC $<BUILD_INTERFACE:${libOPNMIDI_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
+ set_legacy_standard(OPNMIDI_static)
+ set_visibility_hidden(OPNMIDI_static)
+- list(APPEND libOPNMIDI_INSTALLS OPNMIDI_static)
+
+ # -fPIC thing
+ if(ENABLE_FPIC)
+@@ -340,10 +337,9 @@ if(libOPNMIDI_SHARED)
+ VERSION ${libOPNMIDI_VERSION}
+ SOVERSION ${libOPNMIDI_VERSION_MAJOR}
+ )
+- target_include_directories(OPNMIDI_shared PUBLIC ${libOPNMIDI_SOURCE_DIR}/include)
++ target_include_directories(OPNMIDI_shared PUBLIC $<BUILD_INTERFACE:${libOPNMIDI_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
+ set_legacy_standard(OPNMIDI_shared)
+ set_visibility_hidden(OPNMIDI_shared)
+- list(APPEND libOPNMIDI_INSTALLS OPNMIDI_shared)
+
+ if(WIN32)
+ target_compile_definitions(OPNMIDI_shared PRIVATE "-DOPNMIDI_BUILD_DLL")
+@@ -416,17 +412,45 @@ if(WITH_HQ_RESAMPLER)
+ endif()
+ endif()
+
+-install(TARGETS ${libOPNMIDI_INSTALLS}
+- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+- INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
++if(libOPNMIDI_STATIC)
++ install(TARGETS OPNMIDI_static
++ EXPORT libOPNMIDIStaticTargets
++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
++
++ install(EXPORT libOPNMIDIStaticTargets
++ FILE libOPNMIDI-static-targets.cmake
++ NAMESPACE libOPNMIDI::
++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libOPNMIDI")
++endif()
++
++if(libOPNMIDI_SHARED)
++ install(TARGETS OPNMIDI_shared
++ EXPORT libOPNMIDISharedTargets
++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
++
++ install(EXPORT libOPNMIDISharedTargets
++ FILE libOPNMIDI-shared-targets.cmake
++ NAMESPACE libOPNMIDI::
++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libOPNMIDI")
++endif()
+
+ install(FILES
+ include/opnmidi.h
+ #include/opnmidi.hpp # WIP
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+
++include(CMakePackageConfigHelpers)
++configure_package_config_file(libOPNMIDIConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/libOPNMIDIConfig.cmake"
++ PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR
++ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libOPNMIDI"
++)
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libOPNMIDIConfig.cmake
++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libOPNMIDI")
++
+ if(WITH_EXTRA_BANKS AND NOT APPLE)
+ file(GLOB WOPN_FILES ${libOPNMIDI_SOURCE_DIR}/fm_banks/*.wopn)
+ install(FILES ${WOPN_FILES}
+diff --git a/libOPNMIDIConfig.cmake.in b/libOPNMIDIConfig.cmake.in
+new file mode 100644
+index 0000000..f292e48
+--- /dev/null
++++ b/libOPNMIDIConfig.cmake.in
+@@ -0,0 +1,33 @@
++include(FeatureSummary)
++set_package_properties(libOPNMIDI PROPERTIES
++ URL "https://github.com/Wohlstand/libOPNMIDI"
++ DESCRIPTION "libOPNMIDI is a free Software MIDI synthesizer library with OPN2 (YM2612) and OPNA (YM2608) emulation"
++)
++
++@PACKAGE_INIT@
++
++if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/libOPNMIDI-shared-targets.cmake")
++ include("${CMAKE_CURRENT_LIST_DIR}/libOPNMIDI-shared-targets.cmake")
++endif()
++if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/libOPNMIDI-static-targets.cmake")
++ include("${CMAKE_CURRENT_LIST_DIR}/libOPNMIDI-static-targets.cmake")
++endif()
++
++if(TARGET libOPNMIDI::OPNMIDI_shared)
++ if(CMAKE_VERSION VERSION_LESS "3.18")
++ add_library(libOPNMIDI::OPNMIDI_IF INTERFACE IMPORTED)
++ set_target_properties(libOPNMIDI::OPNMIDI_IF PROPERTIES INTERFACE_LINK_LIBRARIES "libOPNMIDI::OPNMIDI_shared")
++ else()
++ add_library(libOPNMIDI::OPNMIDI_IF ALIAS libOPNMIDI::OPNMIDI_shared)
++ endif()
++else()
++ if(CMAKE_VERSION VERSION_LESS "3.18")
++ add_library(libOPNMIDI::OPNMIDI_IF INTERFACE IMPORTED)
++ set_target_properties(libOPNMIDI::OPNMIDI_IF PROPERTIES INTERFACE_LINK_LIBRARIES "libOPNMIDI::OPNMIDI_static")
++ add_library(libOPNMIDI::OPNMIDI_IF_STATIC INTERFACE IMPORTED)
++ set_target_properties(libOPNMIDI::OPNMIDI_IF_STATIC PROPERTIES INTERFACE_LINK_LIBRARIES "libOPNMIDI::OPNMIDI_static")
++ else()
++ add_library(libOPNMIDI::OPNMIDI_IF ALIAS libOPNMIDI::OPNMIDI_static)
++ add_library(libOPNMIDI::OPNMIDI_IF_STATIC ALIAS libOPNMIDI::OPNMIDI_static)
++ endif()
++endif()
diff --git a/vcpkg/ports/libopnmidi/disable-wopn2hpp.patch b/vcpkg/ports/libopnmidi/disable-wopn2hpp.patch
new file mode 100644
index 0000000..b448049
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/disable-wopn2hpp.patch
@@ -0,0 +1,35 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ee71863..66d4848 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -144,6 +144,7 @@ option(USE_VGM_FILE_DUMPER "Use VGM File Dumper (required to build the MIDI2VGM
+
+ option(WITH_MIDIPLAY "Build also demo MIDI player" OFF)
+ option(WITH_MIDI2VGM "Build also MIDI to VGM converter tool" OFF)
++option(WITH_WOPN2HPP "Build also the WOPN to C++ header source converter tool" OFF)
+ option(WITH_VLC_PLUGIN "Build also a plugin for VLC Media Player" OFF)
+ option(VLC_PLUGIN_NOINSTALL "Don't install VLC plugin into VLC directory" OFF)
+ option(WITH_DAC_UTIL "Build also OPN2 DAC testing utility" OFF)
+@@ -388,13 +389,7 @@ if(WITH_MIDI2VGM)
+ add_subdirectory(utils/midi2vgm)
+ endif()
+
+-if(NOT ANDROID
+- AND NOT EMSCRIPTEN
+- AND NOT VITA
+- AND NOT NINTENDO_3DS
+- AND NOT NINTENDO_WII
+- AND NOT NINTENDO_WIIU
+- AND NOT NINTENDO_SWITCH)
++if(WITH_WOPN2HPP)
+ add_subdirectory(utils/wopn2hpp)
+ endif()
+
+@@ -493,6 +488,7 @@ message("USE_VGM_FILE_DUMPER = ${USE_VGM_FILE_DUMPER}")
+
+ message("===== Utils and extras =====")
+ message("WITH_MIDIPLAY = ${WITH_MIDIPLAY}")
++message("WITH_WOPN2HPP = ${WITH_WOPN2HPP}")
+ message("WITH_VLC_PLUGIN = ${WITH_VLC_PLUGIN}")
+ message("WITH_DAC_UTIL = ${WITH_DAC_UTIL}")
+ if(WIN32)
diff --git a/vcpkg/ports/libopnmidi/fix-build-without-sequencer.patch b/vcpkg/ports/libopnmidi/fix-build-without-sequencer.patch
new file mode 100644
index 0000000..e10809b
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/fix-build-without-sequencer.patch
@@ -0,0 +1,49 @@
+diff --git a/src/opnmidi.cpp b/src/opnmidi.cpp
+index c70197f..98226dc 100644
+--- a/src/opnmidi.cpp
++++ b/src/opnmidi.cpp
+@@ -433,7 +433,7 @@ OPNMIDI_EXPORT void opn2_setLoopCount(OPN2_MIDIPlayer *device, int loopCount)
+
+ OPNMIDI_EXPORT void opn2_setLoopHooksOnly(OPN2_MIDIPlayer *device, int loopHooksOnly)
+ {
+-#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
++#ifndef OPNMIDI_DISABLE_MIDI_SEQUENCER
+ if(!device)
+ return;
+ MidiPlayer *play = GET_MIDI_PLAYER(device);
+@@ -576,7 +576,7 @@ OPNMIDI_EXPORT int opn2_openData(OPN2_MIDIPlayer *device, const void *mem, unsig
+
+ OPNMIDI_EXPORT void opn2_selectSongNum(struct OPN2_MIDIPlayer *device, int songNumber)
+ {
+-#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
++#ifndef OPNMIDI_DISABLE_MIDI_SEQUENCER
+ if(!device)
+ return;
+
+@@ -591,7 +591,7 @@ OPNMIDI_EXPORT void opn2_selectSongNum(struct OPN2_MIDIPlayer *device, int songN
+
+ OPNMIDI_EXPORT int opn2_getSongsCount(struct OPN2_MIDIPlayer *device)
+ {
+-#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
++#ifndef OPNMIDI_DISABLE_MIDI_SEQUENCER
+ if(!device)
+ return 0;
+
+@@ -986,7 +986,7 @@ OPNMIDI_EXPORT void opn2_setLoopStartHook(struct OPN2_MIDIPlayer *device, OPN2_L
+ assert(play);
+ play->hooks.onLoopStart = loopStartHook;
+ play->hooks.onLoopStart_userData = userData;
+-#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
++#ifndef OPNMIDI_DISABLE_MIDI_SEQUENCER
+ play->m_sequencerInterface->onloopStart = loopStartHook;
+ play->m_sequencerInterface->onloopStart_userData = userData;
+ #endif
+@@ -1001,7 +1001,7 @@ OPNMIDI_EXPORT void opn2_setLoopEndHook(struct OPN2_MIDIPlayer *device, OPN2_Loo
+ assert(play);
+ play->hooks.onLoopEnd = loopEndHook;
+ play->hooks.onLoopEnd_userData = userData;
+-#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
++#ifndef OPNMIDI_DISABLE_MIDI_SEQUENCER
+ play->m_sequencerInterface->onloopEnd = loopEndHook;
+ play->m_sequencerInterface->onloopEnd_userData = userData;
+ #endif
diff --git a/vcpkg/ports/libopnmidi/fix-c++-standard.patch b/vcpkg/ports/libopnmidi/fix-c++-standard.patch
new file mode 100644
index 0000000..965b6d5
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/fix-c++-standard.patch
@@ -0,0 +1,78 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 20e167d..93885c3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,13 +1,35 @@
+-cmake_minimum_required (VERSION 3.2)
++cmake_minimum_required (VERSION 3.2...3.5)
+ project(libOPNMIDI VERSION 1.5.1 LANGUAGES C CXX)
+
+ include(GNUInstallDirs)
++include(CheckCXXCompilerFlag)
+
+ # Prefer C90 standard
+ set(CMAKE_C_STANDARD 90)
+ # Prefer C++98 standard
+ set(CMAKE_CXX_STANDARD 98)
+
++if(MSVC)
++ check_cxx_compiler_flag("/std:c++14" COMPILER_SUPPORTS_CXX14)
++ if(COMPILER_SUPPORTS_CXX14)
++ set(FLAG_CPP14 "/std:c++14")
++ endif()
++ if(MSVC_VERSION LESS 1910)
++ unset(COMPILER_SUPPORTS_CXX14) # MSVC older than 2017 fails to build YMFM
++ endif()
++else()
++ check_cxx_compiler_flag("-std=c++14" COMPILER_SUPPORTS_CXX14)
++ if(COMPILER_SUPPORTS_CXX14)
++ set(FLAG_CPP14 "-std=c++14")
++ endif()
++endif()
++
++if(COMPILER_SUPPORTS_CXX14)
++ message("== Your C++ compiler supports C++14, YMFM emulator will be ENABLED")
++else()
++ message("== Your C++ compiler does NOT supports C++14, YMFM emulator will be DISABLED")
++endif()
++
+ if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+ endif()
+@@ -59,13 +81,24 @@ if(NOT MSVC AND NOT MSDOS)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVITA -DVITA=1 -fcompare-debug-second")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVITA -DVITA=1 -fcompare-debug-second")
+ endif()
++ if(NINTENDO_3DS OR NINTENDO_WII OR NINTENDO_WIIU OR NINTENDO_SWITCH)
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcompare-debug-second")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcompare-debug-second")
++ endif()
+ endif()
+
+-if(NOT CMAKE_BUILD_TYPE)
+- set(CMAKE_BUILD_TYPE "Release")
++if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
++ if(NINTENDO_3DS OR NINTENDO_WII OR NINTENDO_WIIU OR NINTENDO_SWITCH)
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")
++ else()
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89")
++ endif()
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
+ endif()
+
+-string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
++if(DEFINED CMAKE_BUILD_TYPE)
++ string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
++endif()
+ if(CMAKE_BUILD_TYPE_LOWER EQUAL "release")
+ add_definitions(-DNDEBUG)
+ ENDIF()
+@@ -88,7 +121,7 @@ function(set_legacy_standard destTarget)
+ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+ # Turn on warnings and legacy C/C++ standards to support more compilers
+ target_compile_options(${destTarget} PRIVATE
+- $<$<COMPILE_LANGUAGE:C>:-Wall -pedantic -std=c90>
++ $<$<COMPILE_LANGUAGE:C>:-Wall -pedantic -std=gnu90>
+ $<$<COMPILE_LANGUAGE:CXX>:-Wall -pedantic -std=gnu++98>
+ )
+ endif()
diff --git a/vcpkg/ports/libopnmidi/fix-pmdwin-emulator-include.patch b/vcpkg/ports/libopnmidi/fix-pmdwin-emulator-include.patch
new file mode 100644
index 0000000..f01ae30
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/fix-pmdwin-emulator-include.patch
@@ -0,0 +1,29 @@
+diff --git a/src/chips/pmdwin/opna.c b/src/chips/pmdwin/opna.c
+index 3dbf164..78b88a5 100644
+--- a/src/chips/pmdwin/opna.c
++++ b/src/chips/pmdwin/opna.c
+@@ -27,7 +27,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+ #include <stdint.h>
+ #include <stdarg.h>
+ #include <math.h>
+-#include <unistd.h>
+ #include <assert.h>
+ #include "op.h"
+ #include "psg.h"
+diff --git a/src/chips/pmdwin/psg.c b/src/chips/pmdwin/psg.c
+index 44a7cf0..a1b1c43 100644
+--- a/src/chips/pmdwin/psg.c
++++ b/src/chips/pmdwin/psg.c
+@@ -39,7 +39,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+ #include <stdlib.h>
+ #include <string.h>
+ #include <math.h>
+-#include <unistd.h>
+ #include "op.h"
+ #include "psg.h"
+
+@@ -340,4 +339,3 @@ void PSGMix(PSG *psg, int32_t *dest, uint32_t nsamples)
+ }
+ }
+ }
+-
diff --git a/vcpkg/ports/libopnmidi/portfile.cmake b/vcpkg/ports/libopnmidi/portfile.cmake
new file mode 100644
index 0000000..a312c7a
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/portfile.cmake
@@ -0,0 +1,54 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Wohlstand/libOPNMIDI
+ REF "v${VERSION}"
+ SHA512 735af8c65c54e1e57e9d3e8582465636c0efeb7a03c7b0f5e2ef16f5cfd14fb34e99f738bb5a5cb43fe44fc584c3241eee6ae21a0f604702f101442f42601bcd
+ PATCHES
+ # patches from master, they should be removed when a new version is out
+ cmake-package-export.patch
+ cmake-build-shared-libs-support.patch
+ disable-wopn2hpp.patch
+ fix-build-without-sequencer.patch
+ fix-pmdwin-emulator-include.patch
+ fix-c++-standard.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ midi-sequencer WITH_MIDI_SEQUENCER
+ mame-ym2612-emulator USE_MAME_EMULATOR
+ mame-ym2608-emulator USE_MAME_2608_EMULATOR
+ nuked-emulator USE_NUKED_EMULATOR
+ gens-emulator USE_GENS_EMULATOR
+ gx-emulator USE_GX_EMULATOR
+ np2-emulator USE_NP2_EMULATOR
+ pmdwin-emulator USE_PMDWIN_EMULATOR
+ mus WITH_MUS_SUPPORT
+ xmi WITH_XMI_SUPPORT
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DUSE_VGM_FILE_DUMPER=OFF
+ -DWITH_WOPN2HPP=OFF
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libOPNMIDI)
+
+vcpkg_fixup_pkgconfig()
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/share/doc"
+)
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+
+file(GLOB LICENSE_FILES "${SOURCE_PATH}/LICENSE*")
+vcpkg_install_copyright(FILE_LIST ${LICENSE_FILES})
diff --git a/vcpkg/ports/libopnmidi/usage b/vcpkg/ports/libopnmidi/usage
new file mode 100644
index 0000000..a6c15bb
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/usage
@@ -0,0 +1,4 @@
+libopnmidi provides CMake targets:
+
+ find_package(libOPNMIDI CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE libOPNMIDI::OPNMIDI_IF)
diff --git a/vcpkg/ports/libopnmidi/vcpkg.json b/vcpkg/ports/libopnmidi/vcpkg.json
new file mode 100644
index 0000000..1fd91a9
--- /dev/null
+++ b/vcpkg/ports/libopnmidi/vcpkg.json
@@ -0,0 +1,60 @@
+{
+ "name": "libopnmidi",
+ "version": "1.5.1",
+ "port-version": 2,
+ "description": "libOPNMIDI is a free Software MIDI synthesizer library with OPN2 (YM2612) and OPNA (YM2608) emulation",
+ "homepage": "https://github.com/Wohlstand/libOPNMIDI",
+ "license": "LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "gens-emulator",
+ "mame-ym2608-emulator",
+ "mame-ym2612-emulator",
+ "midi-sequencer",
+ "mus",
+ "np2-emulator",
+ "nuked-emulator",
+ "xmi"
+ ],
+ "features": {
+ "gens-emulator": {
+ "description": "Build with GENS 2.10 emulator (innacurate, fastest)"
+ },
+ "gx-emulator": {
+ "description": "Build with Genesis Plus GX emulator (experimental)"
+ },
+ "mame-ym2608-emulator": {
+ "description": "Build with MAME YM2608 emulator (well-accurate and fast)"
+ },
+ "mame-ym2612-emulator": {
+ "description": "Build with MAME YM2612 emulator (well-accurate and fast)"
+ },
+ "midi-sequencer": {
+ "description": "Build with embedded MIDI sequencer"
+ },
+ "mus": {
+ "description": "Support for DMX MUS files"
+ },
+ "np2-emulator": {
+ "description": "Build with Neko Project 2 YM2608 emulator (semi-accurate and fast)"
+ },
+ "nuked-emulator": {
+ "description": "Build with Nuked OPN2 emulator (very accurate, needs more CPU power)"
+ },
+ "pmdwin-emulator": {
+ "description": "Build with PMDWin emulator (experimental)"
+ },
+ "xmi": {
+ "description": "Support for AIL XMI files"
+ }
+ }
+}