mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-22 15:32:24 +00:00
Test: Enable coverage for external repositories
Add monero_enable_coverage() for reuse in case C/CXX_FLAGS are overwritten.
This commit is contained in:
parent
9a5579fc4f
commit
19ed7abdf9
3 changed files with 19 additions and 9 deletions
|
@ -513,6 +513,20 @@ add_definitions(-DAUTO_INITIALIZE_EASYLOGGINGPP)
|
||||||
set(MONERO_GENERATED_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated_include")
|
set(MONERO_GENERATED_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated_include")
|
||||||
include_directories(${MONERO_GENERATED_HEADERS_DIR})
|
include_directories(${MONERO_GENERATED_HEADERS_DIR})
|
||||||
|
|
||||||
|
option(COVERAGE "Enable profiling for test coverage report" OFF)
|
||||||
|
if(COVERAGE)
|
||||||
|
message(STATUS "Building with profiling for test coverage report")
|
||||||
|
endif()
|
||||||
|
macro (monero_enable_coverage)
|
||||||
|
if(COVERAGE)
|
||||||
|
foreach(COV_FLAG -fprofile-arcs -ftest-coverage --coverage)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COV_FLAG}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COV_FLAG}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# Generate header for embedded translations
|
# Generate header for embedded translations
|
||||||
# Generate header for embedded translations, use target toolchain if depends, otherwise use the
|
# Generate header for embedded translations, use target toolchain if depends, otherwise use the
|
||||||
# lrelease and lupdate binaries from the host
|
# lrelease and lupdate binaries from the host
|
||||||
|
@ -676,13 +690,7 @@ else()
|
||||||
set(STATIC_ASSERT_CPP_FLAG "-Dstatic_assert=_Static_assert")
|
set(STATIC_ASSERT_CPP_FLAG "-Dstatic_assert=_Static_assert")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(COVERAGE "Enable profiling for test coverage report" 0)
|
monero_enable_coverage()
|
||||||
|
|
||||||
if(COVERAGE)
|
|
||||||
message(STATUS "Building with profiling for test coverage report")
|
|
||||||
set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage --coverage")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
|
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
|
||||||
# is fixed in the code (Issue #847), force compiler to be conservative.
|
# is fixed in the code (Issue #847), force compiler to be conservative.
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
|
||||||
|
@ -759,8 +767,8 @@ else()
|
||||||
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
|
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
|
||||||
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
|
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${LD_BACKCOMPAT_FLAGS}")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${LD_BACKCOMPAT_FLAGS}")
|
||||||
|
|
||||||
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
|
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
monero_enable_coverage()
|
||||||
add_subdirectory(epee)
|
add_subdirectory(epee)
|
||||||
|
|
||||||
|
|
1
external/easylogging++/CMakeLists.txt
vendored
1
external/easylogging++/CMakeLists.txt
vendored
|
@ -31,6 +31,7 @@ cmake_minimum_required(VERSION 2.8.7)
|
||||||
project(easylogging CXX)
|
project(easylogging CXX)
|
||||||
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
monero_enable_coverage()
|
||||||
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
find_package(Backtrace)
|
find_package(Backtrace)
|
||||||
|
|
Loading…
Reference in a new issue