mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-04 11:18:52 +08:00
Fix README/cmake format.
This commit is contained in:
committed by
James Goppert
parent
d142ac234c
commit
e7c95fa027
+95
-95
@@ -10,8 +10,8 @@ set(CMAKE_CXX_STANDARD 11)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type" FORCE)
|
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type" FORCE)
|
||||||
message(STATUS "set build type to ${CMAKE_BUILD_TYPE}")
|
message(STATUS "set build type to ${CMAKE_BUILD_TYPE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Coverage")
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Coverage")
|
||||||
@@ -28,133 +28,133 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||||||
include_directories(${CMAKE_SOURCE_DIR})
|
include_directories(${CMAKE_SOURCE_DIR})
|
||||||
|
|
||||||
if(SUPPORT_STDIOSTREAM)
|
if(SUPPORT_STDIOSTREAM)
|
||||||
add_definitions(-DSUPPORT_STDIOSTREAM)
|
add_definitions(-DSUPPORT_STDIOSTREAM)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_COVERAGE
|
set(CMAKE_CXX_FLAGS_COVERAGE
|
||||||
"--coverage -fprofile-arcs -ftest-coverage -fno-default-inline -fno-inline -fno-inline-small-functions -fno-elide-constructors"
|
"--coverage -fprofile-arcs -ftest-coverage -fno-default-inline -fno-inline -fno-inline-small-functions -fno-elide-constructors"
|
||||||
CACHE STRING "Flags used by the C++ compiler during coverage builds" FORCE)
|
CACHE STRING "Flags used by the C++ compiler during coverage builds" FORCE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
"--coverage -ftest-coverage -lgcov"
|
"--coverage -ftest-coverage -lgcov"
|
||||||
CACHE STRING "Flags used for linking binaries during coverage builds" FORCE)
|
CACHE STRING "Flags used for linking binaries during coverage builds" FORCE)
|
||||||
mark_as_advanced(CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE)
|
mark_as_advanced(CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE)
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-pedantic
|
-pedantic
|
||||||
-Wall
|
-Wall
|
||||||
-Warray-bounds
|
-Warray-bounds
|
||||||
-Wcast-align
|
-Wcast-align
|
||||||
-Wcast-qual
|
-Wcast-qual
|
||||||
-Wconversion
|
-Wconversion
|
||||||
-Wctor-dtor-privacy
|
-Wctor-dtor-privacy
|
||||||
-Wdisabled-optimization
|
-Wdisabled-optimization
|
||||||
-Werror
|
-Werror
|
||||||
-Wextra
|
-Wextra
|
||||||
-Wfloat-equal
|
-Wfloat-equal
|
||||||
-Wformat-security
|
-Wformat-security
|
||||||
-Wformat=2
|
-Wformat=2
|
||||||
-Winit-self
|
-Winit-self
|
||||||
-Wlogical-op
|
-Wlogical-op
|
||||||
-Wmissing-declarations
|
-Wmissing-declarations
|
||||||
-Wmissing-include-dirs
|
-Wmissing-include-dirs
|
||||||
-Wno-sign-compare
|
-Wno-sign-compare
|
||||||
-Wno-unused
|
-Wno-unused
|
||||||
-Wno-unused-parameter
|
-Wno-unused-parameter
|
||||||
-Wnoexcept
|
-Wnoexcept
|
||||||
-Wold-style-cast
|
-Wold-style-cast
|
||||||
-Woverloaded-virtual
|
-Woverloaded-virtual
|
||||||
-Wpointer-arith
|
-Wpointer-arith
|
||||||
-Wredundant-decls
|
-Wredundant-decls
|
||||||
-Wreorder
|
-Wreorder
|
||||||
-Wshadow
|
-Wshadow
|
||||||
-Wsign-conversion
|
-Wsign-conversion
|
||||||
-Wsign-promo
|
-Wsign-promo
|
||||||
-Wstrict-null-sentinel
|
-Wstrict-null-sentinel
|
||||||
-Wswitch-default
|
-Wswitch-default
|
||||||
-Wundef
|
-Wundef
|
||||||
-Wuninitialized
|
-Wuninitialized
|
||||||
-Wunused-variable
|
-Wunused-variable
|
||||||
)
|
)
|
||||||
|
|
||||||
# clang tolerate unknown gcc options
|
# clang tolerate unknown gcc options
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wno-error=unused-command-line-argument-hard-error-in-future
|
-Wno-error=unused-command-line-argument-hard-error-in-future
|
||||||
-Wno-unknown-warning-option
|
-Wno-unknown-warning-option
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wstrict-overflow=5
|
-Wstrict-overflow=5
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# santiziers (ASAN, UBSAN)
|
# santiziers (ASAN, UBSAN)
|
||||||
if(ASAN)
|
if(ASAN)
|
||||||
message(STATUS "address sanitizer enabled")
|
message(STATUS "address sanitizer enabled")
|
||||||
|
|
||||||
# environment variables
|
# environment variables
|
||||||
# ASAN_OPTIONS=detect_stack_use_after_return=1
|
# ASAN_OPTIONS=detect_stack_use_after_return=1
|
||||||
# ASAN_OPTIONS=check_initialization_order=1
|
# ASAN_OPTIONS=check_initialization_order=1
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-fsanitize=address
|
-fsanitize=address
|
||||||
-g3
|
-g3
|
||||||
-O1
|
-O1
|
||||||
-fno-omit-frame-pointer
|
-fno-omit-frame-pointer
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address)
|
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address)
|
||||||
|
|
||||||
elseif(UBSAN)
|
elseif(UBSAN)
|
||||||
message(STATUS "undefined behaviour sanitizer enabled")
|
message(STATUS "undefined behaviour sanitizer enabled")
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-fsanitize=undefined
|
-fsanitize=undefined
|
||||||
-fsanitize=integer
|
-fsanitize=integer
|
||||||
-g3
|
-g3
|
||||||
-O1
|
-O1
|
||||||
-fno-omit-frame-pointer
|
-fno-omit-frame-pointer
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined)
|
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
|
||||||
|
|
||||||
if(TESTING)
|
if(TESTING)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
add_dependencies(check test_build)
|
add_dependencies(check test_build)
|
||||||
|
|
||||||
add_custom_target(clang-tidy COMMAND clang-tidy -p . ${CMAKE_SOURCE_DIR}/test/*.cpp)
|
add_custom_target(clang-tidy COMMAND clang-tidy -p . ${CMAKE_SOURCE_DIR}/test/*.cpp)
|
||||||
add_dependencies(clang-tidy test_build)
|
add_dependencies(clang-tidy test_build)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FORMAT)
|
if(FORMAT)
|
||||||
set(astyle_exe ${CMAKE_BINARY_DIR}/astyle/src/bin/astyle)
|
set(astyle_exe ${CMAKE_BINARY_DIR}/astyle/src/bin/astyle)
|
||||||
add_custom_command(OUTPUT ${astyle_exe}
|
add_custom_command(OUTPUT ${astyle_exe}
|
||||||
COMMAND wget http://sourceforge.net/projects/astyle/files/astyle/astyle%202.06/astyle_2.06_linux.tar.gz -O /tmp/astyle.tar.gz
|
COMMAND wget http://sourceforge.net/projects/astyle/files/astyle/astyle%202.06/astyle_2.06_linux.tar.gz -O /tmp/astyle.tar.gz
|
||||||
COMMAND tar -xvf /tmp/astyle.tar.gz
|
COMMAND tar -xvf /tmp/astyle.tar.gz
|
||||||
COMMAND cd astyle/src && make -f ../build/gcc/Makefile
|
COMMAND cd astyle/src && make -f ../build/gcc/Makefile
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(check_format
|
add_custom_target(check_format
|
||||||
COMMAND scripts/format.sh ${astyle_exe} 0
|
COMMAND scripts/format.sh ${astyle_exe} 0
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
DEPENDS ${astyle_exe}
|
DEPENDS ${astyle_exe}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(format
|
add_custom_target(format
|
||||||
COMMAND scripts/format.sh ${astyle_exe} 1
|
COMMAND scripts/format.sh ${astyle_exe} 1
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
DEPENDS ${astyle_exe}
|
DEPENDS ${astyle_exe}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(check check_format)
|
add_dependencies(check check_format)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||||
@@ -163,4 +163,4 @@ set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
|||||||
set(CPACK_PACKAGE_CONTACT "james.goppert@gmail.com")
|
set(CPACK_PACKAGE_CONTACT "james.goppert@gmail.com")
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
# vim: set noet fenc=utf-8 ft=cmake ff=unix sts=0 sw=4 ts=4 :
|
# vim: set et fenc=utf-8 ft=cmake ff=unix sts=0 sw=4 ts=4 :
|
||||||
|
|||||||
@@ -16,111 +16,112 @@ A simple and efficient template based matrix library.
|
|||||||
## Library Overview
|
## Library Overview
|
||||||
|
|
||||||
* matrix/math.hpp : Provides matrix math routines.
|
* matrix/math.hpp : Provides matrix math routines.
|
||||||
* Matrix (MxN)
|
* Matrix (MxN)
|
||||||
* Square Matrix (MxM, has inverse)
|
* Square Matrix (MxM, has inverse)
|
||||||
* Vector (Mx1)
|
* Vector (Mx1)
|
||||||
* Scalar (1x1)
|
* Scalar (1x1)
|
||||||
* Quaternion
|
* Quaternion
|
||||||
* Dcm
|
* Dcm
|
||||||
* Euler (Body 321)
|
* Euler (Body 321)
|
||||||
* Axis Angle
|
* Axis Angle
|
||||||
|
|
||||||
* matrix/filter.hpp : Provides filtering routines.
|
* matrix/filter.hpp : Provides filtering routines.
|
||||||
* kalman_correct
|
* kalman_correct
|
||||||
|
|
||||||
* matrix/integrate.hpp : Provides integration routines.
|
* matrix/integrate.hpp : Provides integration routines.
|
||||||
* integrate_rk4 (Runge-Kutta 4th order)
|
* integrate_rk4 (Runge-Kutta 4th order)
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
See the test directory for detailed examples. Some simple examples are included below:
|
See the test directory for detailed examples. Some simple examples are included below:
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
// define an euler angle (Body 3(yaw)-2(pitch)-1(roll) rotation)
|
// define an euler angle (Body 3(yaw)-2(pitch)-1(roll) rotation)
|
||||||
float roll = 0.1f;
|
float roll = 0.1f;
|
||||||
float pitch = 0.2f;
|
float pitch = 0.2f;
|
||||||
float yaw = 0.3f;
|
float yaw = 0.3f;
|
||||||
Eulerf euler(roll, pitch, yaw);
|
Eulerf euler(roll, pitch, yaw);
|
||||||
|
|
||||||
// convert to quaternion from euler
|
// convert to quaternion from euler
|
||||||
Quatf q_nb(euler);
|
Quatf q_nb(euler);
|
||||||
|
|
||||||
// convert to DCM from quaternion
|
// convert to DCM from quaternion
|
||||||
Dcmf dcm(q_nb);
|
Dcmf dcm(q_nb);
|
||||||
|
|
||||||
// you can assign a rotation instance that already exist to another rotation instance, e.g.
|
// you can assign a rotation instance that already exist to another rotation instance, e.g.
|
||||||
dcm = euler;
|
dcm = euler;
|
||||||
|
|
||||||
// you can also directly create a DCM instance from euler angles like this
|
// you can also directly create a DCM instance from euler angles like this
|
||||||
dcm = Eulerf(roll, pitch, yaw);
|
dcm = Eulerf(roll, pitch, yaw);
|
||||||
|
|
||||||
// create an axis angle representation from euler angles
|
// create an axis angle representation from euler angles
|
||||||
AxisAngle<float> axis_angle = euler;
|
AxisAngle<float> axis_angle = euler;
|
||||||
|
|
||||||
// use axis angle to initialize a DCM
|
// use axis angle to initialize a DCM
|
||||||
Dcmf dcm2(AxisAngle(1, 2, 3));
|
Dcmf dcm2(AxisAngle(1, 2, 3));
|
||||||
|
|
||||||
// use axis angle with axis/angle separated to init DCM
|
// use axis angle with axis/angle separated to init DCM
|
||||||
Dcmf dcm3(AxisAngle(Vector3f(1, 0, 0), 0.2));
|
Dcmf dcm3(AxisAngle(Vector3f(1, 0, 0), 0.2));
|
||||||
|
|
||||||
// do some kalman filtering
|
// do some kalman filtering
|
||||||
const size_t n_x = 5;
|
const size_t n_x = 5;
|
||||||
const size_t n_y = 3;
|
const size_t n_y = 3;
|
||||||
|
|
||||||
// define matrix sizes
|
// define matrix sizes
|
||||||
SquareMatrix<float, n_x> P;
|
SquareMatrix<float, n_x> P;
|
||||||
Vector<float, n_x> x;
|
Vector<float, n_x> x;
|
||||||
Vector<float, n_y> y;
|
Vector<float, n_y> y;
|
||||||
Matrix<float, n_y, n_x> C;
|
Matrix<float, n_y, n_x> C;
|
||||||
SquareMatrix<float, n_y> R;
|
SquareMatrix<float, n_y> R;
|
||||||
SquareMatrix<float, n_y> S;
|
SquareMatrix<float, n_y> S;
|
||||||
Matrix<float, n_x, n_y> K;
|
Matrix<float, n_x, n_y> K;
|
||||||
|
|
||||||
// define measurement matrix
|
// define measurement matrix
|
||||||
C = zero<float, n_y, n_x>(); // or C.setZero()
|
C = zero<float, n_y, n_x>(); // or C.setZero()
|
||||||
C(0,0) = 1;
|
C(0,0) = 1;
|
||||||
C(1,1) = 2;
|
C(1,1) = 2;
|
||||||
C(2,2) = 3;
|
C(2,2) = 3;
|
||||||
|
|
||||||
// set x to zero
|
// set x to zero
|
||||||
x = zero<float, n_x, 1>(); // or x.setZero()
|
x = zero<float, n_x, 1>(); // or x.setZero()
|
||||||
|
|
||||||
// set P to identity * 0.01
|
// set P to identity * 0.01
|
||||||
P = eye<float, n_x>()*0.01;
|
P = eye<float, n_x>()*0.01;
|
||||||
|
|
||||||
// set R to identity * 0.1
|
// set R to identity * 0.1
|
||||||
R = eye<float, n_y>()*0.1;
|
R = eye<float, n_y>()*0.1;
|
||||||
|
|
||||||
// measurement
|
// measurement
|
||||||
y(0) = 1;
|
y(0) = 1;
|
||||||
y(1) = 2;
|
y(1) = 2;
|
||||||
y(2) = 3;
|
y(2) = 3;
|
||||||
|
|
||||||
// innovation
|
// innovation
|
||||||
r = y - C*x;
|
r = y - C*x;
|
||||||
|
|
||||||
// innovations variance
|
// innovations variance
|
||||||
S = C*P*C.T() + R;
|
S = C*P*C.T() + R;
|
||||||
|
|
||||||
// Kalman gain matrix
|
// Kalman gain matrix
|
||||||
K = P*C.T()*S.I();
|
K = P*C.T()*S.I();
|
||||||
// S.I() is the inverse, defined for SquareMatrix
|
// S.I() is the inverse, defined for SquareMatrix
|
||||||
|
|
||||||
// correction
|
// correction
|
||||||
x += K*r;
|
x += K*r;
|
||||||
|
|
||||||
// slicing
|
// slicing
|
||||||
float data[9] = {0, 2, 3,
|
float data[9] = {0, 2, 3,
|
||||||
4, 5, 6,
|
4, 5, 6,
|
||||||
7, 8, 10
|
7, 8, 10
|
||||||
};
|
};
|
||||||
SquareMatrix<float, 3> A(data);
|
SquareMatrix<float, 3> A(data);
|
||||||
|
|
||||||
// Slice a 3,3 matrix starting at row 1, col 0,
|
// Slice a 3,3 matrix starting at row 1, col 0,
|
||||||
// with size 2 x 3, warning, no size checking
|
// with size 2 x 3, warning, no size checking
|
||||||
Matrix<float, 2, 3> B(A.slice<2, 3>(1, 0));
|
Matrix<float, 2, 3> B(A.slice<2, 3>(1, 0));
|
||||||
|
|
||||||
// this results in:
|
// this results in:
|
||||||
// 4, 5, 6
|
// 4, 5, 6
|
||||||
// 7, 8, 10
|
// 7, 8, 10
|
||||||
```
|
```
|
||||||
|
<!-- vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : -->
|
||||||
|
|||||||
+14
-12
@@ -12,17 +12,19 @@ format_wildcards="""
|
|||||||
|
|
||||||
if [[ $format -eq 1 ]]
|
if [[ $format -eq 1 ]]
|
||||||
then
|
then
|
||||||
echo formatting
|
echo formatting
|
||||||
$astyle ${format_wildcards}
|
$astyle ${format_wildcards}
|
||||||
else
|
else
|
||||||
echo checking format...
|
echo checking format...
|
||||||
$astyle --dry-run ${format_wildcards} | grep Formatted &>/dev/null
|
$astyle --dry-run ${format_wildcards} | grep Formatted &>/dev/null
|
||||||
if [[ $? -eq 0 ]]
|
if [[ $? -eq 0 ]]
|
||||||
then
|
then
|
||||||
echo Error: need to format
|
echo Error: need to format
|
||||||
echo "From cmake build directory run: 'make format'"
|
echo "From cmake build directory run: 'make format'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo no formatting needed
|
echo no formatting needed
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 :
|
||||||
|
|||||||
+46
-44
@@ -1,57 +1,59 @@
|
|||||||
set(tests
|
set(tests
|
||||||
setIdentity
|
setIdentity
|
||||||
inverse
|
inverse
|
||||||
slice
|
slice
|
||||||
matrixMult
|
matrixMult
|
||||||
vectorAssignment
|
vectorAssignment
|
||||||
matrixAssignment
|
matrixAssignment
|
||||||
matrixScalarMult
|
matrixScalarMult
|
||||||
transpose
|
transpose
|
||||||
vector
|
vector
|
||||||
vector2
|
vector2
|
||||||
vector3
|
vector3
|
||||||
attitude
|
attitude
|
||||||
filter
|
filter
|
||||||
integration
|
integration
|
||||||
squareMatrix
|
squareMatrix
|
||||||
helper
|
helper
|
||||||
hatvee
|
hatvee
|
||||||
copyto
|
copyto
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(test_build)
|
add_custom_target(test_build)
|
||||||
foreach(test_name ${tests})
|
foreach(test_name ${tests})
|
||||||
add_executable(${test_name}
|
add_executable(${test_name}
|
||||||
${test_name}.cpp)
|
${test_name}.cpp)
|
||||||
add_test(test_${test_name} ${test_name})
|
add_test(test_${test_name} ${test_name})
|
||||||
add_dependencies(test_build ${test_name})
|
add_dependencies(test_build ${test_name})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if (${CMAKE_BUILD_TYPE} STREQUAL "Coverage")
|
if (${CMAKE_BUILD_TYPE} STREQUAL "Coverage")
|
||||||
|
|
||||||
add_custom_target(coverage_build
|
add_custom_target(coverage_build
|
||||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||||
COMMAND lcov --capture --directory . --output-file coverage.info
|
COMMAND lcov --capture --directory . --output-file coverage.info
|
||||||
COMMAND lcov --summary coverage.info
|
COMMAND lcov --summary coverage.info
|
||||||
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
||||||
DEPENDS test_build
|
DEPENDS test_build
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(coverage_html
|
add_custom_target(coverage_html
|
||||||
COMMAND genhtml coverage.info --output-directory out
|
COMMAND genhtml coverage.info --output-directory out
|
||||||
COMMAND x-www-browser out/index.html
|
COMMAND x-www-browser out/index.html
|
||||||
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
||||||
DEPENDS coverage_build
|
DEPENDS coverage_build
|
||||||
)
|
)
|
||||||
|
|
||||||
set(coverage_deps
|
set(coverage_deps
|
||||||
coverage_build)
|
coverage_build)
|
||||||
|
|
||||||
if (COV_HTML)
|
if (COV_HTML)
|
||||||
list(APPEND coverage_deps coverage_html)
|
list(APPEND coverage_deps coverage_html)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(coverage
|
add_custom_target(coverage
|
||||||
DEPENDS ${coverage_deps}
|
DEPENDS ${coverage_deps}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# vim: set et fenc=utf-8 ft=cmake ff=unix sts=0 sw=4 ts=4 :
|
||||||
|
|||||||
Reference in New Issue
Block a user