Supporting material availability
This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:
./references/platform-support.md
Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.
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: |4 CRITICAL: Use for Makepad cross-platform support. Triggers on:5 makepad platform, makepad os, makepad macos, makepad windows, makepad linux,6 makepad android, makepad ios, makepad web, makepad wasm, makepad metal,7 makepad d3d11, makepad opengl, makepad webgl, OsType, CxOs,8 makepad 跨平台, makepad 平台支持9risk: critical10source: community11date_added: "2026-03-06"12metadata:13 source: https://skillmd.com/skills/iradoweck/makepad-platform14---1516## Supporting material availability1718This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:1920- `./references/platform-support.md`2122Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.232425# Makepad Platform Skill2627> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1928>29> Check for updates: https://crates.io/crates/makepad-widgets3031You are an expert at Makepad cross-platform development. Help users by:32- **Understanding platforms**: Explain supported platforms and backends33- **Platform-specific code**: Help with conditional compilation and platform APIs3435## When to Use36- You need to understand or target specific platforms and graphics backends in Makepad.37- The task involves platform compatibility, conditional compilation, or OS-specific behavior across desktop, mobile, or web.38- You need guidance on backend differences such as Metal, D3D11, OpenGL, WebGL, or platform modules.3940## Documentation4142Refer to the local files for detailed documentation:43- `./references/platform-support.md` - Platform details and OsType4445## IMPORTANT: Documentation Completeness Check4647**Before answering questions, Claude MUST:**48491. Read the relevant reference file(s) listed above502. If file read fails or file is empty:51 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"52 - Still answer based on SKILL.md patterns + built-in knowledge533. If reference file exists, incorporate its content into the answer5455## Supported Platforms5657| Platform | Graphics Backend | OS Module |58|----------|------------------|-----------|59| macOS | Metal | `apple/metal_*.rs`, `apple/cocoa_*.rs` |60| iOS | Metal | `apple/metal_*.rs`, `apple/ios_*.rs` |61| Windows | D3D11 | `mswindows/d3d11_*.rs`, `mswindows/win32_*.rs` |62| Linux | OpenGL | `linux/opengl_*.rs`, `linux/x11*.rs`, `linux/wayland*.rs` |63| Web | WebGL2 | `web/*.rs`, `web_browser/*.rs` |64| Android | OpenGL ES | `android/*.rs` |65| OpenHarmony | OHOS | `open_harmony/*.rs` |66| OpenXR | VR/AR | `open_xr/*.rs` |6768## OsType Enum6970```rust71pub enum OsType {72 Unknown,73 Windows,74 Macos,75 Linux { custom_window_chrome: bool },76 Ios,77 Android(AndroidParams),78 OpenHarmony,79 Web(WebParams),80 OpenXR,81}8283// Check platform in code84fn handle_event(&mut self, cx: &mut Cx, event: &Event) {85 match cx.os_type() {86 OsType::Macos => { /* macOS-specific */ }87 OsType::Windows => { /* Windows-specific */ }88 OsType::Web(_) => { /* Web-specific */ }89 _ => {}90 }91}92```9394## Platform Detection9596```rust97// In Cx98impl Cx {99 pub fn os_type(&self) -> OsType;100 pub fn gpu_info(&self) -> &GpuInfo;101 pub fn xr_capabilities(&self) -> &XrCapabilities;102 pub fn cpu_cores(&self) -> usize;103}104```105106## Conditional Compilation107108```rust109// Compile-time platform detection110#[cfg(target_os = "macos")]111fn macos_only() { }112113#[cfg(target_os = "windows")]114fn windows_only() { }115116#[cfg(target_os = "linux")]117fn linux_only() { }118119#[cfg(target_arch = "wasm32")]120fn web_only() { }121122#[cfg(target_os = "android")]123fn android_only() { }124125#[cfg(target_os = "ios")]126fn ios_only() { }127```128129## Platform-Specific Features130131### Desktop (macOS/Windows/Linux)132- Window management (resize, minimize, maximize)133- File dialogs134- System menu135- Drag and drop136- Multiple monitors137138### Mobile (iOS/Android)139- Touch input140- Virtual keyboard141- Screen orientation142- App lifecycle (foreground/background)143144### Web (WebGL2)145- DOM integration146- Browser events147- Local storage148- HTTP requests149150## Entry Point151152```rust153// App entry macro154app_main!(App);155156pub struct App {157 ui: WidgetRef,158}159160impl LiveRegister for App {161 fn live_register(cx: &mut Cx) {162 // Register components163 crate::makepad_widgets::live_design(cx);164 }165}166167impl AppMain for App {168 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {169 // Handle app events170 self.ui.handle_event(cx, event, &mut Scope::empty());171 }172}173```174175## When Answering Questions1761771. Makepad compiles to native code for each platform (no runtime interpreter)1782. Shaders are compiled at build time for each graphics backend1793. Platform-specific code is in `platform/src/os/` directory1804. Use `cx.os_type()` for runtime platform detection1815. Use `#[cfg(target_os = "...")]` for compile-time platform detection182183## Limitations184- Use this skill only when the task clearly matches the scope described above.185- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.186- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.