mirror of https://github.com/microsoft/vcpkg.git
[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
```
This commit is contained in:
parent
ce00eb980a
commit
4af63c6f3e
|
|
@ -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()
|
||||
|
|
@ -10,6 +10,7 @@ vcpkg_from_github(
|
|||
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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "libopnmidi",
|
||||
"version": "1.5.1",
|
||||
"port-version": 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",
|
||||
|
|
|
|||
|
|
@ -4754,7 +4754,7 @@
|
|||
},
|
||||
"libopnmidi": {
|
||||
"baseline": "1.5.1",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"libopusenc": {
|
||||
"baseline": "0.2.1",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "3b11c2e9b745c94c0ed9eb46044a21704dd2e94a",
|
||||
"version": "1.5.1",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "2451642c9d81eff6810839a5174ca60053330780",
|
||||
"version": "1.5.1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue