Are you an LLM? You can read better optimized documentation at /examples/cpp/graphics/metal_app.md for this page in Markdown format
Metal Application
We can use xcode.application rule to build Metal application.
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")
Build and Run
bash
$ xmake
$ xmake run