Browse Source

improve links (#3891)

* improve links

* enable debug

* Update xmake.lua

* Update windows.yml
ruki 1 year ago
parent
commit
654295112a
1 changed files with 18 additions and 2 deletions
  1. 18 2
      packages/s/spirv-cross/xmake.lua

+ 18 - 2
packages/s/spirv-cross/xmake.lua

@@ -13,24 +13,40 @@ package("spirv-cross")
     add_configs("exceptions", {description = "Enable exception handling", default = true, type = "boolean"})
     add_configs("exceptions", {description = "Enable exception handling", default = true, type = "boolean"})
 
 
     add_deps("cmake")
     add_deps("cmake")
-    add_links("spirv-cross-c", "spirv-cross-cpp", "spirv-cross-reflect", "spirv-cross-msl", "spirv-cross-util", "spirv-cross-hlsl", "spirv-cross-glsl", "spirv-cross-core")
 
 
     if is_plat("windows") then
     if is_plat("windows") then
         set_policy("platform.longpaths", true)
         set_policy("platform.longpaths", true)
     end
     end
 
 
+    on_load(function (package)
+        local links = {"spirv-cross-c", "spirv-cross-cpp", "spirv-cross-reflect",
+                       "spirv-cross-msl", "spirv-cross-util", "spirv-cross-hlsl",
+                       "spirv-cross-glsl", "spirv-cross-core"}
+        for _, link in ipairs(links) do
+            if package:is_plat("windows") and package:is_debug() then
+                link = link .. "d"
+            end
+            package:add("links", link)
+        end
+    end)
+
     on_install("windows", "linux", "macosx", "mingw", function (package)
     on_install("windows", "linux", "macosx", "mingw", function (package)
         local configs = {"-DSPIRV_CROSS_ENABLE_TESTS=OFF"}
         local configs = {"-DSPIRV_CROSS_ENABLE_TESTS=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
 
 
         local cxflags
         local cxflags
         if package:config("exceptions") then
         if package:config("exceptions") then
             table.insert(configs, "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=OFF")
             table.insert(configs, "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=OFF")
             if package:is_plat("windows") and package:has_tool("cxx", "cl", "clang_cl") then
             if package:is_plat("windows") and package:has_tool("cxx", "cl", "clang_cl") then
-                cxflags = "/EHsc"
+                cxflags = {"/EHsc"}
             end
             end
         else
         else
             table.insert(configs, "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=ON")
             table.insert(configs, "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=ON")
         end
         end
+        if package:is_plat("windows") and package:is_debug() then
+            cxflags = cxflags or {}
+            table.insert(cxflags, "/FS")
+        end
         if package:config("shared") then
         if package:config("shared") then
             table.insert(configs, "-DSPIRV_CROSS_SHARED=ON")
             table.insert(configs, "-DSPIRV_CROSS_SHARED=ON")
         else
         else