Compiling CMAKE VCPKG

Disclaimer

WARNING: CMake build is NOT officially supported and should be used for dev purposes ONLY.

For the official way to build CataclysmDDA, see:

Contents

  1. Prerequisites
  2. Configure
  3. Build
  4. Install
  5. Run

1 Prerequisites

cmake >= 3.20.0
vcpkg from vcpkg.io msgfmt (optional) as part of Git Bash or msys2 in the default install paths.

2 Configure

Presets

The file CMakePresets.json contains all the presets.
They will all build the code into the directory out/build/<preset>/.

vcpkg

If vcpkg is checked out in a location different from C:\vcpkg, eg. C:\dev\vcpkg, you must do one of the following:

  • append -DVCPKG_ROOT=C:\dev\vcpkg (or whatever the path is) to any cmake configure commands
  • set the environment variable VCPKG_ROOT to the path to the vcpkg checkout.
  • edit the VCPKG_ROOT cache variable in CMakePresets.json to the appropriate path

Visual Studio

The Standard toolbar shows the presets in the Configuration drop-down box.
From the main menu, select Project -> Configure Cache

If you do not have msgfmt available, or do not want to include translations with the build, you need to additionally set DLOCALIZE=OFF. To do this, go to Project -> CMake Settings, scroll to the bottom where "windows-tiles-sounds-x64-msvc" is defined, and under "cacheVariables" change the value from "LOCALIZE": "True" to "LOCALIZE": "OFF".

  • Note: doing this will change the CMakePresets.json file which is tracked by source control. Do not commit this change.

Terminal

Run the command

  • cmake --list-presets
    It will show the presets available to you. The list changes based on the environment you are in. If empty, the environment is not supported.

Run the command

  • cmake --preset <preset>

If you do not have msgfmt available, or do not want to include translations with the build, you need to additionally pass -DLOCALIZE=OFF.

  • cmake --preset <preset> -DLOCALIZE=OFF

3 Build

Visual Studio

From the Standard toolbar’s Build Preset drop-down menu select the build preset.
From the main menu, select Build -> Build All

Terminal

Run the command

  • cmake --build --preset <preset>

4 Install

Visual Studio

From the main menu, select Build -> Install CataclysmDDA

Terminal

Run the command

  • cmake --install out/build/<preset>/ --config RelWithDebInfo

5 Run

## Visual Studio From the Standard toolbar’s Select Startup Item… drop-down menu select cataclysm-tiles.exe (Install)
The Project Configuration drop-down menu will show RelWithDebInfo.
You can now Start Without Debugging (default Ctrl+F5) or Debug -> Start Debugging (default F5).

## Terminal Run the commands

  • cd out/install/<preset>/
  • cataclysm or cataclysm-tiles.exe