Files
unison/build-support/custom-modules/ns3-coverage.cmake
Gabriel Ferreira 4aedba2f00 build: CMake refactoring and fixes
Includes:
- fix int64x64 parsing order, remove cached entries in macros-and-definitions and in the docs
- update launch.json scratch names
- add a ctest entry per executable
- forward POSIX signal in ns3 (to get segmentation fault)
- prioritize Ninja generator instead of Makefiles
- add tests for unused utils source files
- remove dummy file and add tests to check for unused source files
- add missing examples and clean up unnecessary definitions
- missing feature entry for LTE used by pybindgen
- refactor CMake related filenames
- fix python libraries and include directories bindings
- fix brite example name
- Keep C++ compiler and flags when refreshing
- Disable precompiled headers when Ccache is found
- Mark find_external_library headers as advanced
- consolidate auxiliary files: build-status.py, _cache.py and .lock-waf_sys.platform_build files are merged into .lock-ns3_sys.platform_build
- scan .cc sources used in bindings and update docs
2022-02-21 22:18:42 -03:00

51 lines
1.7 KiB
CMake

# Copyright (c) 2017-2021 Universidade de Brasília
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the Free
# Software Foundation;
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Gabriel Ferreira <gabrielcarvfer@gmail.com>
if(${NS3_COVERAGE})
mark_as_advanced(GCOVp)
find_program(GCOVp gcov)
if(GCOVp)
add_definitions(--coverage)
link_libraries(-lgcov)
endif()
mark_as_advanced(LCOVp)
find_program(LCOVp lcov)
if(NOT LCOVp)
message(FATAL_ERROR "LCOV is required but it is not installed.")
endif()
if(${NS3_COVERAGE_ZERO_COUNTERS})
set(zero_counters "--lcov-zerocounters")
endif()
# The following target will run test.py --no-build to generate the code
# coverage files .gcno and .gcda output will be in ${CMAKE_BINARY_DIR} a.k.a.
# cmake-cache or cmake-build-${build_suffix}
# Create output directory for coverage info and html
file(MAKE_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/coverage)
# Extract code coverage results and build html report
add_custom_target(
coverage_gcc
COMMAND lcov -o ns3.info -c --directory ${CMAKE_BINARY_DIR} ${zero_counters}
COMMAND genhtml ns3.info
WORKING_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/coverage
DEPENDS run_test_py
)
endif()