|
|
|
@ -16,6 +16,21 @@ package("vladimirshaleev-ipaddress") |
|
|
|
|
|
|
|
|
|
add_deps("cmake") |
|
|
|
|
|
|
|
|
|
on_load(function (package) |
|
|
|
|
if not package:config("exceptions") then |
|
|
|
|
package:add("defines", "IPADDRESS_NO_EXCEPTIONS") |
|
|
|
|
end |
|
|
|
|
if not package:config("overload_std") then |
|
|
|
|
package:add("defines", "IPADDRESS_NO_OVERLOAD_STD") |
|
|
|
|
end |
|
|
|
|
if not package:config("ipv6_scope") then |
|
|
|
|
package:add("defines", "IPADDRESS_NO_IPV6_SCOPE") |
|
|
|
|
package:add("defines", "IPADDRESS_IPV6_SCOPE_MAX_LENGTH=0") |
|
|
|
|
else |
|
|
|
|
package:add("defines", "IPADDRESS_IPV6_SCOPE_MAX_LENGTH=" .. package:config("ipv6_scope_max_length")) |
|
|
|
|
end |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
on_install(function(package) |
|
|
|
|
local configs = {"-DBUILD_TESTING=OFF", "-DIPADDRESS_ENABLE_CLANG_TIDY=OFF", "-DIPADDRESS_BUILD_TESTS=OFF", |
|
|
|
|
"-DIPADDRESS_BUILD_BENCHMARK=OFF", "-DIPADDRESS_BUILD_DOC=OFF", |
|
|
|
@ -33,6 +48,7 @@ package("vladimirshaleev-ipaddress") |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
on_test(function(package) |
|
|
|
|
if package:config("overload_std") then |
|
|
|
|
assert(package:check_cxxsnippets({test = [[ |
|
|
|
|
#include <iostream> |
|
|
|
|
#include <ipaddress/ipaddress.hpp> |
|
|
|
@ -48,4 +64,15 @@ package("vladimirshaleev-ipaddress") |
|
|
|
|
} |
|
|
|
|
]] |
|
|
|
|
}, {configs = {languages = "c++17"}})) |
|
|
|
|
else |
|
|
|
|
assert(package:check_cxxsnippets({test = [[ |
|
|
|
|
#include <ipaddress/ipaddress.hpp> |
|
|
|
|
using namespace ipaddress; |
|
|
|
|
auto test_no_overload() { |
|
|
|
|
constexpr auto ip = ipv6_address::parse("fec0::1ff:fe23:4567:890a%eth2"); |
|
|
|
|
return ip; |
|
|
|
|
} |
|
|
|
|
]] |
|
|
|
|
}, {configs = {languages = "c++17"}})) |
|
|
|
|
end |
|
|
|
|
end) |
|
|
|
|