Skip to content

Commit

Permalink
libfixmatrix: add package (#5347)
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing committed Sep 27, 2024
1 parent 22625ba commit 0572fb0
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/l/libfixmath/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package("libfixmath")
set_homepage("https://code.google.com/p/libfixmath/")
set_description("Cross Platform Fixed Point Maths Library")
set_license("MIT")

add_urls("https://github.com/PetteriAimonen/libfixmath.git")

add_versions("2023.08.06", "d308e466e1a09118d03f677c52e5fbf402f6fdd0")

on_install(function (package)
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
set_languages("c++11")
target("fixmath")
set_kind("$(kind)")
add_files("libfixmath/*.c")
add_headerfiles("(libfixmath/*.h)", "(libfixmath/*.hpp)")
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all")
end
]])
import("package.tools.xmake").install(package)
end)

on_test(function (package)
assert(package:has_cfuncs("uint32_log2", {includes = "libfixmath/uint32.h"}))
end)
35 changes: 35 additions & 0 deletions packages/l/libfixmatrix/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package("libfixmatrix")
set_homepage("https://github.com/PetteriAimonen/libfixmatrix")
set_description("C library for fixed point matrix, quaternion and vector calculations")
set_license("MIT")

add_urls("https://github.com/PetteriAimonen/libfixmatrix.git")

add_versions("2014.01.17", "a8d583e4fe1fa27ba2e0ec55970f73a1b1e6928b")

add_deps("libfixmath")

on_install(function (package)
for _, file in ipairs(os.files("*.h")) do
io.replace(file, "fix16.h", "libfixmath/fix16.h", {plain = true})
end

io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
add_requires("libfixmath")
set_languages("c++11")
target("fixmatrix")
set_kind("$(kind)")
add_files("*.c|*_unittests.c")
add_headerfiles("*.h|unittests.h", {prefixdir = "libfixmatrix"})
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all")
end
add_packages("libfixmath")
]])
import("package.tools.xmake").install(package)
end)

on_test(function (package)
assert(package:has_cfuncs("mf16_fill", {includes = "libfixmatrix/fixmatrix.h"}))
end)

0 comments on commit 0572fb0

Please sign in to comment.