BullseyeCoverage Up Contents Search

Ninja

If you use CMake to generate Ninja files, see CMake.

Method 1: Find Interceptors with the PATH

Choose this method if you want your build process to operate similarly regardless of whether BullseyeCoverage is installed or not.

  1. Set the PATH environment variable with BullseyeCoverage/bin before your compiler. When your build system invokes the compiler, it finds and invokes the interceptor. BullseyeCoverage finds your compiler further along in the PATH.

    For example, on Windows:

    set PATH=%ProgramFiles%\BullseyeCoverage\bin;%ProgramFiles%\Microsoft Visual Studio\VC\bin;%PATH%
    

    For example, on Unix-like systems:

    PATH=/opt/BullseyeCoverage/bin:/opt/compiler/bin:$PATH
    

  2. Modify the compile and link rules to invoke the compiler using its basename, rather than its absolute path. For example:
    rule cc
      command = /opt/compiler/bin/g++ -c $in -o $out    ← wrong
      command = g++ -c $in -o $out                      ← correct
    
    rule link
      command = /opt/compiler/bin/g++ $in -o $out       ← wrong
      command = g++ $in -o $out                         ← correct
    

Method 2: Invoke covc Directly

Choose this method if either you cannot modify the PATH environment variable or you must invoke your compiler using an absolute path.

With this method, your build process invokes the covc program, passing your compiler command as arguments. For example:

rule cc
  command = covc -i /opt/compiler/bin/g++ -c $in -o $out

rule link
  command = covc -i /opt/compiler/bin/g++ $in -o $out

Updated: 31 Jul 2024