makepad-platform_skill

This skill helps you understand Makepad platform support across macOS, Windows, Linux, Web, and mobile backends and use conditional compilation effectively.
  • Shell

715

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill zhanghandong/makepad-skills --skill makepad-platform

  • SKILL.md4.1 KB

Overview

This skill guides Makepad cross-platform development and platform support decisions. It explains supported OS targets, graphics backends, runtime and compile-time detection, and where to place platform-specific code. Use it to design conditional code paths, pick correct backends, and handle platform features consistently.

How this skill works

The skill inspects the declared OsType enum, platform modules, and available backends (Metal, D3D11, OpenGL, WebGL2, OpenGL ES, OHOS, OpenXR). It explains runtime checks via cx.os_type() and gpu/xr/cpu info and shows compile-time gates using #[cfg(target_os = "...")] and #[cfg(target_arch = "wasm32")]. It maps features (windowing, input, lifecycle) to desktop, mobile, and web modules so you know which files and APIs to touch.

When to use it

  • Choosing graphics backend per platform (Metal, D3D11, OpenGL, WebGL2, OpenGL ES)
  • Adding platform-specific code or files under platform/src/os/
  • Implementing runtime behavior differences with cx.os_type()
  • Guarding code at compile time with #[cfg(...)]
  • Handling input, lifecycle, or windowing differences across desktop/mobile/web

Best practices

  • Use cx.os_type() for runtime branching to keep single binary logic where needed
  • Prefer #[cfg(...)] for OS-specific code to avoid unused compilation on other targets
  • Keep platform modules organized (apple/, mswindows/, linux/, web/, android/, open_harmony/, open_xr/) and mirror API differences there
  • Compile shaders per backend at build time; do not assume runtime shader compilation
  • Query gpu_info(), xr_capabilities(), and cpu_cores() early to adapt behavior and performance settings

Example use cases

  • Detect macOS to enable Metal-specific features in apple/metal_*.rs and apple/cocoa_*.rs
  • Use #[cfg(target_arch = "wasm32")] to include web_browser/*.rs and web/*.rs only for WebAssembly builds
  • Handle touch and virtual keyboard only on mobile platforms (android/*.rs, ios modules)
  • Switch to D3D11 path and mswindows/d3d11_*.rs implementations for Windows builds
  • Query cx.gpu_info() to choose rendering quality or fallbacks at startup

FAQ

Call cx.os_type() and match on OsType (e.g., OsType::Macos, OsType::Web(_)) to branch behavior.

How do I compile platform-specific code?

Use Rust conditional compilation attributes like #[cfg(target_os = "macos")] or #[cfg(target_arch = "wasm32")] to include code only on those targets.

Where are platform implementations located?

Platform-specific sources live under platform/src/os/ with modules like apple/, mswindows/, linux/, web/, android/, open_harmony/, and open_xr/.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
makepad-platform skill by zhanghandong/makepad-skills | VeilStrat