Skip to content

Commit 228dd16

Browse files
committed
libremidi: allow to let packagers specify how cppwinrt and winmidi headers come into play
1 parent 8675d23 commit 228dd16

4 files changed

Lines changed: 22 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
22
project(libremidi
3-
VERSION 5.2.0
3+
VERSION 5.3.0
44
DESCRIPTION "A cross-platform MIDI library"
55
LANGUAGES C CXX
66
HOMEPAGE_URL "https://github.com/jcelerier/libremidi"
@@ -26,6 +26,11 @@ cmake_dependent_option(LIBREMIDI_NO_WINMIDI "Disable WinMIDI back-end" OFF "WIN3
2626
# if(LINUX) in CMake 3.25
2727
cmake_dependent_option(LIBREMIDI_NO_ALSA "Disable ALSA back-end" OFF "UNIX; NOT APPLE" OFF)
2828
cmake_dependent_option(LIBREMIDI_NO_UDEV "Disable udev support for ALSA" OFF "UNIX; NOT APPLE" OFF)
29+
cmake_dependent_option(LIBREMIDI_DOWNLOAD_CPPWINRT "Download cppwinrt and MIDI2 nupkgs" ON "WIN32" OFF)
30+
31+
# https://github.com/microsoft/MIDI/releases/download/dev-preview-9-namm-4/Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820.nupkg renamed to .zip
32+
cmake_dependent_option(LIBREMIDI_WINMIDI_HEADERS_ZIP "Path to the WinMIDI headers archive" "" "WIN32" "")
33+
2934
option(LIBREMIDI_NO_JACK "Disable JACK back-end" OFF)
3035
option(LIBREMIDI_NO_PIPEWIRE "Disable PipeWire back-end" OFF)
3136
option(LIBREMIDI_NO_NETWORK "Disable Network back-end" OFF)

cmake/libremidi.cppwinrt.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ find_path(CPPWINRT_PATH "winrt/base.h"
4444
${WINSDK_LIST}
4545
)
4646

47-
if(MSVC)
47+
if(MSVC AND LIBREMIDI_DOWNLOAD_CPPWINRT)
4848
if (NOT EXISTS "${CMAKE_WINDOWS_KITS_10_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}.")
4949
message(FATAL_ERROR "Windows SDK not found. Install a Windows SDK and pass it to CMake with e.g. -DCMAKE_GENERATOR_PLATFORM=x64,version=10.0.26100.0 -DCMAKE_SYSTEM_VERSION=10.0.26100.0")
5050
endif()

cmake/libremidi.winmidi.cmake

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@ if(LIBREMIDI_NO_WINMIDI)
22
return()
33
endif()
44

5-
if(NOT EXISTS "${CMAKE_BINARY_DIR}/winmidi-headers.zip")
6-
file(DOWNLOAD
7-
https://github.com/microsoft/MIDI/releases/download/dev-preview-9-namm-4/Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820.nupkg
8-
"${CMAKE_BINARY_DIR}/winmidi-headers.zip"
9-
)
5+
if(LIBREMIDI_DOWNLOAD_CPPWINRT)
6+
if(NOT EXISTS "${CMAKE_BINARY_DIR}/winmidi-headers.zip")
7+
file(DOWNLOAD
8+
https://github.com/microsoft/MIDI/releases/download/dev-preview-9-namm-4/Microsoft.Windows.Devices.Midi2.1.0.2-preview-9.250121-1820.nupkg
9+
"${CMAKE_BINARY_DIR}/winmidi-headers.zip"
10+
)
11+
endif()
12+
set(LIBREMIDI_WINMIDI_HEADERS_ZIP "${CMAKE_BINARY_DIR}/winmidi-headers.zip")
13+
endif()
14+
15+
if(NOT LIBREMIDI_WINMIDI_HEADERS_ZIP)
16+
return()
1017
endif()
1118

1219
file(ARCHIVE_EXTRACT
13-
INPUT "${CMAKE_BINARY_DIR}/winmidi-headers.zip"
20+
INPUT "${LIBREMIDI_WINMIDI_HEADERS_ZIP}"
1421
DESTINATION "${CMAKE_BINARY_DIR}/winmidi-headers/"
1522
)
1623

@@ -19,6 +26,7 @@ file(MAKE_DIRECTORY
1926
)
2027

2128
file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/cppwinrt-winmidi/")
29+
2230
if(CPPWINRT_TOOL)
2331
# Enumerate winmd IDL files and store them in a response file
2432
file(TO_CMAKE_PATH "${CMAKE_WINDOWS_KITS_10_DIR}/References/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}" winsdk)

include/libremidi/config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define LIBREMIDI_EXPORT
1616
#endif
1717

18-
#define LIBREMIDI_VERSION "4.5.0"
18+
#define LIBREMIDI_VERSION "5.3.0"
1919

2020
#if defined(LIBREMIDI_USE_BOOST)
2121
#if !__has_include(<boost/container/small_vector.hpp>)

0 commit comments

Comments
 (0)