|
| 1 | +package("qcbor") |
| 2 | + set_homepage("https://github.com/laurencelundblade/QCBOR") |
| 3 | + set_description("Comprehensive, powerful, commercial-quality CBOR encoder/ decoder that is still suited for small devices.") |
| 4 | + set_license("BSD-3-Clause") |
| 5 | + |
| 6 | + add_urls("https://github.com/laurencelundblade/QCBOR/archive/refs/tags/$(version).tar.gz", |
| 7 | + "https://github.com/laurencelundblade/QCBOR.git") |
| 8 | + |
| 9 | + add_versions("v1.4.1", "c7ef031b60b23bf8ede47c66c9713982bba2608668b144280a65665bfcc94470") |
| 10 | + |
| 11 | + add_configs("float_hw_use", {description = "Eliminate dependency on FP hardware and FP instructions", default = false, type = "boolean"}) |
| 12 | + add_configs("float_preferred", {description = "Eliminate support for half-precision and CBOR preferred serialization", default = false, type = "boolean"}) |
| 13 | + add_configs("float_all", {description = "Eliminate floating-point support completely", default = false, type = "boolean"}) |
| 14 | + |
| 15 | + if is_plat("linux", "bsd") then |
| 16 | + add_syslinks("m") |
| 17 | + end |
| 18 | + |
| 19 | + add_deps("cmake") |
| 20 | + |
| 21 | + on_install(function (package) |
| 22 | + local configs = {} |
| 23 | + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) |
| 24 | + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
| 25 | + if package:config("shared") and package:is_plat("windows") then |
| 26 | + table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON") |
| 27 | + end |
| 28 | + |
| 29 | + table.insert(configs, "-DQCBOR_OPT_DISABLE_FLOAT_HW_USE=" .. (package:config("float_hw_use") and "OFF" or "ON")) |
| 30 | + table.insert(configs, "-DQCBOR_OPT_DISABLE_FLOAT_PREFERRED=" .. (package:config("float_preferred") and "OFF" or "ON")) |
| 31 | + table.insert(configs, "-DQCBOR_OPT_DISABLE_FLOAT_ALL=" .. (package:config("float_all") and "OFF" or "ON")) |
| 32 | + import("package.tools.cmake").install(package, configs) |
| 33 | + end) |
| 34 | + |
| 35 | + on_test(function (package) |
| 36 | + assert(package:has_cfuncs("QCBOREncode_Init", {includes = "qcbor/qcbor_encode.h"})) |
| 37 | + end) |
0 commit comments