summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-08-22 20:00:48 +0800
committerruki <[email protected]>2021-08-22 20:00:48 +0800
commitf677b70f1725e3d5d61b38e5c4caf53955f4cd77 (patch)
tree953c95d14b32ae12d03e1f79cad5b16c83f506e6
parent0b3a790a6e1e81b25ff4e2d7a53c73bc42b47e26 (diff)
add metal rule stub
-rw-r--r--tests/projects/objc/metal_app/xmake.lua2
-rw-r--r--xmake/rules/xcode/application/xmake.lua4
-rw-r--r--xmake/rules/xcode/metal/xmake.lua29
3 files changed, 32 insertions, 3 deletions
diff --git a/tests/projects/objc/metal_app/xmake.lua b/tests/projects/objc/metal_app/xmake.lua
index 54a94b26d..2a808a5fb 100644
--- a/tests/projects/objc/metal_app/xmake.lua
+++ b/tests/projects/objc/metal_app/xmake.lua
@@ -5,7 +5,7 @@ target("HelloTriangle")
add_includedirs("Renderer")
add_frameworks("MetalKit")
add_mflags("-fmodules")
- add_files("Renderer/*.m")
+ add_files("Renderer/*.m", "Renderer/*.metal")
if is_plat("macosx") then
add_files("Application/main.m")
add_files("Application/AAPLViewController.m")
diff --git a/xmake/rules/xcode/application/xmake.lua b/xmake/rules/xcode/application/xmake.lua
index 5984bbb55..51232f033 100644
--- a/xmake/rules/xcode/application/xmake.lua
+++ b/xmake/rules/xcode/application/xmake.lua
@@ -21,8 +21,8 @@
-- define rule: xcode application
rule("xcode.application")
- -- support add_files("Info.plist", "*.storyboard", "*.xcassets")
- add_deps("xcode.info_plist", "xcode.storyboard", "xcode.xcassets")
+ -- support add_files("Info.plist", "*.storyboard", "*.xcassets", "*.metal")
+ add_deps("xcode.info_plist", "xcode.storyboard", "xcode.xcassets", "xcode.metal")
-- we must set kind before target.on_load(), may we will use target in on_load()
before_load("load")
diff --git a/xmake/rules/xcode/metal/xmake.lua b/xmake/rules/xcode/metal/xmake.lua
new file mode 100644
index 000000000..24c4ecb2a
--- /dev/null
+++ b/xmake/rules/xcode/metal/xmake.lua
@@ -0,0 +1,29 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+rule("xcode.metal")
+
+ -- support add_files("*.metal")
+ set_extensions(".metal")
+
+ -- build *.metal to *.metallib
+ on_build_file(function (target, sourcefile, opt)
+
+ end)