diff --git a/ports/libopnmidi/fix-c++-standard.patch b/ports/libopnmidi/fix-c++-standard.patch new file mode 100644 index 0000000000..965b6d5c33 --- /dev/null +++ b/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 +- $<$:-Wall -pedantic -std=c90> ++ $<$:-Wall -pedantic -std=gnu90> + $<$:-Wall -pedantic -std=gnu++98> + ) + endif() diff --git a/ports/libopnmidi/portfile.cmake b/ports/libopnmidi/portfile.cmake index 16e15fdc07..a312c7aae7 100644 --- a/ports/libopnmidi/portfile.cmake +++ b/ports/libopnmidi/portfile.cmake @@ -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 diff --git a/ports/libopnmidi/vcpkg.json b/ports/libopnmidi/vcpkg.json index 960d4aac26..1fd91a9ef7 100644 --- a/ports/libopnmidi/vcpkg.json +++ b/ports/libopnmidi/vcpkg.json @@ -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", diff --git a/versions/baseline.json b/versions/baseline.json index 02584686d7..bef9ebf397 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4754,7 +4754,7 @@ }, "libopnmidi": { "baseline": "1.5.1", - "port-version": 1 + "port-version": 2 }, "libopusenc": { "baseline": "0.2.1", diff --git a/versions/l-/libopnmidi.json b/versions/l-/libopnmidi.json index 01b5525a48..c12412d938 100644 --- a/versions/l-/libopnmidi.json +++ b/versions/l-/libopnmidi.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3b11c2e9b745c94c0ed9eb46044a21704dd2e94a", + "version": "1.5.1", + "port-version": 2 + }, { "git-tree": "2451642c9d81eff6810839a5174ca60053330780", "version": "1.5.1",