Skip to content

Commit

Permalink
upa-url: add package (#5301)
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing authored Sep 20, 2024
1 parent 39af18a commit dbf1ee4
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/u/upa-url/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package("upa-url")
set_homepage("https://upa-url.github.io/docs/")
set_description("An implementation of the WHATWG URL Standard in C++")
set_license("BSD-2-Clause")

add_urls("https://github.com/upa-url/upa/archive/refs/tags/$(version).tar.gz",
"https://github.com/upa-url/upa.git", {submodules = false})

add_versions("v1.0.0", "9ad14357c177f7c038a447996a065995e074eb5447015467687726c5d221b5f4")

add_configs("tools", {description = "Build tools", default = false, type = "boolean"})

add_deps("cmake")

on_install(function (package)
if package:is_plat("windows") and package:config("shared") then
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
set_languages("c++11")
target("upa_url")
set_kind("$(kind)")
add_files("src/*.cpp")
add_includedirs("include")
add_headerfiles("include/(upa/*.h)")
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all", {export_classes = true})
end
]])
import("package.tools.xmake").install(package)
else
io.replace("CMakeLists.txt", "STATIC", "", {plain = true})

local configs = {"-DURL_BUILD_TESTS=OFF", "-DUPA_BUILD_TESTS=OFF"}
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"))
table.insert(configs, "-DUPA_BUILD_TOOLS=" .. (package:config("tools") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
upa::url url{"https://xmake.io/"};
}
]]}, {configs = {languages = "c++11"}, includes = "upa/url.h"}))
end)

0 comments on commit dbf1ee4

Please sign in to comment.