From SLangTNG

Contents

How to compile

Compilation on UNIX-like systems

The main configuration script is located in the root directory,

sh ./main.sh

It configures the CMake build environment and compiles external packages (if they are checked out from internal repos). All required subroutines are located in ./cmake_subroutines.

The following commands are needed in the defined order:

  • Create a utility file used to compile the external packages.
./main.sh make.inc
  • Compile the external packages
./main.sh externals nproc
where nproc is an optional number defining the number of parallel compiler processes
  • Create/Update CMake build environment (default on Linux: with debug symbols)
./main.sh cmake
  • Create/Update CMake build environment without debug symbols:
./main.sh cmake_release
  • Change into build directory to use CMake's environment
cd ./build
  • Display all targets
make help
  • Example: Compile driver tngbatch using 4 parallel compiler processes
make tngbatch -j4
  • Example: Compile driver tngbatch and display all detailed commands
make tngbatch VERBOSE=1
  • Example: Compile doxygen documentation
make doc
  • Example: Clean all object files
make clean
The Makefile environment created by CMake can also be called from the root directory via
make -C ./build tngbatch -j4 VERBOSE=1
  • Clean CMake build environment
rm -rf ./build
  • Clean external packages
./main.sh clean_externals

Adding a module

Modules are encapsulated parts which are NOT third-party libraries, but which may be considered as standalone libraries. They may depend on TNG's external libraries and on other modules. They are encapsulated in order to enable and disable certain functionalities.

A module must be added to the module directory with the following directory structure:

/modules/name
is the module main directory
/modules/name/CMakeLists.txt
describes the cmake instructions for this module
/modules/name/name
should contain all C++, C, Fortran source files
/modules/name/doc/src/Doxyfile.in
is the template for Doxyfile generated by cmake and used for compiling the API documentation. It usually does not differ from /doc/src/Doxyfile.in
/modules/name/doc/src/mainpage.dox
should at least contain a link to the parent documentation
/modules/name/doc/src/
should contain further input files used by doxygen

Any module must be announced to configuration files in the upper levels. In /modules/CMakeLists.txt one has to add the new module to the list of modules and one has to set its dependencies, but only the dependencies onto other modules. Dependencies on external libraries must be defined in the own CMakeLists.txt.

The usual CMakeLists.txt

  • defines a list of directories where all source files are automatically fetched from,
  • defines a list of test drivers (each test driver should be a single source file),
  • defines a list of include directories and libraries to be linked against (those should be set using the appropriate find macros provided by cmake or by TNG - located in /cmake_subroutines),
  • enables the test environment
  • enables the Doxygen documentation
  • adds local targets for its library, for its tests and documentation and adds these targets as dependencies to the main make targets "doc", "lib" and "test".

Adding a driver

Drivers are executables which provide individual implementations of the TNG modules. Popular drivers are

  • a Lua interpreter working in batch mode and providing bindings to most modules,
  • a Lua interpreter providing a simple GUI and providing bindings to modules including GUI methods.

A driver must be added to the drivers directory with the following directory structure:

/drivers/name
is the module main directory
/drivers/name/CMakeLists.txt
describes the cmake instructions for this module
/drivers/name/name
should contain all C++, C, Fortran source files
/drivers/name/doc/src/Doxyfile.in
is the template for Doxyfile generated by cmake and used for compiling the API documentation. It usually does not differ from /doc/src/Doxyfile.in
/drivers/name/doc/src/mainpage.dox
should at least contain a link to the parent documentation
/drivers/name/doc/src/
should contain further input files used by doxygen

Any driver must be announced to configuration files in the upper levels. In /drivers/CMakeLists.txt one has to add the new driver to the list of drivers and one has to set its dependencies, but only the dependencies onto other modules. Dependencies on external libraries must be defined in the own CMakeLists.txt.

The usual CMakeLists.txt

  • defines a list of directories where all source files are automatically fetched from,
  • defines a list of test drivers (each test driver should be a single file which is passed as a command line argument to the executable),
  • defines a list of include directories and libraries to be linked against (those should be set using the appropriate find macros provided by cmake or by TNG - located in /cmake_subroutines),
  • enables the test environment
  • enables the Doxygen documentation
  • adds local targets for its library, for its tests and documentation and adds these targets as dependencies to the main make targets "doc", "lib" and "test".

Links

Information for users
Personal tools