Custom CMake for Nintendo Switch

Developed in November 2020

C++ CMake Cross-Platform Existing Codebase Nintendo Switch Tools


bannerImage
Custom CMake for Nintendo Switch
Introduction
Motivation
Understanding the Codebase
Writing the Generator
Similar Projects

Introduction

I had been working on a personal project that used CMake as a build tool. After working with the Nintendo Switch for university projects, I was very motivated to have my personal project work for the Switch as well. For this, I needed to generate project files that target the Switch, and I modified CMake's source code to add the Switch as a platform.

I can't go into too much detail about how the generator works or what the end product is like because I have signed an NDA. This also means I can't share the code as it would reveal those same details.


Motivation

It isn't that difficult to simply have CMake use a different compiler and that could have been done here as well, but that wouldn't meet all of my requirements because you need project files to do proper debugging.


Understanding the Codebase

Before I could write a custom generator, I needed to understand the codebase of CMake. This took quite some time, but I was able to unravel it eventually by stepping through the process in the debugger and taking notes.

I saw where the CMake files got parsed and how this was used to generate project files for other platforms. This helped me implement my own generator implementation and add it to the list of available ones.


Writing the Generator

After unraveling the source code of CMake, I was able to add my own generator to it to produce project files for the Nintendo Switch. I also added a few custom properties that the generator requires for settings that are unique to the Switch.

I have only tested the generator for my own use-case, but it has worked perfectly so far and I've built, ran, and debugged my project for the Switch many times with it.


Project tags: #C++, #CMake, #Cross-Platform, #Existing Codebase, #Nintendo Switch, #Tools


Similar projects:

Reboot: Cross-Platform Modular ECS Game Engine Thumbnail

Reboot: Cross-Platform Modular ECS Game Engine

Keep reading

Text-to-Speech Tool with Azure Thumbnail

Text-to-Speech Tool with Azure

Keep reading

Custom ECS Engine for Nintendo Switch Thumbnail

Custom ECS Engine for Nintendo Switch

Keep reading

More projects...