跳转到内容

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