Skip to content

Adding a New Supported Platform

Matthew LaRocca edited this page Jun 5, 2024 · 6 revisions

CMake configuration

Supporting a new platform will require the creation of a new toolchain or platform specific include file. These files live in the cmake top level directory.

configure_platform.cmake

This file contains platform specific configuration logic such as setting toolchain files or including other platform specific CMake file. This file is automatically included before any project call is made. Add a new entry here which will

platform specific cmake include file

This file is the main hook for configuring static libraries and games to be built for each specific platform. It can be used to set global CMake settings and must define two functions:

configure_core_library

This function should perform all platform specific configuration of the framework64 library. This is a good place to set options that all games will inherit as part of their build process.

This function should perform the following tasks:

  • Ensure that the asset include directory is set on the framework64 target via target_include_directories
  • Define the FW64_PLATFORM_IS_64_BIT if applicable.

create_game

This function performs all of the platform specific work to configure the creation of an individual game. In its implementation it should perform a target_link_libraries call to (at a minimum) the framework64 target. Additional platform specific pre and post build steps should be configured in this function.

This function should ensure that the platform specific main file is compiled into the game.

This function should accept the following Parameters:

Name Type Description
ALL_WARNINGS_AS_ERRORS Option Enables all warnings and treats them as errors
EXTRA_LIBS Multi Value additional libraries to link with the game
GAME_HEADER_PATH Single Value path to the header file which contains the Game struct. If not specified, "game.h" is used
SAVE_FILE_TYPE Single Value The type of save data to use for this game
SOURCES Multi Value All the game specific sources for the game
TARGET Single Value The name of the game to create

VSCode Configuration

c_cpp_properties.json

Add a new entry to the array of configurations. In most cases this should be a straightforward copy/paste of other entries

cmake-variants.json

Add a new entry to the "platform" object. In most cases this should be a straightforward copy/paste of other entries, however if there are any platform dependent CMake arguments that need to be passed in, they can be added here.

Docker Configuration

config directory

This directory contains the configuration files for each supported platform. Create a new directory here with the platform name. Place the .devcontainer.json file for the platform should live here.

config script

Add the new function for the platform to the scripts/ConfigureEnvironment.js script. This function should install the devcontainer.json file into the repo's root directory.

Asset Pipeline Configurations

Platform specific files should be placed in a new directory of the pipeline folder.

BuildInfo.js

Add an entry in this function for your platform which sets the buildInfo.target property. If it is a 64 bit platform, then add the target to the x64Targets array.

PrepareAssets.js

Add a call to the function defined above here.

Pipeline.js

Add an entry to the switch statement that loads the top level processing function from the platform specific pipeline files.

Starter Game Configuration

Update VS code code folder with new entries for c_cpp_properties.json and cmake-variants.json

Clone this wiki locally