Skip to main content

10 posts tagged with "c++"

View All Tags

Automated Testing for Seamless CMake Config File Integration

· 13 min read
Christopher McArthur
C++ DevOps Expert

As a C++ developer, ensuring your library integrates flawlessly with other projects is crucial for driving adoption. CMake being the defacto standard plays a vital role in this process by providing installed configuration files; guiding consumers on how to find and utilize your library using find_package. But how do you guarantee these config files are installed correctly and provide all the necessary information? Enter automated testing!

This blog post explores an approach for testing CMake config files inspired by Behavioral Driven Development practices and showcases a powerful implementation on GitHub Actions featuring 14+ test cases.

Why Test CMake Config Files?

Imagine creating a fantastic C++ library, only to have users encounter missing headers or library paths when they attempt to integrate it within their builds. This very real headache is why many open-source developers have opted for header-only libraries. "Just copying the headers" eventually became the norm. However, this trend has culminated in ballooned build times, as the preprocessing stage can become a bottleneck.

Breaking down the 2024 Survey Results

· 13 min read
Christopher McArthur
C++ DevOps Expert

It's that time of year once again! The ISO Committee published the summary of the results for the C++ Developer Survey "Lite". This has been running for several years and it's probably the first time we can start to see some trends... hopefully!

The survey results, with less than 1300 developers compared to 1700 last year, is only partially explained by third-party restrictions as noted by the blog post sharing the results. Regardless a wider sample would be ideal. The dominance of CMake with an 83% market share is striking. Could this 4% growth be linked to the lower burden for managing build scripts? Despite these limitations, the survey offers valuable insights into C++ ecosystem trends.

Since this blog is all about building and shipping C++ software, I'll be focusing on the tooling and ecosystem questions and results. There's a natural bias here, as I'm particularly interested in how these trends affect developers like us. But fear not, there's plenty for everyone! In fact, I'm curious what aspects other bloggers will delve into. Let's jump right in as there are some fascinating statistical correlations to explore!

Const Correctness for C++ Builds

· 6 min read
Christopher McArthur
C++ DevOps Expert

In the ever-evolving world of software development, ensuring code quality and maintainability is paramount. Two seemingly unrelated concepts, const correctness in C++ and ephemeral build environments from DevOps, share a surprising connection, both aiming to build a strong foundation for reliable software.

Const Correctness: Enforcing Immutability in Code

Const correctness is a programming paradigm in C++ that emphasizes the use of the const keyword to explicitly declare variables and objects that shouldn't be modified. This enforces a form of immutability within your code. Just like an immutable object in other languages, a const variable cannot have its value changed after initialization.

CPS: A Streamlined Future for C++ or Overly Specific?

· 6 min read
Christopher McArthur
C++ DevOps Expert

The most relevant problems for C++ developers are package management, setting up CI/CD pipelines, and maintaining build scripts. Talking to developers and builds teams the cause of that frustration is the lack of interoperability between build systems.

The Common Package Specification (CPS) aims to revolutionize C++ development by standardizing how dependencies are described. While the core concept holds promise, specific aspects raise questions about its practicality within the C++ ecosystem.

C++ Package Managers: The Ultimate Roundup

· 13 min read
Christopher McArthur
C++ DevOps Expert

C++'s journey with dependency management has seen numerous transformations. Early years were marked by manual library integration and complex build scripts, presenting significant challenges. However, the landscape has since evolved, offering an array of sophisticated package managers designed to streamline workflows but most of all reduce the burden on developers.

Join in and delve into the strengths and weaknesses of these diverse solutions, empowering you to make informed choices and conquer the challenge of dependency management in your C++ endeavors.

Comparing Linux System Package Managers with C++ Package Managers

· 3 min read
Christopher McArthur
C++ DevOps Expert

Feeling lost in the jungle of C++ package managers? You're not alone. Wrangling dependencies in the C++ world can feel like navigating a tangled mess of vines, with cryptic tools and endless options leaving you frustrated. But fear not, intrepid C++ developer! This guide will cut through the undergrowth and help you get on the right path.

