Skip to content

Commit

Permalink
qcbor: add package (#5017)
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing authored Aug 23, 2024
1 parent ab4786e commit 819d720
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions packages/q/qcbor/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package("qcbor")
set_homepage("https://github.com/laurencelundblade/QCBOR")
set_description("Comprehensive, powerful, commercial-quality CBOR encoder/ decoder that is still suited for small devices.")
set_license("BSD-3-Clause")

add_urls("https://github.com/laurencelundblade/QCBOR/archive/refs/tags/$(version).tar.gz",
"https://github.com/laurencelundblade/QCBOR.git")

add_versions("v1.4.1", "c7ef031b60b23bf8ede47c66c9713982bba2608668b144280a65665bfcc94470")

add_configs("float_hw_use", {description = "Eliminate dependency on FP hardware and FP instructions", default = false, type = "boolean"})
add_configs("float_preferred", {description = "Eliminate support for half-precision and CBOR preferred serialization", default = false, type = "boolean"})
add_configs("float_all", {description = "Eliminate floating-point support completely", default = false, type = "boolean"})

if is_plat("linux", "bsd") then
add_syslinks("m")
end

add_deps("cmake")

on_install(function (package)
local configs = {}
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"))
if package:config("shared") and package:is_plat("windows") then
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
end

table.insert(configs, "-DQCBOR_OPT_DISABLE_FLOAT_HW_USE=" .. (package:config("float_hw_use") and "OFF" or "ON"))
table.insert(configs, "-DQCBOR_OPT_DISABLE_FLOAT_PREFERRED=" .. (package:config("float_preferred") and "OFF" or "ON"))
table.insert(configs, "-DQCBOR_OPT_DISABLE_FLOAT_ALL=" .. (package:config("float_all") and "OFF" or "ON"))
import("package.tools.cmake").install(package, configs)
end)

on_test(function (package)
assert(package:has_cfuncs("QCBOREncode_Init", {includes = "qcbor/qcbor_encode.h"}))
end)

0 comments on commit 819d720

Please sign in to comment.