From fc5830f33d7e9872895d3f056c5bb87ef7a08823 Mon Sep 17 00:00:00 2001 From: star9029 Date: Fri, 18 Aug 2023 23:34:17 +0800 Subject: [PATCH 1/4] rtmidi: add package --- packages/r/rtmidi/xmake.lua | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 packages/r/rtmidi/xmake.lua diff --git a/packages/r/rtmidi/xmake.lua b/packages/r/rtmidi/xmake.lua new file mode 100644 index 00000000000..a197de4e771 --- /dev/null +++ b/packages/r/rtmidi/xmake.lua @@ -0,0 +1,38 @@ +package("rtmidi") + set_homepage("https://github.com/thestk/rtmidi") + set_description("A set of C++ classes that provide a common API for realtime MIDI input/output across Linux (ALSA & JACK), Macintosh OS X (CoreMIDI) and Windows (Multimedia)") + + add_urls("https://github.com/thestk/rtmidi/archive/refs/tags/$(version).tar.gz", + "https://github.com/thestk/rtmidi.git") + + add_versions("6.0.0", "ef7bcda27fee6936b651c29ebe9544c74959d0b1583b716ce80a1c6fea7617f0") + + if is_plat("windows", "mingw") then + add_syslinks("winmm") + elseif is_plat("macosx") then + add_frameworks("CoreFoundation", "CoreMIDI", "CoreAudio", "CoreServices") + elseif is_plat("linux", "bsd") then + add_syslinks("pthread") + end + + add_deps("cmake") + + on_install(function (package) + local configs = {"-DRTMIDI_BUILD_TESTING=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + void test() { + try { + RtMidiIn midiin; + } catch (RtMidiError &error) { + error.printMessage(); + } + } + ]]}, {configs = {languages = "c++11"}})) + end) From 2f6741802658f550dadcd3e51090f283c744edbb Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 19 Aug 2023 09:25:39 +0800 Subject: [PATCH 2/4] fix syslinks --- packages/r/rtmidi/xmake.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/r/rtmidi/xmake.lua b/packages/r/rtmidi/xmake.lua index a197de4e771..e0a30407477 100644 --- a/packages/r/rtmidi/xmake.lua +++ b/packages/r/rtmidi/xmake.lua @@ -11,8 +11,12 @@ package("rtmidi") add_syslinks("winmm") elseif is_plat("macosx") then add_frameworks("CoreFoundation", "CoreMIDI", "CoreAudio", "CoreServices") + elseif is_plat("iphoneos") then + add_frameworks("CoreMIDI") elseif is_plat("linux", "bsd") then add_syslinks("pthread") + elseif is_plat("android") then + add_syslinks("amidi") end add_deps("cmake") From 66fb3a2d77eae5a563409cd9c7f4481138ef33f5 Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 19 Aug 2023 09:38:19 +0800 Subject: [PATCH 3/4] fix syslinks --- packages/r/rtmidi/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/r/rtmidi/xmake.lua b/packages/r/rtmidi/xmake.lua index e0a30407477..59a302556c2 100644 --- a/packages/r/rtmidi/xmake.lua +++ b/packages/r/rtmidi/xmake.lua @@ -16,7 +16,7 @@ package("rtmidi") elseif is_plat("linux", "bsd") then add_syslinks("pthread") elseif is_plat("android") then - add_syslinks("amidi") + add_syslinks("amidi", "jvm") end add_deps("cmake") From 74cb9ce574afb7ea2407a185937c242c35a1aa1c Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 19 Aug 2023 22:15:12 +0800 Subject: [PATCH 4/4] disable plat --- packages/r/rtmidi/xmake.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/r/rtmidi/xmake.lua b/packages/r/rtmidi/xmake.lua index 59a302556c2..4208194a00a 100644 --- a/packages/r/rtmidi/xmake.lua +++ b/packages/r/rtmidi/xmake.lua @@ -16,12 +16,12 @@ package("rtmidi") elseif is_plat("linux", "bsd") then add_syslinks("pthread") elseif is_plat("android") then - add_syslinks("amidi", "jvm") + add_syslinks("amidi") end add_deps("cmake") - on_install(function (package) + on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "iphoneos", "cross", "wasm", function (package) local configs = {"-DRTMIDI_BUILD_TESTING=OFF"} table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))