mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 05:53:34 +08:00
rename cmake "Profile" to "Coverage" and add builds
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
*.orig
|
*.orig
|
||||||
*.swp
|
*.swp
|
||||||
|
*~
|
||||||
astyle/
|
astyle/
|
||||||
build*/
|
build*/
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
|
compile_commands.json
|
||||||
CPackConfig.cmake
|
CPackConfig.cmake
|
||||||
CPackSourceConfig.cmake
|
CPackSourceConfig.cmake
|
||||||
CTestTestfile.cmake
|
CTestTestfile.cmake
|
||||||
@@ -12,6 +14,7 @@ Makefile
|
|||||||
test/attitude
|
test/attitude
|
||||||
test/cmake_install.cmake
|
test/cmake_install.cmake
|
||||||
test/CMakeFiles/
|
test/CMakeFiles/
|
||||||
|
test/coverage.info
|
||||||
test/CTestTestfile.cmake
|
test/CTestTestfile.cmake
|
||||||
test/filter
|
test/filter
|
||||||
test/hatvee
|
test/hatvee
|
||||||
@@ -22,6 +25,7 @@ test/Makefile
|
|||||||
test/matrixAssignment
|
test/matrixAssignment
|
||||||
test/matrixMult
|
test/matrixMult
|
||||||
test/matrixScalarMult
|
test/matrixScalarMult
|
||||||
|
test/out/
|
||||||
test/setIdentity
|
test/setIdentity
|
||||||
test/slice
|
test/slice
|
||||||
test/squareMatrix
|
test/squareMatrix
|
||||||
|
|||||||
+32
-9
@@ -1,17 +1,40 @@
|
|||||||
language: c
|
language: c
|
||||||
sudo: false
|
|
||||||
install:
|
|
||||||
- pip install --user cpp-coveralls
|
|
||||||
script:
|
|
||||||
- cmake -DCMAKE_BUILD_TYPE=Profile -DTESTING=ON -DFORMAT=ON .
|
|
||||||
- make check
|
|
||||||
after_success:
|
|
||||||
- cpp-coveralls -i matrix
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- export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eY7/CGMm5Rq1lNwxehFO3/++/aHE8H7GR0cTiKndPO0jDu48j+GUB4k1HHSsVEpj7vO7F3FOO0619xxybDFk1zFjHw8KTbdSXmBERldYAKZOP0JKZxp6CU5DXOO2dunumZAzl6WHJjhRMPFqPheE4e+I2YOEHvXTwDcEO/lMwacr6nuaZZXxEh/TwEdqsIRd9bvsoG1zuVQnZm+atLp3oF4QW8nI5l6qe6R+3l5dEgJGtz5hOsiEpWrwWk6ub2VCdELcgpPZyZcdwu/bKvXx3ndW6LjqzcLxMGxM3rdxx6J+b7Es/vkmT1SXFcxiUjpKkUf04Bb8SmGdbJdAKRZuSRFtjqsU0tHPfo="
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: gcc
|
||||||
|
env: CMAKE_BUILD_TYPE=Coverage
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: clang
|
||||||
|
env: CMAKE_BUILD_TYPE=Release CC=clang CXX=clang++
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode8
|
||||||
|
env: CMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- cmake
|
- cmake
|
||||||
|
- gcc
|
||||||
|
- g++
|
||||||
|
- clang
|
||||||
|
|
||||||
|
install:
|
||||||
|
- pip install --user cpp-coveralls
|
||||||
|
|
||||||
|
script:
|
||||||
|
- cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DTESTING=ON -DFORMAT=ON .
|
||||||
|
- make check
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- if [[ "${CMAKE_BUILD_TYPE}" = "Coverage" && "${TRAVIS_BRANCH}" == "master" ]]; then cpp-coveralls -i matrix; fi
|
||||||
|
|
||||||
|
|||||||
+53
-43
@@ -7,69 +7,82 @@ set(VERSION_PATCH "2")
|
|||||||
project(matrix CXX)
|
project(matrix CXX)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "Profile" 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
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Coverage")
|
||||||
STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Profile")
|
|
||||||
|
|
||||||
option(SUPPORT_STDIOSTREAM
|
option(SUPPORT_STDIOSTREAM "If enabled provides support for << operator (as used with std::cout)" OFF)
|
||||||
"If enabled provides support for << operator (as used with std::cout)" OFF)
|
|
||||||
option(TESTING "Enable testing" OFF)
|
option(TESTING "Enable testing" OFF)
|
||||||
option(FORMAT "Enable formatting" OFF)
|
option(FORMAT "Enable formatting" OFF)
|
||||||
option(COV_HTML "Display html for coverage" OFF)
|
option(COV_HTML "Display html for coverage" OFF)
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
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_PROFILE
|
set(CMAKE_CXX_FLAGS_COVERAGE
|
||||||
${CMAKE_CXX_FLAGS_DEBUG}
|
"--coverage -fprofile-arcs -ftest-coverage -fno-default-inline -fno-inline -fno-inline-small-functions -fno-elide-constructors"
|
||||||
--coverage
|
CACHE STRING "Flags used by the C++ compiler during coverage builds" FORCE)
|
||||||
-fno-inline
|
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
-fno-inline-small-functions
|
"--coverage -ftest-coverage -lgcov"
|
||||||
-fno-default-inline
|
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)
|
||||||
string(REPLACE ";" " " CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE}")
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS
|
add_compile_options(
|
||||||
${CMAKE_CXX_FLAGS}
|
-pedantic
|
||||||
-Wall
|
-Wall
|
||||||
-Wno-sign-compare
|
-Warray-bounds
|
||||||
-Wextra
|
-Wcast-align
|
||||||
-Wshadow
|
|
||||||
-Wfloat-equal
|
|
||||||
-Wpointer-arith
|
|
||||||
-Wmissing-declarations
|
|
||||||
-Wno-unused-parameter
|
|
||||||
-Werror=format-security
|
|
||||||
-Werror=array-bounds
|
|
||||||
#-Wfatal-errors
|
|
||||||
-Werror=unused-variable
|
|
||||||
-Werror=reorder
|
|
||||||
-Werror=uninitialized
|
|
||||||
-Werror=init-self
|
|
||||||
-Wcast-qual
|
-Wcast-qual
|
||||||
-Wconversion
|
-Wconversion
|
||||||
-Wcast-align
|
-Wctor-dtor-privacy
|
||||||
|
-Wdisabled-optimization
|
||||||
-Werror
|
-Werror
|
||||||
-pedantic -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2
|
-Wextra
|
||||||
-Winit-self -Wlogical-op -Wmissing-declarations
|
-Wfloat-equal
|
||||||
-Wmissing-include-dirs -Wnoexcept -Wold-style-cast
|
-Wformat-security
|
||||||
-Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion
|
-Wformat=2
|
||||||
-Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5
|
-Winit-self
|
||||||
-Wswitch-default -Wundef -Werror -Wno-unused
|
-Wlogical-op
|
||||||
|
-Wmissing-declarations
|
||||||
|
-Wmissing-include-dirs
|
||||||
|
-Wno-sign-compare
|
||||||
|
-Wno-unused
|
||||||
|
-Wno-unused-parameter
|
||||||
|
-Wnoexcept
|
||||||
|
-Wold-style-cast
|
||||||
|
-Woverloaded-virtual
|
||||||
|
-Wpointer-arith
|
||||||
|
-Wredundant-decls
|
||||||
|
-Wreorder
|
||||||
|
-Wshadow
|
||||||
|
-Wsign-conversion
|
||||||
|
-Wsign-promo
|
||||||
|
-Wstrict-null-sentinel
|
||||||
|
-Wstrict-overflow=5
|
||||||
|
-Wswitch-default
|
||||||
|
-Wundef
|
||||||
|
-Wuninitialized
|
||||||
|
-Wunused-variable
|
||||||
)
|
)
|
||||||
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR})
|
# clang tolerate unknown gcc options
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
|
add_compile_options(-Wno-error=unused-command-line-argument-hard-error-in-future -Wno-unknown-warning-option)
|
||||||
|
endif()
|
||||||
|
|
||||||
file(GLOB_RECURSE COV_SRCS matrix/*.hpp matrix/*.cpp)
|
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)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FORMAT)
|
if(FORMAT)
|
||||||
@@ -94,11 +107,8 @@ if(FORMAT)
|
|||||||
VERBATIM
|
VERBATIM
|
||||||
DEPENDS ${astyle_exe}
|
DEPENDS ${astyle_exe}
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TESTING AND FORMAT)
|
add_dependencies(check check_format)
|
||||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
|
|
||||||
add_dependencies(check test_build check_format)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ foreach(test_name ${tests})
|
|||||||
add_dependencies(test_build ${test_name})
|
add_dependencies(test_build ${test_name})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if (${CMAKE_BUILD_TYPE} STREQUAL "Profile")
|
if (${CMAKE_BUILD_TYPE} STREQUAL "Coverage")
|
||||||
|
|
||||||
add_custom_target(coverage_build
|
add_custom_target(coverage_build
|
||||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||||
|
|||||||
Reference in New Issue
Block a user