Files
unison/buildsupport/custom_modules/ns3_coverage.cmake
Gabriel Ferreira ff3b511384 build: Bugfixes and refactoring of ns3 and CMake
Including:
- add missing command for introspected doxygen
- run get_version.sh before running doxygen
- use find_package(Doxygen) to get the doxygen executable
- silence python and sqlite find_package warnings
- return cmake returncode if configuration fails
- require GTK3 3.22
- link all libraries to print-introspected-doxygen
- replace shell with use_shell for variable name
- revert wrong changes to propagation of return codes and add test
- disable pch when ccache is found
- make --enable-sudo a post-build step and a runtime option
- add docs subparser
- add enable-sudo option
- refactor positional argument values
- fix --check option and add shell option
- replace --no-task-lines with --quiet
- replace --nowaf with --no-build
- replace --run --run-no-build with run (--no-build)
- replace ns3 documentation related arguments with targets
- document test-ns3.py
- export include directories used by ns3 libraries
- refactor CMake documentation dependency checking and behavior
- add --allow-run-as-root for running MPI examples on the CI
2022-01-09 02:48:53 -03:00

50 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})
find_program(GCOVp gcov)
if(GCOVp)
add_definitions(--coverage)
link_libraries(-lgcov)
endif()
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()