C/C++

This plugin provides the C and C++ programming languages to nitto. To enable this plugin, put plugin "c_cpp" at the top of your buildfile.

Using c/c++

To use c/c++ in a target, you need to set the language:

  • lang "c" for C
  • lang "cpp" (or cxx / c++) for C++

C/C++ allow for one extra parameter after the language itself: the language standard. This argument can either be a numeric value, a string or a symbol.

Allowed values are

  • for C:
    • the regex ^(?:gnu|c)?(?:90|89|99|9x|11|1x|17|18|2x)$
    • or iso9899: following by either of the following: 1990 199409 19999 199x 2011 2017 2018
  • for C++:
    • the regex ^(?:(?:gnu|c)\\+\\+)?(?:98|03|11|0x|14|1y|17|1z|20|2a|2b|23)$

Commands

inc / includes

Add a include directory to the target. Allows the special build:// and out:// prefixes.

Arguments
# Name Type Info
0 path str

Folder to use as a include dir

Expanded?: ✅
1 public (optional) sym

When present, the include dir is also given to dependants.

Allowed values:
  • public

libdir

Adds a library directory to the target. Allows the special build:// and out:// prefixes.

Arguments
# Name Type Info
0 path str

Folder to use as a library dir

Expanded?: ✅
1 public (optional) sym

When present, the library dir is also given to dependants.

Allowed values:
  • public

Adds a link (dynamic library) to the target.

Arguments
# Name Type Info
0 link str

The link to add.

Expanded?: ✅
1 public (optional) sym

When present, the link is also given to dependants.

Allowed values:
  • public

define

Defines a preprocessor symbol for the target.

Arguments
# Name Type Info
0 value str

The value; same as using -D on your c/c++ compiler.

Expanded?: ✅
1 public (optional) sym

When present, the define is also given to dependants.

Allowed values:
  • public

flag

Adds a raw compilerflag to the target.

Arguments
# Name Type Info
0 value str

The flag that should be given to the compiler.

Expanded?: ✅
1 public (optional) sym

When present, the flag is also given to dependants.

Allowed values:
  • public

Toolchains

The c/c++ plugin gets its information which binaryies to call from the toolchain. Values used:

  • ar: archiver, used for static library creation
  • sh: shared linker, used for shared library creation
    • shflags: flags for the shared linker
  • ld: linker, used when linking a binary
    • ldflags: flags for the linker
    • ld_rpath_origin: flags to enable searching for shared libraries in the folder of the binary
  • windres: Windows ressource file compiler; transforms .rc files
  • cxx: c++ compiler
    • cxxflags: flags for the c++ compiler
  • cc: c compiler
    • cflags