Quick-start
On this page
Create a project
Start by creating a Nittofile
in your project’s folder; best is the root-folder of your project or git-repository if you use one.
Lets say we have following structure for an c++ based project:
hello_world
├── includes
│ └── lib
│ └── lib.h
├── src
│ ├── lib
│ │ └── lib.cpp
│ └── app
│ └── main.cpp
└── Nittofile
Then we put the following in your Nittofile
:
# Everything after an hash is considerd a comment in Nitto until a newline
plugin "c_cpp" # Activate the builtin plugin that provides support for c/c++
# The string "lib" is the technical name of your target and can (nearly) everything you like!
target "mylib" {
# This sets the language the target is written in,
# which also determines how the target is build.
lang "cpp"
# Tells Nitto that this target produces an library.
# In nitto there is no such thing as destinct "shared" or "static" libs.
# All libraries are always build as both shared and static versions!
type lib
# This is an source declaration and tells nitto
# to add all c++ compatible source files (i.e. .cpp .cc .c++ and so on)
# to the buildqueue, once this target's buildprocess is begun.
sources "./src/lib"
# This 'includes' declaration tells the c++ plugin to
# add an include directory when building.
#
# The second argument is optional and if set, has the effect that
# all targets that depend on this one will automatically get this
# include added to them.
includes "./includes/lib" public
}
target "myapp" {
lang "cpp"
type bin # Sets the target to build an executable / binary.
sources "./src/app"
use "mylib"
}
Building
Now we can simply run nitto
(or nitto build
(or nitto build myapp
)) to build our little application!
Running / Debugging
To run our project after it was builded, you also can use the nitto command to automatically use the right file:
nitto run myapp
And to debug your freshly baked application, you even can use the --debug
flag when running to start the debugger associated with the language of your target; in this case this would be gdb
:
# -d is shorthand for --debug!
nitto run -d myapp