build - morinim/ultra GitHub Wiki

Build requirements

Ultra is designed to have minimal requirements for building and integrating with your projects, though some dependencies are necessary. Currently, we support Linux and Windows. We will also make our best effort to support other platforms (e.g. macOS, BSD). However, since core members of the Ultra project have no access to these platforms, there may be unresolved issues. If you encounter problems on your platform, please report them via the issue tracker; patches to fix them are especially welcome!

Mandatory

  • A C++22-standard-compliant compiler
  • CMake

Optional

Setting up the build

In most cases, simply running:

cd ultra
cmake -B build/ src/

is sufficient. For more information, refer to the platform specific details sections below.

You can now build the project using the underlying build tool:

  • everything: cmake --build build/
  • kernel library (libultra.a): cmake --build build/ --target ultra
  • the ABC example: cmake --build build/ --target ABC
  • for a list of valid targets: cmake --build build/ --target help

The output files are stored in sub-directories of build/ (out-of-source build).

Platform specific details

Unix

To specify a compiler explicitly, run:

CXX=clang++ cmake -B build/ src/

Windows

Prerequisites

There are many possibilities:

Visual Studio 2022 (or newer) and CMake

This is our preferred method for building and testing Ultra on Windows.

Visual Studio does not require any special setup beyond the general instructions above.

Windows Subsystem for Linux
  1. Install the Windows Subsystem for Linux, preferably with the Ubuntu distribution.

  2. Update your WSL environment:

    sudo apt update
    sudo apt upgrade
    
  3. Install the development tools:

    sudo apt install build-essential g++
    sudo apt install cmake
    
  4. Clone the Ultra repository:

    git clone https://github.com/morinim/ultra.git
    

Follow the general instructions for building the project.

MinGW and CMake
  1. Download and install a full MinGW. Install it in a non-system folder (e.g. C:\MinGW\).

  2. Download and install CMake. During installation, ensure you check the option to add CMake to the system PATH.

  3. Download and install Git (if not already installed).

  4. Run CMake:

    cd C:\ultra
    cmake -G "MinGW Makefiles" -B build/ src/
    

    Note: the default generator for Windows is set to NMake. The "MinGW Makefiles" generator produces makefiles that use cmd.exe as shell and don't require a Unix shell (see cmake command line -G option).

Additional tips:

  • we recommend the MinGW distribution available at nuwens.net, which is easy to install and kept up to date. However, any recent MinGW distribution should work.
  • if you experience long delays when running make, try make -r (avoids implicit rules).
WinLibs and CMake
  1. Download the full distribution of Winlibs and install it in a non-system folder (e.g. C:\WinLibs\).

  2. Download and install CMake. make sure to enable the option to add CMake to the system PATH.

  3. Download and install Git (if not already installed).

  4. Run the standard build setup:

    cd ultra
    cmake -B build/ src/
    cmake --build build/
    

    Note: this method works similarly to the general instructions and does not require special generators or Unix shells.