Makepad Platform Skill
Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19
Check for updates: https://crates.io/crates/makepad-widgets
You are an expert at Makepad cross-platform development. Help users by:
- Understanding platforms: Explain supported platforms and backends
- Platform-specific code: Help with conditional compilation and platform APIs
When to Use
- You need to understand or target specific platforms and graphics backends in Makepad.
- The task involves platform compatibility, conditional compilation, or OS-specific behavior across desktop, mobile, or web.
- You need guidance on backend differences such as Metal, D3D11, OpenGL, WebGL, or platform modules.
Documentation
Refer to the local files for detailed documentation:
./references/platform-support.md - Platform details and OsType
IMPORTANT: Documentation Completeness Check
Before answering questions, Claude MUST:
- Read the relevant reference file(s) listed above
- If file read fails or file is empty:
- Inform user: "本地文档不完整,建议运行
/sync-crate-skills makepad --force 更新文档"
- Still answer based on SKILL.md patterns + built-in knowledge
- If reference file exists, incorporate its content into the answer
Supported Platforms
| Platform |
Graphics Backend |
OS Module |
| macOS |
Metal |
apple/metal_*.rs, apple/cocoa_*.rs |
| iOS |
Metal |
apple/metal_*.rs, apple/ios_*.rs |
| Windows |
D3D11 |
mswindows/d3d11_*.rs, mswindows/win32_*.rs |
| Linux |
OpenGL |
linux/opengl_*.rs, linux/x11*.rs, linux/wayland*.rs |
| Web |
WebGL2 |
web/*.rs, web_browser/*.rs |
| Android |
OpenGL ES |
android/*.rs |
| OpenHarmony |
OHOS |
open_harmony/*.rs |
| OpenXR |
VR/AR |
open_xr/*.rs |
OsType Enum
pub enum OsType {
Unknown,
Windows,
Macos,
Linux { custom_window_chrome: bool },
Ios,
Android(AndroidParams),
OpenHarmony,
Web(WebParams),
OpenXR,
}
// Check platform in code
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
match cx.os_type() {
OsType::Macos => { /* macOS-specific */ }
OsType::Windows => { /* Windows-specific */ }
OsType::Web(_) => { /* Web-specific */ }
_ => {}
}
}
Platform Detection
// In Cx
impl Cx {
pub fn os_type(&self) -> OsType;
pub fn gpu_info(&self) -> &GpuInfo;
pub fn xr_capabilities(&self) -> &XrCapabilities;
pub fn cpu_cores(&self) -> usize;
}
Conditional Compilation
// Compile-time platform detection
#[cfg(target_os = "macos")]
fn macos_only() { }
#[cfg(target_os = "windows")]
fn windows_only() { }
#[cfg(target_os = "linux")]
fn linux_only() { }
#[cfg(target_arch = "wasm32")]
fn web_only() { }
#[cfg(target_os = "android")]
fn android_only() { }
#[cfg(target_os = "ios")]
fn ios_only() { }
Platform-Specific Features
Desktop (macOS/Windows/Linux)
- Window management (resize, minimize, maximize)
- File dialogs
- System menu
- Drag and drop
- Multiple monitors
Mobile (iOS/Android)
- Touch input
- Virtual keyboard
- Screen orientation
- App lifecycle (foreground/background)
Web (WebGL2)
- DOM integration
- Browser events
- Local storage
- HTTP requests
Entry Point
// App entry macro
app_main!(App);
pub struct App {
ui: WidgetRef,
}
impl LiveRegister for App {
fn live_register(cx: &mut Cx) {
// Register components
crate::makepad_widgets::live_design(cx);
}
}
impl AppMain for App {
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
// Handle app events
self.ui.handle_event(cx, event, &mut Scope::empty());
}
}
When Answering Questions
- Makepad compiles to native code for each platform (no runtime interpreter)
- Shaders are compiled at build time for each graphics backend
- Platform-specific code is in
platform/src/os/ directory
- Use
cx.os_type() for runtime platform detection
- Use
#[cfg(target_os = "...")] for compile-time platform detection
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---2name: makepad-platform3description: "{'CRITICAL': 'Use for Makepad cross-platform support. Triggers on:'}"4version: 1.0.05author:6 name: "sickn33 / Antigravity Community"7 github: sickn338tags: [makepad, platform, development]9category: development10platforms: [macos, linux, windows]11license: MIT12metadata:13 hermes:14 source: https://skillmd.com/skills/nous-hermeshub/makepad-platform15 upstream: "antigravity-awesome-skills"16 risk: "unknown"17 original_author: "Antigravity Community"18---1920# Makepad Platform Skill2122> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1923>24> Check for updates: https://crates.io/crates/makepad-widgets2526You are an expert at Makepad cross-platform development. Help users by:27- **Understanding platforms**: Explain supported platforms and backends28- **Platform-specific code**: Help with conditional compilation and platform APIs2930## When to Use31- You need to understand or target specific platforms and graphics backends in Makepad.32- The task involves platform compatibility, conditional compilation, or OS-specific behavior across desktop, mobile, or web.33- You need guidance on backend differences such as Metal, D3D11, OpenGL, WebGL, or platform modules.3435## Documentation3637Refer to the local files for detailed documentation:38- `./references/platform-support.md` - Platform details and OsType3940## IMPORTANT: Documentation Completeness Check4142**Before answering questions, Claude MUST:**43441. Read the relevant reference file(s) listed above452. If file read fails or file is empty:46 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"47 - Still answer based on SKILL.md patterns + built-in knowledge483. If reference file exists, incorporate its content into the answer4950## Supported Platforms5152| Platform | Graphics Backend | OS Module |53|----------|------------------|-----------|54| macOS | Metal | `apple/metal_*.rs`, `apple/cocoa_*.rs` |55| iOS | Metal | `apple/metal_*.rs`, `apple/ios_*.rs` |56| Windows | D3D11 | `mswindows/d3d11_*.rs`, `mswindows/win32_*.rs` |57| Linux | OpenGL | `linux/opengl_*.rs`, `linux/x11*.rs`, `linux/wayland*.rs` |58| Web | WebGL2 | `web/*.rs`, `web_browser/*.rs` |59| Android | OpenGL ES | `android/*.rs` |60| OpenHarmony | OHOS | `open_harmony/*.rs` |61| OpenXR | VR/AR | `open_xr/*.rs` |6263## OsType Enum6465```rust66pub enum OsType {67 Unknown,68 Windows,69 Macos,70 Linux { custom_window_chrome: bool },71 Ios,72 Android(AndroidParams),73 OpenHarmony,74 Web(WebParams),75 OpenXR,76}7778// Check platform in code79fn handle_event(&mut self, cx: &mut Cx, event: &Event) {80 match cx.os_type() {81 OsType::Macos => { /* macOS-specific */ }82 OsType::Windows => { /* Windows-specific */ }83 OsType::Web(_) => { /* Web-specific */ }84 _ => {}85 }86}87```8889## Platform Detection9091```rust92// In Cx93impl Cx {94 pub fn os_type(&self) -> OsType;95 pub fn gpu_info(&self) -> &GpuInfo;96 pub fn xr_capabilities(&self) -> &XrCapabilities;97 pub fn cpu_cores(&self) -> usize;98}99```100101## Conditional Compilation102103```rust104// Compile-time platform detection105#[cfg(target_os = "macos")]106fn macos_only() { }107108#[cfg(target_os = "windows")]109fn windows_only() { }110111#[cfg(target_os = "linux")]112fn linux_only() { }113114#[cfg(target_arch = "wasm32")]115fn web_only() { }116117#[cfg(target_os = "android")]118fn android_only() { }119120#[cfg(target_os = "ios")]121fn ios_only() { }122```123124## Platform-Specific Features125126### Desktop (macOS/Windows/Linux)127- Window management (resize, minimize, maximize)128- File dialogs129- System menu130- Drag and drop131- Multiple monitors132133### Mobile (iOS/Android)134- Touch input135- Virtual keyboard136- Screen orientation137- App lifecycle (foreground/background)138139### Web (WebGL2)140- DOM integration141- Browser events142- Local storage143- HTTP requests144145## Entry Point146147```rust148// App entry macro149app_main!(App);150151pub struct App {152 ui: WidgetRef,153}154155impl LiveRegister for App {156 fn live_register(cx: &mut Cx) {157 // Register components158 crate::makepad_widgets::live_design(cx);159 }160}161162impl AppMain for App {163 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {164 // Handle app events165 self.ui.handle_event(cx, event, &mut Scope::empty());166 }167}168```169170## When Answering Questions1711721. Makepad compiles to native code for each platform (no runtime interpreter)1732. Shaders are compiled at build time for each graphics backend1743. Platform-specific code is in `platform/src/os/` directory1754. Use `cx.os_type()` for runtime platform detection1765. Use `#[cfg(target_os = "...")]` for compile-time platform detection177178## Limitations179- Use this skill only when the task clearly matches the scope described above.180- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.181- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.