Getting started

Setting things up

After cloning build somewhere in your project hieararchy, you’ll want to add GENie scripts for your projects. Main build script is always nameed genie.lua - this is the place where we will normally define our solutions. But we want to be able to use those projects as part of bigger projects as well as be able to create independent solutions for quick development, testing, prototyping, etc.

The way to do this is to have one genie.lua script that defines a solution for each project and an additional script that shares the library name where actual project specifics are defined. Since relocating projects and using them in a modular fashion is one of the main goals, every solution script starts with the same code that scans the disk for the location of build project by tracing directories up:

This is not mandatory and it’s generally sufficient to just load build.lua, but I’ve found that this works really well for me when it comes to taking projects out of a big solution and distributing them stand alone.

Defining solution and loading projects

Defining a solution is just a few lines of Lua script as well, below is an example of how this may look:

The bulk of work is actually done in a call to loadProject function. This function will scan the disk for a directory named ‘MyStartProject’, GENie scripts located at ‘MyStartProject/genie’ directory and setup a new project, its dependencies and so on.

build does make some assumptions about the physical structure of projects and here’s how it should normally look:

📂 MyStartProject
  📄 README.md
  📂 genie
     📄 genie.lua
     📄 MyStartProject.lua
  📂 inc
     📄 MyStartProject.h
     📄 file022.txt
  📂 samples (optional, for library projects)
  📂 src
     📄 MyStartProject_pch.h
     📄 MyStartProject_pch.cpp
     📄 MMyStartProject.cpp
  📂 test

With the project set up like this, it is possible to generate a full project solution along with samples and so on using genie.lua or use MyStartProject as a project in a bigger solution using MyStartProject.lua. build provides convenience functions to deal with this setup.