fix compilation error of rtmidi under linux when libasound is installed (#2661)

* fix compilation error under linux

* clean code style

* adjust again

* revert some change
pull/2664/head
Yiheng Wu 2 years ago committed by GitHub
parent 07f9c9b2c9
commit ba6722056a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      packages/r/rtmidi/xmake.lua

@ -7,6 +7,13 @@ package("rtmidi")
add_versions("6.0.0", "ef7bcda27fee6936b651c29ebe9544c74959d0b1583b716ce80a1c6fea7617f0")
if is_plat("linux") then
add_configs("alsa", {default = false, description = "Use alsa api on linux.", type = "boolean"})
end
if is_plat("linux", "macosx", "bsd") then
add_configs("jack", {default = false, description = "Use jack api on posix.", type = "boolean"})
end
if is_plat("windows", "mingw") then
add_syslinks("winmm")
elseif is_plat("macosx") then
@ -21,8 +28,19 @@ package("rtmidi")
add_deps("cmake")
on_load("linux", "macosx", "bsd", function(package)
if package:config("alsa") then
package:add("syslinks", "asound")
end
if package:config("jack") then
package:add("syslinks", "jack")
end
end)
on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "iphoneos", "cross", "wasm", function (package)
local configs = {"-DRTMIDI_BUILD_TESTING=OFF"}
table.insert(configs, "-DRTMIDI_API_ALSA=" .. (package:config("alsa") and "ON" or "OFF"))
table.insert(configs, "-DRTMIDI_API_JACK=" .. (package:config("jack") and "ON" or "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)

Loading…
Cancel
Save