Integrating C++ code generation into a large CMake build

CB Bailey

⏱ 90 minute session
16:00-17:30, Friday, 19th April 2024
At Bloomberg, we have invested heavily in a service-oriented architecture, with service owners defining the interface to their services through a schema. In order to simplify the task of writing a service and writing code which calls a service, we have developed internal tools that generate the C++ code for stub services and corresponding client libraries from their schemas. This way, engineers don't have to write boilerplate code and can concentrate on writing the code that provides business value.

As more teams have started migrating to CMake for their builds, we have put in considerable effort to integrate our code generation tools into CMake in the best way possible. This talk will explore the challenges we faced in developing our CMake integration, the implementation choices we made for the best possible developer experience and build performance, and how we roll out improvements to both the code generation tools and the CMake modules.

The three main topics covered in detail are:

  • Choosing between configure-time code generation and build-time code generation

  • Ensuring fast and consistent incremental builds

  • How to measure, test, and roll out code generation changes across a large code base

🏷 cmake
🏷 c++
🏷 code generation
🏷 build systems

CB Bailey

CB is a software engineer working at Bloomberg. CB works in infrastructure, writing and maintaining libraries, documentation and tools to help application developers write and maintain software than integrates and communicates in robust and efficient ways.

CB’s previous career in software has included roles in such diverse areas as web technology, business intelligence, data warehousing, defence and radar.

CB understands the importance of optimal software practices and so has a keen interest in source control systems, build systems and best practices surrounding their use.