Skip to main content

license GitHub Repo stars

Getting Started with xcdl

Separate User/Contributor/Maintainer pages

To meet the specific needs of different audiences, this site features separate User's Guide, Contributor's Guide and Maintainer's Guide pages. This way, each group can easily find the information and resources most relevant to them.

note

Work in progress.

What is xcdl?

xcdl, short for xPack CDL, is a Node.js CommonJS module and a CLI application designed to automate component and builds for C/C++ projects. It draws inspiration from eCos CDL.

CDL - Component Definition Language is an advanced technology for configuring and building projects, introduced by the eCos free open-source real-time operating system, which is intended for embedded applications.

xCDL was inspired by CDL but, as part of the Node.js ecosystem, it migrated the original Tcl configuration scripts to JSON files and reimplemented the logic in TypeScript.

Why not kconfig?

Kconfig, is the configuration mechanism originally used by the Linux kernel and later adopted by other projects too.

Although the goals are somehow similar, the concepts differ. The language employs a custom syntax, and generally, using it for typical embedded projects can be a challenge.

What is a component?

As a brief definition, an xCDL component is a generic unit of functionality that includes one or more related source files. These files share common configuration data (such as preprocessor definitions) and are compiled together, using the same compilation options.

Components Author's Guide

Using xcdl with existing components is relatively straightforward. Creating new components or adding the xCDL metadata to an existing project is a bit more difficult and requires an understanding of the xCDL concepts and metadata, which are documented in the Components Author's Guide.

Features

By design, the xPack framework aims to automate:

  • managing dependencies
  • managing build configurations
  • the component configurations process
  • the build process

While the management of dependencies & build configurations is handled by xpm, the configuration & build processes are covered by xcdl.

xcdl enhances cross-platform builds and tests with its distinctive features:

  • Cross-Platform Support: Operates seamlessly on Windows, macOS, and GNU/Linux.
  • Compile-time configurability: Allows behaviour to be controlled during compilation.
  • Per-component source files: Divides the project into components, each with its own set of source files.
  • Per-option preprocessor definitions: When components and options are individually enabled or disabled, this determines which lines are generated in a configuration header file. Specifically, each enabled component or option triggers the generation of corresponding #define statements in the header file.
  • Enforce constraints: Components and options can define ranges of values and/or interdependencies with other objects.
  • Build Configurations: Manages multiple build configurations, such as debug/release builds or platform-specific tests.

Benefits

  • Being able to develop exactly the same project on Windows, macOS and GNU/Linux provides team members with the flexibility to use their preferred platform.
  • Disabled components automatically have their source files excluded from the build process, allowing for coarse granularity in excluding unused code.
  • Automatically generated preprocessor definitions allow for precise control over the inclusion of code and data, ensuring that only the necessary elements are compiled.
  • Compile-time control at the individual statement level optimises the build process by excluding unnecessary code, leading to more efficient and manageable projects.
  • Enforcing constraints enables to:
    • generate a consistent set of preprocessor definitions
    • validate the configuration even before the compilation step
  • Managing separate configurations for multiple build setups facilitates convenient testing across different platforms, such as native and/or embedded.

Install

xcdl is a npm package available from the npmjs.com public registry and can be installed via npm.

tip

The easiest way to get the install command is from the website's homepage. Simply hover the mouse over the command, and a copy button will appear on the right side. Click it to copy the command.

For comprehensive installation instructions, please visit the Install Guide page.

The xcdl project is currently in early implementation phase.

Compatibility notices

According to SemVer rules:

Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API.

License

The original content is released under the MIT License, with all rights reserved to Liviu Ionescu.

MacStadium

Credits

Special thanks to MacStadium, for providing the Apple Silicon development infrastructure as part of their generous Free and Open Source Software program.

Enjoyed using this project? Let us know!

If you enjoyed using this project, please let us know! Here are some ways you can show your support:

  • Donate: Your contributions, whether small or generous, help us keep the xPack projects thriving. Donate
  • Star the project on GitHub: It helps others discover our work.
  • Follow us on X/Twitter: Stay updated with our latest releases and news.