Are you an LLM? You can read better optimized documentation at /zh/examples/cpp/graphics/metal_app.md for this page in Markdown format
Metal 应用程序
我们可以使用 xcode.application 规则来构建 Metal 应用程序。
App
EXPLORER
Application
macOS
Base.lproj
Main.storyboard
Info.plist
AAPLViewController.h
AAPLViewController.m
main.m
Renderer
AAPLRenderer.h
AAPLRenderer.m
AAPLShaders.metal
AAPLShaderTypes.h
xmake.lua
Lua xmake.lua
1234567891011121314
add_rules("mode.debug", "mode.release")
target("metal_app")
add_rules("xcode.application")
add_includedirs("Renderer")
add_frameworks("MetalKit")
add_mflags("-fmodules")
add_files("Renderer/*.m", "Renderer/*.metal")
add_files("Application/main.m")
add_files("Application/AAPLViewController.m")
add_files("Application/macOS/Info.plist")
add_files("Application/macOS/Base.lproj/*.storyboard")
add_defines("TARGET_MACOS")
add_frameworks("AppKit")
编译运行
bash
$ xmake
$ xmake run