Skip to main content
Draconis++ is designed to be cross-platform, with native implementations for Windows, macOS, Linux, BSD variants, and other Unix-like systems. Each platform has dedicated implementation files that leverage platform-specific APIs for optimal performance.

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:
MacroPlatformDefined by
_WIN32WindowsCompiler
__linux__LinuxCompiler
__APPLE__macOSCompiler
__FreeBSD__FreeBSDCompiler
__OpenBSD__OpenBSDCompiler
__NetBSD__NetBSDCompiler
__DragonFly__DragonFly BSDCompiler
__HAIKU__Haiku OSCompiler
__serenity__SerenityOSCompiler

Architecture detection

The build system also provides architecture-specific macros:
MacroArchitectureEnabled when
DRAC_ARCH_X86_64x86-64host_machine.cpu_family() == 'x86_64'
DRAC_ARCH_X86x86 (32-bit)host_machine.cpu_family() == 'x86'
DRAC_ARCH_AARCH64ARM64host_machine.cpu_family() == 'aarch64'
DRAC_ARCH_ARMARM (32-bit)host_machine.cpu_family() == 'arm'
DRAC_ARCH_64BITAny 64-bitsizeof(void*) == 8

Implementation structure

Platform-specific code is organized in src/Lib/OS/:
src/Lib/OS/
├── Windows.cpp    # Windows implementation
├── Linux.cpp      # Linux implementation
├── macOS.cpp      # macOS implementation
├── macOS/         # Objective-C++ bridge
│   ├── Bridge.mm
│   └── Bridge.hpp
├── BSD.cpp        # BSD variants
├── Haiku.cpp      # Haiku OS
├── Serenity.cpp   # SerenityOS
└── Unix.hpp       # Shared Unix utilities

Shared Unix utilities

All Unix-like platforms (Linux, macOS, BSD, Haiku, SerenityOS) share common implementations in Unix.hpp:
  • Disk usage: statvfs for filesystem statistics
  • Kernel version: uname for kernel release information
  • Network interfaces: getifaddrs for interface enumeration (where available)
  • Uptime: sysinfo on Linux, sysctl on BSD/macOS
These shared utilities are implemented as inline functions in the draconis::os::unix_shared namespace to avoid code duplication.

Build configuration

Platform support can be customized via Meson build options:
OptionTypeDefaultPlatformsDescription
xcbfeatureautoLinux, BSDX11 support via XCB
waylandfeatureautoLinux, BSDWayland compositor support
pugixmlfeatureautoLinuxXBPS package manager support
use_linked_pci_idsbooleanfalseLinuxEmbed PCI IDs database

Feature options

Feature options accept three values:
  • enabled: Require the feature (build fails if unavailable)
  • disabled: Disable the feature
  • auto (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

FeatureWindowsmacOSLinuxBSDHaikuSerenityOS
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

Build docs developers (and LLMs) love