From 162a2cc6fdff3f6fa8754c4b8da426925b06b5ee Mon Sep 17 00:00:00 2001 From: yszhou2019 <59953951+yszhou2019@users.noreply.github.com> Date: Fri, 9 Sep 2022 09:17:32 +0800 Subject: [PATCH] fix v8@win (#1311) * try fix v8@win * add v8gen args * fix arch * try fix * try fix * try fix * fix typo * fix typo * add debug info * try fix * try fix * fix * try gm * add winmm * update * add syslinks * update win * update deps:depot_tools config * fix typo * try fix * fix * limit vs_runtime, remove redundant code * remove ninja dep --- packages/v/v8/xmake.lua | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/packages/v/v8/xmake.lua b/packages/v/v8/xmake.lua index 4f4aab064..92e71e68c 100644 --- a/packages/v/v8/xmake.lua +++ b/packages/v/v8/xmake.lua @@ -9,6 +9,9 @@ package("v8") if is_plat("linux", "bsd") then add_syslinks("pthread", "dl") + elseif is_plat("windows") then + add_syslinks("user32", "winmm", "advapi32", "dbghelp", "shlwapi") + add_configs("vs_runtime", {description = "Set vs runtime.", default = "MT", readonly = true}) end add_links("v8_monolith", @@ -27,7 +30,7 @@ package("v8") "cppgc_base", "torque_ls_base") - on_install("linux", "macosx", function (package) + on_install("linux", "macosx", "windows", function (package) import("core.base.global") -- maybe we need set proxy, e.g. `xmake g --proxy=http://127.0.0.1:xxxx` @@ -46,6 +49,9 @@ package("v8") "managed": False, "custom_deps": {}, }]]=]) + if package:is_plat("windows") then + envs.DEPOT_TOOLS_WIN_TOOLCAHIN = "0" + end local gclient = is_host("windows") and "gclient.bat" or "gclient" os.vrunv(gclient, {"sync", "-v"}, {envs = envs}) local configs = { @@ -61,29 +67,16 @@ package("v8") v8_use_external_startup_data = false, v8_enable_test_features = false, v8_enable_i18n_support = false} - if package:is_arch("x86", "i386") then - configs.target_cpu = "x86" - elseif package:is_arch("x64", "x86_64") then - configs.target_cpu = "x64" - elseif package:is_arch("arm64", "arm64-v8a") then - configs.target_cpu = "arm64" - end - if not package:is_plat("windows") then - configs.cc = package:build_getenv("cc") - configs.cxx = package:build_getenv("cxx") - else + + if package:is_plat("windows") then configs.extra_cflags = {(package:config("vs_runtime"):startswith("MT") and "/MT" or "/MD")} + configs.is_clang = false end - if package:is_plat("macosx") then - configs.extra_ldflags = {"-lstdc++"} - local xcode = import("core.tool.toolchain").load("xcode", {plat = package:plat(), arch = package:arch()}) - configs.xcode_sysroot = xcode:config("xcode_sysroot") - end - import("package.tools.gn").build(package, configs, {buildir = "out"}) + import("package.tools.gn").build(package, configs, {buildir = "out.gn"}) os.cp("include", package:installdir()) - os.trycp("out/obj/*.a", package:installdir("lib")) - os.trycp("out/obj/*.lib", package:installdir("lib")) - os.trycp("out/obj/*.dll", package:installdir("bin")) + os.trycp("out.gn/obj/*.a", package:installdir("lib")) + os.trycp("out.gn/obj/*.lib", package:installdir("lib")) + os.trycp("out.gn/obj/*.dll", package:installdir("bin")) end) on_test(function (package)