diff options
| author | ruki <[email protected]> | 2021-08-25 00:42:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-08-25 00:42:18 +0800 |
| commit | dbd66858b8b68a784c415557e8958650e3d638c1 (patch) | |
| tree | 1478e95e64d0788caca1f32cf175ded50f646ffa /xmake/rules/xcode | |
| parent | a1e286a66cf7e9df8ec1cad9316386d7f2a75b33 (diff) | |
improve metal rule
Diffstat (limited to 'xmake/rules/xcode')
| -rw-r--r-- | xmake/rules/xcode/metal/xmake.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/xmake/rules/xcode/metal/xmake.lua b/xmake/rules/xcode/metal/xmake.lua index d6722cef9..a876f946b 100644 --- a/xmake/rules/xcode/metal/xmake.lua +++ b/xmake/rules/xcode/metal/xmake.lua @@ -107,12 +107,6 @@ rule("xcode.metal") -- link *.air to *.metallib before_linkcmd(function (target, batchcmds, opt) - -- get metallib - import("core.tool.toolchain") - import("lib.detect.find_tool") - local cross = target:data("xcode.metal.cross") - local metallib = assert(find_tool("metallib", {program = cross .. " metallib"}), "metallib command not found!") - -- get objectfiles local objectfiles = {} for rulename, sourcebatch in pairs(target:sourcebatches()) do @@ -123,7 +117,15 @@ rule("xcode.metal") break end end - assert(#objectfiles > 0, "*.air files not found!") + if #objectfiles == 0 then + return + end + + -- get metallib + import("core.tool.toolchain") + import("lib.detect.find_tool") + local cross = target:data("xcode.metal.cross") + local metallib = assert(find_tool("metallib", {program = cross .. " metallib"}), "metallib command not found!") -- get xcode toolchain local xcode = toolchain.load("xcode", {plat = target:plat(), arch = target:arch()}) |
