فهرست منبع

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
yszhou2019 3 سال پیش
والد
کامیت
162a2cc6fd
1فایلهای تغییر یافته به همراه14 افزوده شده و 21 حذف شده
  1. 14 21
      packages/v/v8/xmake.lua

+ 14 - 21
packages/v/v8/xmake.lua

@@ -9,6 +9,9 @@ package("v8")
 
 
     if is_plat("linux", "bsd") then
     if is_plat("linux", "bsd") then
         add_syslinks("pthread", "dl")
         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
     end
 
 
     add_links("v8_monolith",
     add_links("v8_monolith",
@@ -27,7 +30,7 @@ package("v8")
               "cppgc_base",
               "cppgc_base",
               "torque_ls_base")
               "torque_ls_base")
 
 
-    on_install("linux", "macosx", function (package)
+    on_install("linux", "macosx", "windows", function (package)
         import("core.base.global")
         import("core.base.global")
 
 
         -- maybe we need set proxy, e.g. `xmake g --proxy=http://127.0.0.1:xxxx`
         -- maybe we need set proxy, e.g. `xmake g --proxy=http://127.0.0.1:xxxx`
@@ -46,6 +49,9 @@ package("v8")
     "managed": False,
     "managed": False,
     "custom_deps": {},
     "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"
         local gclient = is_host("windows") and "gclient.bat" or "gclient"
         os.vrunv(gclient, {"sync", "-v"}, {envs = envs})
         os.vrunv(gclient, {"sync", "-v"}, {envs = envs})
         local configs = {
         local configs = {
@@ -61,29 +67,16 @@ package("v8")
             v8_use_external_startup_data = false,
             v8_use_external_startup_data = false,
             v8_enable_test_features = false,
             v8_enable_test_features = false,
             v8_enable_i18n_support = 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.extra_cflags = {(package:config("vs_runtime"):startswith("MT") and "/MT" or "/MD")}
+            configs.is_clang = false 
         end
         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.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)
     end)
 
 
     on_test(function (package)
     on_test(function (package)