xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package("soundtouch")
  2. set_homepage("https://modplug-xmms.sourceforge.net")
  3. set_description("SoundTouch Audio Processing Library")
  4. set_license("LGPL-2.1")
  5. add_urls("https://www.surina.net/soundtouch/soundtouch-$(version).tar.gz",
  6. "https://codeberg.org/soundtouch/soundtouch.git")
  7. add_versions("2.3.2", "3bde8ddbbc3661f04e151f72cf21ca9d8f8c88e265833b65935b8962d12d6b08")
  8. add_configs("integers_samples", {description = "Use integers instead of floats for samples", default = false, type = "boolean"})
  9. if is_arch("arm.*") then
  10. add_configs("neon", {description = "Use ARM Neon SIMD instructions if in ARM CPU", default = true, type = "boolean"})
  11. end
  12. add_configs("openmp", {description = "Use parallel multicore calculation through OpenMP", default = false, type = "boolean"})
  13. add_configs("dll", {description = "Build SoundTouchDLL C wrapper library", default = false, type = "boolean"})
  14. add_deps("cmake")
  15. on_install(function (package)
  16. local configs = {"-DSOUNDSTRETCH=OFF"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. table.insert(configs, "-DINTEGER_SAMPLES=" .. (package:config("integers_samples") and "ON" or "OFF"))
  20. table.insert(configs, "-DSOUNDTOUCH_DLL=" .. (package:config("dll") and "ON" or "OFF"))
  21. table.insert(configs, "-DOPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
  22. if package:is_arch("arm.*") then
  23. table.insert(configs, "-DNEON=" .. (package:config("neon") and "ON" or "OFF"))
  24. elseif package:is_plat("wasm") then
  25. io.replace("CMakeLists.txt", "-Ofast", "", {plain = true})
  26. end
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. #include <soundtouch/SoundTouch.h>
  32. void test() {
  33. soundtouch::SoundTouch sound;
  34. }
  35. ]]}))
  36. end)