mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
Made coverage html output optional.
This commit is contained in:
parent
061609322a
commit
dd8ff8db12
@ -10,14 +10,15 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE)
|
||||
message(STATUS "set build type to ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
||||
STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Profile")
|
||||
|
||||
option(SUPPORT_STDIOSTREAM
|
||||
"If enabled provides support for << operator (as used with
|
||||
std::cout)" OFF)
|
||||
option(TESTING "Enable testing" OFF)
|
||||
"If enabled provides support for << operator (as used with std::cout)" OFF)
|
||||
option(TESTING "Enable testing" OFF)
|
||||
option(FORMAT "Enable formatting" OFF)
|
||||
option(COV_HTML "Display html for coverage" OFF)
|
||||
|
||||
if(SUPPORT_STDIOSTREAM)
|
||||
add_definitions(-DSUPPORT_STDIOSTREAM)
|
||||
@ -56,8 +57,6 @@ set(CMAKE_CXX_FLAGS
|
||||
)
|
||||
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
enable_testing()
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR})
|
||||
|
||||
file(GLOB_RECURSE COV_SRCS matrix/*.hpp matrix/*.cpp)
|
||||
@ -96,3 +95,5 @@ set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
||||
set(CPACK_PACKAGE_CONTACT "james.goppert@gmail.com")
|
||||
include(CPack)
|
||||
|
||||
# vim: set noet fenc=utf-8 ft=cmake ff=unix sts=0 sw=4 ts=4 :
|
||||
|
||||
@ -27,13 +27,30 @@ foreach(test_name ${tests})
|
||||
endforeach()
|
||||
|
||||
if (${CMAKE_BUILD_TYPE} STREQUAL "Profile")
|
||||
add_custom_target(coverage
|
||||
|
||||
add_custom_target(coverage_build
|
||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
COMMAND lcov --capture --directory . --output-file coverage.info
|
||||
COMMAND lcov --summary coverage.info
|
||||
COMMAND genhtml coverage.info --output-directory out
|
||||
COMMAND x-www-browser out/index.html
|
||||
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
||||
DEPENDS test_build
|
||||
)
|
||||
|
||||
add_custom_target(coverage_html
|
||||
COMMAND genhtml coverage.info --output-directory out
|
||||
COMMAND x-www-browser out/index.html
|
||||
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
||||
DEPENDS coverage_build
|
||||
)
|
||||
|
||||
set(coverage_deps
|
||||
coverage_build)
|
||||
|
||||
if (COV_HTML)
|
||||
list(APPEND coverage_deps coverage_html)
|
||||
endif()
|
||||
|
||||
add_custom_target(coverage
|
||||
DEPENDS ${coverage_deps}
|
||||
)
|
||||
endif()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user