Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
Drake Version

Detailed Description

Drake exposes its version to downstream C++ as preprocessor macros, so that code can adapt to the Drake version at compile time, e.g., to handle API changes across releases.

Python users should instead obtain the version at runtime via importlib.metadata.version("drake").

Macros

#define DRAKE_VERSION_STRING
 Drake's full version string.
#define DRAKE_VERSION_AT_LEAST(major, minor, patch, yyyymmdd)
 Evaluates to true iff this build of Drake is at least as new as the given release.

Macro Definition Documentation

◆ DRAKE_VERSION_AT_LEAST

#define DRAKE_VERSION_AT_LEAST ( major,
minor,
patch,
yyyymmdd )

Evaluates to true iff this build of Drake is at least as new as the given release.

It handles stable releases, nightly/snapshot builds, and unstamped builds:

  • When evaluated against a stable release build, it is true iff the build version is greater than or equal to (major, minor, patch); the yyyymmdd argument is ignored.
  • When evaluated against a nightly or snapshot build, it is true iff the build date is at least yyyymmdd and yyyymmdd is nonzero.
  • When evaluated against an unstamped build, it is always false.

The yyyymmdd argument is the nightly date that corresponds to the stable (major, minor, patch) release. Intended for use in preprocessor conditionals:

#if DRAKE_VERSION_AT_LEAST(1, 51, 1, 20260311)
// ... use a newer Drake API ...
#endif

◆ DRAKE_VERSION_STRING

#define DRAKE_VERSION_STRING

Drake's full version string.

For a versioned release this looks like "1.51.1"; for a nightly or snapshot build like "0.0.20260721.143022+gitabc"; for an unstamped build it is "unknown".