# Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary # source code may only be used and distributed under the Widevine # License Agreement. # gypi file to be included using --includes option while building oemcrypto # opk fuzz binaries. OPK classes needs to be instrumented with fuzzer # but only when being built for fuzzing. Instead of directly updating # oemcrypto_ta.gyp target, we use gypi in build_oemcrypto_fuzztests script. { 'target_defaults': { 'variables': { # Flag used to generate source based code coverage reports. 'generate_code_coverage_report%': 'false', # Flag to indicate that the code is being built with libFuzzer # instrumentation enabled. 'enable_fuzzing_instrumentation': 'true', }, # Include flags to build fuzzer binaries to generate source based code coverage reports. 'cflags': [ '-fPIC', '-O0', '-fno-omit-frame-pointer', '-U_FORTIFY_SOURCE', '-fsanitize=fuzzer,address,undefined', '-fno-sanitize-recover=address,undefined', # Need -g flag to include source line numbers in error stack trace. '-g3', ], 'cflags_c': [ '-std=c99', '-D_POSIX_C_SOURCE=200809L', ], 'cflags_cc' : [ '-frtti', '-std=c++11', ], 'ldflags': [ '-fPIC', # Sanitizers with link-time components must be repeated here. '-fsanitize=address', # Fuzzer is put on its own line so targets that need to swap it for # the version without a main function can easily find it. '-fsanitize=fuzzer', ], 'libraries': [ '-lpthread', ], 'defines': [ 'OPK_LOG_LEVEL=LOG_NONE', ], 'conditions': [ ['generate_code_coverage_report=="true"', { # Include flags to build fuzzer binaries to generate source based code coverage reports. 'cflags': [ '-fprofile-instr-generate', '-fcoverage-mapping', ], 'ldflags': [ '-fprofile-instr-generate', '-fcoverage-mapping', ], }], ], }, }