如何在编写package时下载第三方.lib/.a
文件?
#1383
Answered
by
waruqi
Winterreisender
asked this question in
Q&A
-
我在尝试给webview写一个xrepo,它目前依赖于Webview2,而Webview2只提供了 也就是说我想给用户在引用包的时候:
把这三个步骤写到package里,让用户无需关心细节。 更新: 完整xmake.luaset_languages("c++20")
package("WebView2")
package_end()
package("webview")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/webview/webview")
set_description("Tiny cross-platform webview library for C/C++/Golang.")
set_license("MIT")
add_urls("https://github.com/webview/webview.git")
add_versions("0.0.1", "25e7f41b8bbf5c593e24fb64fdf433756b9d6008")
if is_plat("mingw") then
add_syslinks("ole32","shell32","shlwapi","user32")
end
on_install(function (package)
os.cp("*.h", package:installdir("include"))
end)
on_test(function (package)
assert(package:has_cfuncs("webview_create", {includes = "webview.h"}))
end)
package_end()
target("webview_shared")
set_kind("shared")
set_toolchains("@msvc")
-- curl -o libs/mswebview2.nuget -ssL https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2
-- Expand-Archive -Force -Path libs/mswebview2.nuget -DestinationPath libs
add_includedirs("libs/build/native/include/")
add_linkdirs("libs/build/native/x64/")
add_links("WebView2Loader.dll")
add_files("src/*.cc") 我想把 -- curl -o libs/mswebview2.nuget -ssL https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2
-- Expand-Archive -Force -Path libs/mswebview2.nuget -DestinationPath libs
add_includedirs("libs/build/native/include/")
add_linkdirs("libs/build/native/x64/")
add_links("WebView2Loader.dll") 这五行的逻辑放到package里 |
Beta Was this translation helpful? Give feedback.
Answered by
waruqi
Aug 3, 2022
Replies: 1 comment
-
配置 add_resources 在包安装阶段自动下载它,然后将里面的 lib copy 到 package:installdir("lib"),再通过 add_links 固定下 link 顺序 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Winterreisender
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
配置 add_resources 在包安装阶段自动下载它,然后将里面的 lib copy 到 package:installdir("lib"),再通过 add_links 固定下 link 顺序