Parcourir la source

tbb: fix 2020.3 (#4892)

* tbb: fix 2020.3

* fix debug links
star9029 il y a 1 an
Parent
commit
13b9ac4fc8
2 fichiers modifiés avec 37 ajouts et 9 suppressions
  1. 13 0
      packages/t/tbb/patches/2020.3/gcc13.patch
  2. 24 9
      packages/t/tbb/xmake.lua

+ 13 - 0
packages/t/tbb/patches/2020.3/gcc13.patch

@@ -0,0 +1,13 @@
+diff --git a/include/tbb/task.h b/include/tbb/task.h
+index 5e137c69..b5fb1ac3 100644
+--- a/include/tbb/task.h
++++ b/include/tbb/task.h
+@@ -249,7 +249,7 @@ namespace internal {
+ #if __TBB_TASK_PRIORITY
+         //! Pointer to the next offloaded lower priority task.
+         /** Used to maintain a list of offloaded tasks inside the scheduler. **/
+-        task* next_offloaded;
++        tbb::task* next_offloaded;
+ #endif
+ 
+ #if __TBB_PREVIEW_RESUMABLE_TASKS

+ 24 - 9
packages/t/tbb/xmake.lua

@@ -1,12 +1,13 @@
 package("tbb")
-
     set_homepage("https://software.intel.com/en-us/tbb/")
     set_description("Threading Building Blocks (TBB) lets you easily write parallel C++ programs that take full advantage of multicore performance, that are portable, composable and have future-proof scalability.")
+    set_license("Apache-2.0")
 
+    add_urls("https://github.com/oneapi-src/oneTBB.git")
     if is_plat("windows") then
         add_urls("https://github.com/oneapi-src/oneTBB/$(version)", {version = function (version)
             if version:ge("2021.0") then
-                return "archive/v" .. version .. ".tar.gz"
+                return "archive/refs/tags/v" .. version .. ".tar.gz"
             else
                 return "releases/download/v" .. version .. "/tbb-" .. version .. "-win.zip"
             end
@@ -21,7 +22,7 @@ package("tbb")
         add_versions("2021.11.0", "782ce0cab62df9ea125cdea253a50534862b563f1d85d4cda7ad4e77550ac363")
         add_versions("2021.12.0", "c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f")
     else
-        add_urls("https://github.com/oneapi-src/oneTBB/archive/v$(version).tar.gz")
+        add_urls("https://github.com/oneapi-src/oneTBB/archive/refs/tags/v$(version).tar.gz")
         add_versions("2020.3", "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3")
         add_versions("2021.2.0", "cee20b0a71d977416f3e3b4ec643ee4f38cedeb2a9ff015303431dd9d8d79854")
         add_versions("2021.3.0", "8f616561603695bbb83871875d2c6051ea28f8187dbe59299961369904d1d49e")
@@ -32,8 +33,9 @@ package("tbb")
         add_versions("2021.11.0", "782ce0cab62df9ea125cdea253a50534862b563f1d85d4cda7ad4e77550ac363")
         add_versions("2021.12.0", "c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f")
     
-        add_patches("2021.2.0", path.join(os.scriptdir(), "patches", "2021.2.0", "gcc11.patch"), "181511cf4878460cb48ac0531d3ce8d1c57626d698e9001a0951c728fab176fb")
-        add_patches("2021.5.0", path.join(os.scriptdir(), "patches", "2021.5.0", "i386.patch"), "1a1c11724839cf98b1b8f4d415c0283ec7719c330b11503c578739eb02889ec0")
+        add_patches("2020.3", "patches/2020.3/gcc13.patch", "419557beb877a72fa394c886fbb674c1b0c300fee7f2ec4e2de39ceeeb6b95fd")
+        add_patches("2021.2.0", "patches/2021.2.0/gcc11.patch", "181511cf4878460cb48ac0531d3ce8d1c57626d698e9001a0951c728fab176fb")
+        add_patches("2021.5.0", "patches/2021.5.0/i386.patch", "1a1c11724839cf98b1b8f4d415c0283ec7719c330b11503c578739eb02889ec0")
 
         if is_plat("macosx") then
             add_configs("compiler", {description = "Compiler used to compile tbb." , default = "clang", type = "string", values = {"clang", "gcc", "icc", "cl", "icl", "[others]"}})
@@ -46,16 +48,29 @@ package("tbb")
 
     on_fetch("fetch")
 
-    add_links("tbb", "tbbmalloc", "tbbmalloc_proxy")
+    if on_check then
+        on_check("macosx", function (package)
+            assert(package:is_arch("arm64") and package:version():ge("2021.0"),
+                "package(tbb <2021.0) unsupported version on macosx/arm64")
+        end)
+    end
 
     on_load(function (package)
-        if package:version():ge("2021.0") then
+        if package:has_tool("cxx", "cl", "clang_cl") then
+            package:add("defines", "__TBB_NO_IMPLICIT_LINKAGE")
+        end
+        if package:is_debug() then
+            package:add("links", "tbb_debug", "tbbmalloc_debug", "tbbmalloc_proxy_debug")
+        else
+            package:add("links", "tbb", "tbbmalloc", "tbbmalloc_proxy")
+        end
+        if package:gitref() or package:version():ge("2021.0") then
             package:add("deps", "cmake")
         end
     end)
 
     on_install("macosx", "linux", "mingw@windows", "mingw@msys", "android", function (package)
-        if package:version():ge("2021.0") then
+        if package:gitref() or package:version():ge("2021.0") then
             if package:version():le("2021.4") and package:is_plat("mingw") then
                 raise("mingw build is not supported in this version")
             end
@@ -110,7 +125,7 @@ package("tbb")
     end)
 
     on_install("windows", function (package)
-        if package:version():ge("2021.0") then
+        if package:gitref() or package:version():ge("2021.0") then
             local configs = {"-DTBB_TEST=OFF", "-DTBB_STRICT=OFF"}
             table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
             import("package.tools.cmake").install(package, configs)