mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Add GCC codecoverage flags (#43066)
Summary: Rename `CLANG_CODE_COVERAGE` option to `CODE_COVERAGE` and add compiler specific flags for GCC and Clang Pull Request resolved: https://github.com/pytorch/pytorch/pull/43066 Reviewed By: scintiller Differential Revision: D23137488 Pulled By: malfet fbshipit-source-id: a89570469692f878d84f7da6f9d5dc01df423e80
This commit is contained in:
parent
91b090ceaf
commit
0cf4a5bccb
|
|
@ -138,7 +138,7 @@ option(BUILD_JNI "Build JNI bindings" OFF)
|
|||
cmake_dependent_option(
|
||||
INSTALL_TEST "Install test binaries if BUILD_TEST is on" ON
|
||||
"BUILD_TEST" OFF)
|
||||
option(CLANG_CODE_COVERAGE "Compile C/C++ with clang code coverage flags" OFF)
|
||||
option(CODE_COVERAGE "Compile C/C++ with code coverage flags" OFF)
|
||||
option(COLORIZE_OUTPUT "Colorize output during compilation" ON)
|
||||
option(USE_ASAN "Use Address Sanitizer" OFF)
|
||||
option(USE_TSAN "Use Thread Sanitizer" OFF)
|
||||
|
|
@ -596,10 +596,18 @@ if(USE_ASAN)
|
|||
string(APPEND CMAKE_LINKER_FLAGS_DEBUG " -fsanitize=address")
|
||||
endif()
|
||||
|
||||
# invoke clang code coverage flags
|
||||
if(CLANG_CODE_COVERAGE)
|
||||
# Add code coverage flags to supported compilers
|
||||
if(CODE_COVERAGE)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
string(APPEND CMAKE_C_FLAGS " --coverage -fprofile-abs-path")
|
||||
string(APPEND CMAKE_CXX_FLAGS " --coverage -fprofile-abs-path")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
string(APPEND CMAKE_C_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
|
||||
else()
|
||||
message(ERROR "Code coverage for compiler ${CMAKE_CXX_COMPILER_ID} is unsupported")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function(caffe2_print_configuration_summary)
|
|||
|
||||
message(STATUS " INTERN_BUILD_MOBILE : ${INTERN_BUILD_MOBILE}")
|
||||
|
||||
message(STATUS " CLANG_CODE_COVERAGE : ${CLANG_CODE_COVERAGE}")
|
||||
message(STATUS " CODE_COVERAGE : ${CODE_COVERAGE}")
|
||||
message(STATUS " USE_ASAN : ${USE_ASAN}")
|
||||
message(STATUS " USE_CUDA : ${USE_CUDA}")
|
||||
if(${USE_CUDA})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user