Преглед на файлове

stdexec: fix msvc (#5188)

* stdexec: fix msvc

* add check
star9029 преди 11 месеца
родител
ревизия
717be7e8b4
променени са 1 файла, в които са добавени 16 реда и са изтрити 4 реда
  1. 16 4
      packages/s/stdexec/xmake.lua

+ 16 - 4
packages/s/stdexec/xmake.lua

@@ -2,18 +2,30 @@ package("stdexec")
     set_kind("library", {headeronly = true})
     set_homepage("https://github.com/NVIDIA/stdexec")
     set_description("`std::execution`, the proposed C++ framework for asynchronous and parallel programming. ")
+    set_license("Apache-2.0")
 
     add_urls("https://github.com/NVIDIA/stdexec.git")
 
     add_versions("2024.03.08", "b3ba13a7b8c206371207196e08844fb7bc745438")
 
-    if is_plat("windows") then
-        add_cxxflags("/Zc:__cplusplus")
+    add_deps("cmake")
+
+    if on_check then
+        on_check("windows", function (package)
+            if package:version():ge("3.0.0") then
+                import("core.base.semver")
+
+                local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
+                assert(vs_toolset and semver.new(vs_toolset):minor() >= 30, "package(stdexec): need vs_toolset >= v143")
+            end
+        end)
     end
 
-    add_deps("cmake")
+    on_install("windows", "linux", "macosx", "mingw", function (package)
+        if package:has_tool("cxx", "cl") then
+            package:add("cxxflags", "/Zc:__cplusplus", "/Zc:preprocessor")
+        end
 
-    on_install("linux", "macosx", "mingw", function (package)
         local configs = {"-DSTDEXEC_BUILD_EXAMPLES=OFF", "-DSTDEXEC_BUILD_TESTS=OFF"}
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))