Skip to content

Commit

Permalink
aravis: add package (#5221)
Browse files Browse the repository at this point in the history
* aravis: add package

* disable cross-compilation
  • Loading branch information
star-hengxing authored Sep 13, 2024
1 parent 457fda2 commit 2524cc6
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions packages/a/aravis/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package("aravis")
set_homepage("https://github.com/AravisProject/aravis")
set_description("A vision library for genicam based cameras")
set_license("LGPL-2.1")

add_urls("https://github.com/AravisProject/aravis.git")
add_urls("https://github.com/AravisProject/aravis/releases/download/$(version)/aravis-$(version).tar.xz", {alias = "release"})
add_urls("https://github.com/AravisProject/aravis/archive/refs/tags/$(version).tar.gz", {alias = "github"})

add_versions("release:0.8.33", "3c4409a12ea70bba4de25e5b08c777112de854bc801896594f2cb6f8c2bd6fbc")

add_versions("github:0.8.33", "d70b125666b23ca4c0f8986fa0786a3d2b9efb7a56b558b703083cdfaa793f4e")

add_configs("gst_plugin", {description = "Build GStreamer plugin", default = false, type = "boolean"})
add_configs("usb", {description = "Enable USB support", default = false, type = "boolean"})
add_configs("packet_socket", {description = "Enable packet socket support", default = false, type = "boolean"})
add_configs("introspection", {description = "Enable packet socket support", default = false, type = "boolean"})

if is_plat("windows") then
add_syslinks("ws2_32", "iphlpapi")
elseif is_plat("linux", "bsd") then
add_syslinks("dl", "pthread", "m", "resolv")
end

add_deps("meson", "ninja")
if is_plat("windows") then
add_deps("pkgconf")
else
add_deps("pkg-config")
end
add_deps("glib", "libxml2", "zlib")

on_load(function (package)
if package:config("gst_plugin") then
package:add("deps", "gstreamer")
end
if package:config("usb") then
package:add("deps", "libusb")
end

local version = package:version()
assert(version, "require version to set includedirs")
package:add("includedirs", "include", format("include/aravis-%d.%d", version:major(), version:minor()))
end)

on_install("windows|native", "macosx|native", "linux|native", function (package)
-- patch xrepo package name to find .pc
local libusb = package:dep("libusb")
if libusb and not libusb:is_system() then
io.replace("meson.build", "libusb-1.0", "libusb", {plain = true})
end
local libxml2 = package:dep("libxml2")
if not libxml2:is_system() then
io.replace("meson.build", "libxml-2.0", "libxml2", {plain = true})
end

local configs = {"-Dviewer=disabled", "-Dtests=false"}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
table.insert(configs, "-Dgst-plugin=" .. (package:config("gst_plugin") and "enabled" or "disabled"))
table.insert(configs, "-Dusb=" .. (package:config("usb") and "enabled" or "disabled"))
table.insert(configs, "-Dpacket-socket=" .. (package:config("packet_socket") and "enabled" or "disabled"))
table.insert(configs, "-Dintrospection=" .. (package:config("introspection") and "enabled" or "disabled"))
import("package.tools.meson").install(package, configs, {packagedeps = {"libintl", "libiconv"}})
end)

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

0 comments on commit 2524cc6

Please sign in to comment.