Skip to content

Build System Setup

Evren Imre edited this page Jul 10, 2021 · 2 revisions

Build System Setup

Organisation

  • CMakeLists.txt for the general setup
  • src/CMakeLists.txt for elements of setup that could be considered as "implementation details"
  • Each folder under src has its own CMakeLists.txt setting up targets for libraries, unit tests etc
  • cmake/ includes various modules

How Does It Work?

Toolchain-Specific Compiler and Linker Flags

  • Flags for a task/feature are passed around as variables in the form of, e.g. COMPILER_CXX_FLAGS.
  • Flags for GNU compilers are defined in HerdFlagsGNU. In order to add a new toolchain, see that file and how it is used.

Code Instrumentation (e.g. Coverage, Sanitiser)

  • HerdConfigureInstrumentation defines a target for each enabled option.
  • Each target defines its compiler and linker flags.
  • Then a new instrumentation target is created, with dependencies to the targets for the enabled options.
  • A target requiring instrumentation declares the instrumentation target as a dependency.