Skip to content

Commit

Permalink
new port pffft (#6058)
Browse files Browse the repository at this point in the history
* init

* revise url

* check nosimd

* revise adding files

* check simd support

* fmt

* fixup option

* add_options("simd")

* Update xmake.lua

* Update xmake.lua

* revise urls, ver

* revise versioning

* revise versioning

---------

Co-authored-by: ruki <[email protected]>
  • Loading branch information
luadebug and waruqi authored Dec 27, 2024
1 parent 86c14bb commit c77e894
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/p/pffft/port/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
add_rules("mode.debug", "mode.release")

option("simd", {default = true, description = "Build with simd"})

target("pffft")
set_kind("$(kind)")
if not has_config("simd") then
add_defines("PFFFT_SIMD_DISABLE")
end
if is_kind("shared") and is_plat("windows") then
add_rules("utils.symbols.export_all")
end
add_files("fftpack.c", "pffft.c")
add_headerfiles("fftpack.h", "pffft.h")
if not is_plat("windows") then
add_syslinks("m")
else
add_defines("_USE_MATH_DEFINES", {public = true})
end
31 changes: 31 additions & 0 deletions packages/p/pffft/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package("pffft")

set_homepage("https://bitbucket.org/jpommier/pffft/")
set_description("PFFFT, a pretty fast Fourier Transform.")
set_license("BSD-like (FFTPACK license)")

add_urls("https://bitbucket.org/jpommier/pffft/$(version)", {version = function (version)
local hash = "02fe7715a5bf8bfd914681c53429600f94e0f536"
if version:le("2024.11.29") then
hash = "02fe7715a5bf8bfd914681c53429600f94e0f536"
end
return "get/" .. hash .. ".tar.gz"
end})
add_versions("2024.11.29", "9adeb18ac7bb52e9fb921c31c0c6a4e9ae150cc6fcb20a899d4b3a2275176ded")

add_configs("simd", {description = "Build with SIMD support.", default = true, type = "boolean"})

if not is_plat("windows") then
add_syslinks("m")
end

on_install(function (package)
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
local configs = {}
configs.simd = package:config("simd")
import("package.tools.xmake").install(package, configs)
end)

on_test(function (package)
assert(package:has_cfuncs("pffft_simd_size", {includes = "pffft.h"}))
end)

0 comments on commit c77e894

Please sign in to comment.