First things first: Let's dispel a common misconception. System package managers like rpm and apt are great for keeping your operating system humming, but they're not designed for the unique challenges of C++ development. That's where C++ specific package managers like vcpkg, Conan, and Xrepo come in.

Unlock Efficiency & Innovation in C++ Development: Building More Configuration than You Ship

· 4 min read
Christopher McArthur
C++ DevOps Expert

In the steadily evolving landscape of C++, where incremental improvements shape the tools we use, it can quickly become a challenge to stay up to date with the latest technologies while still supporting the code already in production. If you're apart of the 61% of C++ developers, the concept of building more configurations might initially seem counterintuitive. However, it's precisely under such circumstances that this approach serves as a solution to the challenge of limited access to new features and tools within the C++ ecosystem.

By prioritizing testing a comprehensive list of configuration during CI, your team can unleash access to new features and tools, boosting productivity and ensuring project longevity and compatibility in a competitive landscape by establishing guardrails for the project.

Let's delve deeper into the compelling reasons why this DevOps approach, centered around building more configurations, deserves widespread adoption in C++ environments.

Optimizing CI Build Scripts and Enhancing Developer Experience with CMake Presets

· 7 min read
Christopher McArthur
C++ DevOps Expert

Managing build scripts, especially in C++, can be a daunting task for development teams. CMake, with its powerful toolkit, offers a solution to this challenge. In this blog, we'll delve into the world of CMake presets and explore how they can significantly reduce CI build script complexity, leading to a more efficient and enjoyable development experience.

The Challenge of Build Scripts in C++

C++ teams often struggle with an extensive list of build systems, introducing layers of complexity. CMake, when mastered, becomes a game-changer. This blog focuses on CMake's key pillars: toolchains, presets, and build scripts. Understanding their roles and interactions is crucial for achieving a streamlined developer experience and unambiguous CI workflows.

Join us on a journey where we'll:

  • Empower developers with effortless configuration and cross-platform builds.
  • Simplify CI pipelines for efficient testing.
  • Elevate project maintainability and collaboration across diverse environments.

From Scratch to Scalable: Seamless CI for C++ Windows Build Infrastructure with Ansible and Terraform

· 10 min read
Christopher McArthur
C++ DevOps Expert

One of the biggest challenges in C++ is setting up CI from scratch and of that, the biggest pain point is the system administration which can be very disconnected from the development tools. In order to bridge this gap we can leverage Infrastructure as Code (IaC) targeting existing machines, locally in our network or in the cloud, is an excellent enhancement to ensure consistent reproducible builds. Having version controlled configuration management tied to the codebase is key, this will allow us to deterministically install all the tools required with confidence even in the far far future.

Let's walk through adding Ansible to handle configuring a Windows virtual machine. These ideas apply to Unix environments as well but we can tackle those in a future post. Once we've gained control over our build environments, we can tackle availability and scalability by introducing Terraform to help provision and initialize new Windows instances in Azure. This two prong solution enables both a path for migrating to the cloud and establishing a hybrid setup.

Revolutionizing C++ Development: A DevOps Odyssey

· 4 min read
Christopher McArthur
C++ DevOps Expert

In the ever-evolving landscape of C++ development, challenges abound, but the journey to overcome them has a powerful ally: DevOps. The annual ISO committee's survey paints a vivid picture of the hurdles faced by C++ developers, but within these challenges lie opportunities for transformation through DevOps principles and cutting-edge technologies like Artifact Management, Infrastructure as Code (IaC), and Platforms as a Service (PaaS).

Unveiling the Challenges

The 2023 ISOCPP Survey echoes the sentiments of C++ developers grappling with key issues:

  1. Managing libraries my application depends on: 83%
  2. Build times: 81%
  3. Setting up a continuous integration pipeline from scratch: 72%
  4. Managing CMake projects: 67% (MakeFiles MSBuild)
  5. Setting up a development environment from scratch: 67%