Browse Source

add support for libc++ runtimes for boost (#3311)

* add support for libc++ runtimes for boost

* apply PR suggestions

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
Arthur Laurent 1 năm trước cách đây
mục cha
commit
3b582fd586
1 tập tin đã thay đổi với 15 bổ sung0 xóa
  1. 15 0
      packages/b/boost/xmake.lua

+ 15 - 0
packages/b/boost/xmake.lua

@@ -200,6 +200,10 @@ package("boost")
             "--without-icu"
             "--without-icu"
         }
         }
 
 
+        if package:has_tool("cxx", "clang", "clangxx") then
+            table.insert(bootstrap_argv, "--with-toolset=clang")
+        end
+
         if package:is_plat("windows") then
         if package:is_plat("windows") then
             -- for bootstrap.bat, all other arguments are useless
             -- for bootstrap.bat, all other arguments are useless
             bootstrap_argv = { "msvc" }
             bootstrap_argv = { "msvc" }
@@ -265,6 +269,7 @@ package("boost")
             table.insert(argv, "address-model=32")
             table.insert(argv, "address-model=32")
         end
         end
         local cxxflags
         local cxxflags
+        local linkflags
         if package:is_plat("windows") then
         if package:is_plat("windows") then
             local vs_runtime = package:config("vs_runtime")
             local vs_runtime = package:config("vs_runtime")
             if package:config("shared") then
             if package:config("shared") then
@@ -302,9 +307,19 @@ package("boost")
                 cxxflags = cxxflags .. " -fPIC"
                 cxxflags = cxxflags .. " -fPIC"
             end
             end
         end
         end
+        if package.has_runtime and package:has_runtime("c++_shared", "c++_static") then
+            cxxflags = (cxxflags or "") .. " -stdlib=libc++"
+            linkflags = (linkflags or "") .. " -stdlib=libc++"
+            if package:has_runtime("c++_static") then
+                linkflags = linkflags .. " -static-libstdc++"
+            end
+        end
         if cxxflags then
         if cxxflags then
             table.insert(argv, "cxxflags=" .. cxxflags)
             table.insert(argv, "cxxflags=" .. cxxflags)
         end
         end
+        if linkflags then
+            table.insert(argv, "linkflags=" .. linkflags)
+        end
         for _, libname in ipairs(libnames) do
         for _, libname in ipairs(libnames) do
             if package:config("all") or package:config(libname) then
             if package:config("all") or package:config(libname) then
                 table.insert(argv, "--with-" .. libname)
                 table.insert(argv, "--with-" .. libname)