BUILD.md

April 28, 2022 ยท View on GitHub

QEX application build guide

See INSTALL.md for installation instructions.

QEX applications can be built using either the standard make command or with nimble. The options and functionality are largely the same, with only a few minor differences.

Building executables

Build MethodCommand
Makemake [build option | Nim option]... [path]...
Nimblenimble make [build option | Nim option]... [path]...

Details on the build options are below.

The path is the name of the target to be compiled. It can include wildcards and parts of the path. Targets are searched for matches within the current directory and the nim source (src) and tests directories.

You can see a list of matching targets with the targets command, e.g.

make targets PATH

or

nimble targets PATH

Full command syntax

Build MethodCommand
Makemake [COMMAND] [build option | Nim option]... [path]...
Nimblenimble COMMAND [build option | Nim option]... [path]...

The command is required for nimble, but optional for make (it will default to the make command below).

Commands

CommandDescription
helpShow help message
showShow Nim compile flags
targetsShow available build targets. Targets NAME will search for targets matching NAME (can include standard shell wildcards)
cleanRemove contents of nimcache directory
testsBuild tests and create testscript.sh test runner
makeSearch for each [path]... as described below, compile, link, and put executables in bin

When using the make build method the make command is default and can be skipped.

Build options

OptionDescription
cccompile in C mode
cppcompile in C++ mode
debugset debug build
runrun executable after building
verbset build verbosity to N (verb:N), N in 0,1,2,3

Nim options

OptionDescription
-optionPasses -option to Nim compiler
:-optionPasses -option to Nim compiler (avoids issues with make/nimble trying to parse it).
:fooSets Nim define foo (equivalent to -d:foo).
:foo=barSets Nim define foo to value bar (equivalent to -d:foo=bar).

Path

PATHDescription
foo.nimSearch for file matching *foo.nim in source paths (including subdirectories, but not following links)
fooSearch for both *foo.nim and *foo, if a directory matches compile all *.nim in it

Note: only one match is allowed, specify part of path to resolve ambiguity

source paths: ., qex/src, qex/tests

Examples:

  make debug test0
  make example/testStagProp
  nimble make debug test0
  nimble make example/testStagProp