Build with Golem

Cross-platform Build System for Modern C++

Getting Started

Minimal

golemfile.py
def configure(project):
  project.program(name='hi', source='src')
Build + Enable clangd support
golem configure --clangd
golem build

Conditions

# define a program, library, dependency or export
task = project.program(...)

# apply compiler flags only for gcc
task.when(compiler='gcc',
      cxxflags=['-fstack-protector-all'])

Dependencies

# triggers the recipe mechanism
project.dependency(
  name='json',
  repository='https://github.com/nlohmann/json.git',
  version='^3.0.0', # Resolves to v3.12.0
  shallow=True
)

# link the dependency
project.program(..., deps=['json'])

Supports Qt 5/6

# golem configure --qtdir=<path>
project.program(
  name='hello-qt',
  source=['src'],
  moc=['src'],
  features=['QT6CORE'] # QT6WIDGETS, etc.
)

Libraries

# define the library
project.library(name='mylib', ...)

# export the library
project.export(name='mylib',
                includes='mylib/include')

# link the library
project.program(..., use=['mylib'])

Tidy

# all my compiler flags
# can be extracted into a dependency
task = project.export(name='global',
                     cxxflags=['...'])
task.when(variant='debug',
       cxxflags=['...'])

# my targets
project.library(..., use=['global'])
project.program(..., use=['global'])

Customizable

# dependencies can be customized too
task = project.dependency(...,
  version='main' # Follow branch 'main'
  variant='release', # Force release
  link='static', # Force static linking
  cxxflags=['...'] # Add compiler flags
)
task.when(osystem='windows',
          defines=['FOO_BAR'])

Start using Golem

pipx

pipx install golemcpp

pip

pip install golemcpp

Contribute

See you on GitHub