0

I decided to use gyp as a build system for my project on linux. I am happy with basic functionality (target declarations, dependencies, hierarchies etc.) but I have some problems with customization.

I have a Core project which is built as a library and bunch of unit tests for the library which compiles into separate executable and has core project as a dependency. Now I want to measure test coverage with gcov and it means that the library itself should be built with different compilation options, and these options should be used only for test build.

I just can't realize how to achieve this with gyp. Thank you in advance for any ideas.

roman-kashitsyn
  • 539
  • 3
  • 14

1 Answers1

0

I've found a solution and decided to share it. What I actually needed is just to add another configuration:

'configurations': {
  # Or just let Debug configuration turn on coverage
  'Coverage': {
    'conditions': [
      ['OS=="linux"', {
          'cflags': ['--coverage'],
          'ldflags': ['-fprofile-arcs']
        }],
    ]
  },
  # More configurations
}

UPD: Looks like there is another way to do it - specify additional coverage flags inside direct_dependent_settings dictionary of the test target.

roman-kashitsyn
  • 539
  • 3
  • 14