vcpkg/ports/libopnmidi/portfile.cmake
jim wang 4af63c6f3e
[libopnmidi] Fix compilation errors under Linux (#38410)
Fix one of https://github.com/microsoft/vcpkg/issues/32398 issue.
The following error occurs when installing
`libopnmidi[core,pmdwin-emulator,gens-emulator]:x64-linux`.
```
/mnt/vcpkg/buildtrees/libopnmidi/src/v1.5.1-f0b18d03a5.clean/src/chips/pmdwin/op.h:36:8: error: unknown type name ‘inline’
   36 | static inline int16_t Limit16(int a)
```
The upstream author has fixed this issue in this
[commit](2324ff2e34).
However, the upstream has not released a new version for the time being,
so we fixed the issue through patches.

- [X] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] ~~SHA512s are updated for each updated download.~~
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version.~~
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [X] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [X] Only one version is added to each modified port's versions file.

Usage test pass with following triplets:

```
x64-windows
x64-linux
```
2024-04-30 11:33:24 -07:00

55 lines
1.8 KiB
CMake

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})