Getting Started

Installing Golem

Requirements: Python 3.10 or later, Git

Using pipx (recommended, creates a virtual environment):

pipx install golemcpp

# Or install it for all users
pipx install --global golemcpp

Alternatively, using pip:

pip install golemcpp

Since Golem is evolving fast, to upgrade it run:

# When using pipx
pipx upgrade golemcpp

# When using pipx for all users
pipx upgrade --global golemcpp

# When using pip
pip install --upgrade golemcpp

First project

Everything starts with golemfile.py. Create it at the root of your project directory.

Here is an example to compile a Hello World program:

golemfile.py
def configure(project):
    project.program(name='hello',
                    source=['src'])

The project variable is the entry point to declare dependencies, libraries and programs that make up the project.

  • 'hello' is the name of the program being compiled (e.g. hello.exe or hello-debug.exe)
  • 'src' is the directory where all source files are expected to be found (recursively) for ‘hello’
src/main.cpp
#include <iostream>
int main()
{
    std::cout << "Hello World!\n";
    return EXIT_SUCCESS;
}

Have a look at the full example in examples/hello.

Building the project

To build the program, run:

# For a debug build
golem configure --variant=debug

# Or, for a release build
golem configure --variant=release

# In both cases, continue with
golem build

The built artifacts are located in build/bin.

Debug artifacts are suffixed with "-debug" by default.