Supported platforms
Windows
Windows 10/11 with DirectX Graphics Infrastructure (DXGI) and Windows Registry support
macOS
macOS 12+ with Core Foundation, IOKit, and Core Graphics frameworks
Linux
Linux (glibc/musl) with XCB, Wayland, and sysfs support
BSD & Unix
FreeBSD, OpenBSD, NetBSD, DragonFly BSD, Haiku, and SerenityOS
Platform detection
The build system automatically detects the target platform and defines appropriate preprocessor macros:| Macro | Platform | Defined by |
|---|---|---|
_WIN32 | Windows | Compiler |
__linux__ | Linux | Compiler |
__APPLE__ | macOS | Compiler |
__FreeBSD__ | FreeBSD | Compiler |
__OpenBSD__ | OpenBSD | Compiler |
__NetBSD__ | NetBSD | Compiler |
__DragonFly__ | DragonFly BSD | Compiler |
__HAIKU__ | Haiku OS | Compiler |
__serenity__ | SerenityOS | Compiler |
Architecture detection
The build system also provides architecture-specific macros:| Macro | Architecture | Enabled when |
|---|---|---|
DRAC_ARCH_X86_64 | x86-64 | host_machine.cpu_family() == 'x86_64' |
DRAC_ARCH_X86 | x86 (32-bit) | host_machine.cpu_family() == 'x86' |
DRAC_ARCH_AARCH64 | ARM64 | host_machine.cpu_family() == 'aarch64' |
DRAC_ARCH_ARM | ARM (32-bit) | host_machine.cpu_family() == 'arm' |
DRAC_ARCH_64BIT | Any 64-bit | sizeof(void*) == 8 |
Implementation structure
Platform-specific code is organized insrc/Lib/OS/:
Shared Unix utilities
All Unix-like platforms (Linux, macOS, BSD, Haiku, SerenityOS) share common implementations inUnix.hpp:
- Disk usage:
statvfsfor filesystem statistics - Kernel version:
unamefor kernel release information - Network interfaces:
getifaddrsfor interface enumeration (where available) - Uptime:
sysinfoon Linux,sysctlon BSD/macOS
draconis::os::unix_shared namespace to avoid code duplication.
Build configuration
Platform support can be customized via Meson build options:| Option | Type | Default | Platforms | Description |
|---|---|---|---|---|
xcb | feature | auto | Linux, BSD | X11 support via XCB |
wayland | feature | auto | Linux, BSD | Wayland compositor support |
pugixml | feature | auto | Linux | XBPS package manager support |
use_linked_pci_ids | boolean | false | Linux | Embed PCI IDs database |
Feature options
Feature options accept three values:enabled: Require the feature (build fails if unavailable)disabled: Disable the featureauto(default): Enable if dependencies are found
Platform-specific dependencies
Windows
- dwmapi: Desktop Window Manager API
- windowsapp: Windows Runtime
- setupapi: Device setup API
- dxgi: DirectX Graphics Infrastructure
- iphlpapi: IP Helper API
macOS
- appleframeworks: Core Foundation, IOKit, Core Graphics
- Objective-C++: For macOS-specific APIs
Linux
- xcb (optional): X11 window system support
- wayland-client (optional): Wayland compositor support
- dbus-1 (optional): D-Bus system integration
- pugixml (optional): XML parsing for XBPS
BSD
- xcb (optional): X11 window system support
- wayland (optional): Wayland on FreeBSD
Platform feature matrix
| Feature | Windows | macOS | Linux | BSD | Haiku | SerenityOS |
|---|---|---|---|---|---|---|
| CPU info | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| GPU info | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
| Memory info | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Disk usage | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Network info | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
| Display info | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
| Battery info | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
| Window manager | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Desktop environment | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Shell detection | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Package counting | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
Next steps
Windows implementation
Learn about Windows-specific APIs and registry access
macOS implementation
Explore macOS frameworks and sysctl usage
Linux implementation
Understand sysfs, procfs, and display server detection
BSD & Unix systems
Discover BSD sysctl and kenv utilities