2019-06-28 16:24:05 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# idf_create_lcov_report
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Create coverage report.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function(idf_create_coverage_report report_dir)
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-08 14:06:43 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set(gcov_tool ${_CMAKE_TOOLCHAIN_PREFIX}gcov)
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-28 16:24:05 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    idf_build_get_property(project_name PROJECT_NAME)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-30 09:33:07 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    add_custom_target(pre-cov-report
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-28 16:24:05 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMENT "Generating coverage report in: ${report_dir}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMAND ${CMAKE_COMMAND} -E echo "Using gcov: ${gcov_tool}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMAND ${CMAKE_COMMAND} -E make_directory ${report_dir}/html
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-30 09:33:07 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    add_custom_target(lcov-report
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMENT "WARNING: lcov-report is deprecated. Please use gcovr-report instead."
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-28 16:24:05 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMAND lcov --gcov-tool ${gcov_tool} -c -d ${CMAKE_CURRENT_BINARY_DIR} -o ${report_dir}/${project_name}.info
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-30 09:33:07 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        COMMAND genhtml -o ${report_dir}/html ${report_dir}/${project_name}.info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        DEPENDS pre-cov-report
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    add_custom_target(gcovr-report
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMAND gcovr -r ${project_dir} --gcov-executable ${gcov_tool} -s --html-details ${report_dir}/html/index.html
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        DEPENDS pre-cov-report
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-28 16:24:05 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								endfunction()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# idf_clean_coverage_report
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Clean coverage report.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function(idf_clean_coverage_report report_dir)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    add_custom_target(cov-data-clean
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMENT "Clean coverage report in: ${report_dir}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        COMMAND ${CMAKE_COMMAND} -E remove_directory ${report_dir})
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-30 09:33:07 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								endfunction()
							 |