Build Options

Configuration

The LightNet source code must be configured before being built. This process uses a configure script in the project root. You can configure LightNet with the following invocation:

chmod +x configure
./configure [<option>[=<value>]...]

Various configuration options can be passed to configure on the command line. It then checks dependencies and print makefile variables in config.mk, which will then be included by other makefiles.

Here is a list of the configuration options, which can also be printed by ./configure -h. Default options are showed in brackets.

  • -h, --help print help information
  • --target=<name> target name [lightnet]
  • --abbr=<abbr> abbreviation name [ln]
  • --build-dir=<path> building directory [build]
  • --install-dir=<path> installation directory [/usr/local]
  • --pkgconfig-dir=<path> pkgconfig directory [/usr/local/lib/pkgconfig]
  • --with-cuda=<bool> set to yes if build with CUDA [no]
  • --with-cudnn=<bool> set to yes if build with cudnn library [no]
  • --cuda-install-dir=<path> cuda installation directory [/usr/local/cuda]
  • --with-tensorrt=<bool> set to yes if build with TensorRT [no]
  • --tensorrt-install-dir=<path> tensorrt installation directory [/usr]
  • --debug=<bool> set to yes when debugging [no]
  • --doc=<bool> set to yes if build the documents too [yes]

Make Options

Once you have LightNet configured, you can build it by issuing the following command:

make

If you have multiple processors in your machine, you may wish to use some of the parallel build options provided by GNU Make. For example, you could use the command:

make -j2

There are several targets which are useful when working with the LightNet source code:

  • make
  • make all

    Compile binaries, compile and run tests, and build the documentation if configured with --doc=yes. Binaries, header files and documents will be generated in a hierarchy under the configured build directory, specified with --build-dir, which defaults to build.

  • make bin

    Compile executables.

  • make test

    Compile and run tests.

  • make doc

    Build the documentation if configured with --doc=yes.

  • make install

    Install the build directory under the configured install directory, specified with --install-dir, which defaults to /usr/local.

  • make clean

    Remove all files generated by the build. This includes object files, generated C/C++ files, libraries, executables and documentation.

  • make uninstall

    Remove all the files installed by make install.

  • make info

    Show a brief information of make targets.