Wed, 27 Dec 2023 16:16:11 +0100
add coverage feature - relates to #342
Note: this is currently not checking the availability of the compiler flags.
configure | file | annotate | diff | comparison | revisions | |
make/project.xml | file | annotate | diff | comparison | revisions |
--- a/configure Wed Dec 27 16:07:45 2023 +0100 +++ b/configure Wed Dec 27 16:16:11 2023 +0100 @@ -77,6 +77,9 @@ --release add extra compile flags for release builds --with-docs=(all|html|api|none) +Optional Features: + --enable-coverage + __EOF__ } @@ -106,6 +109,8 @@ "--debug") BUILD_TYPE="debug" ;; "--release") BUILD_TYPE="release" ;; "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;; + "--enable-coverage") FEATURE_COVERAGE=on ;; + "--disable-coverage") unset FEATURE_COVERAGE ;; "-"*) echo "unknown option: $ARG"; abort_configure ;; esac done @@ -251,6 +256,21 @@ return 0 } +dependency_error_coverage() +{ + printf "checking for coverage... " + # dependency coverage + while true + do + TEMP_CFLAGS="$TEMP_CFLAGS --coverage" + TEMP_LDFLAGS="$TEMP_LDFLAGS --coverage" + echo yes + return 1 + done + + echo no + return 0 +} dependency_error_pandoc() { printf "checking for pandoc... " @@ -511,6 +531,21 @@ fi # Features +if [ -n "$FEATURE_COVERAGE" ]; then + # check dependency + if dependency_error_coverage ; then + # "auto" features can fail and are just disabled in this case + if [ "$FEATURE_COVERAGE" = "auto" ]; then + DISABLE_FEATURE_COVERAGE=1 + else + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED coverage " + ERROR=1 + fi + fi + if [ -n "$DISABLE_FEATURE_COVERAGE" ]; then + unset FEATURE_COVERAGE + fi +fi # Option: --with-docs if [ -z "$OPT_WITH_DOCS" ]; then @@ -629,6 +664,12 @@ echo " TOOLCHAIN: $TOOLCHAIN_NAME" echo "Options:" cat "$TEMP_DIR/options" +echo "Features:" +if [ -n "$FEATURE_COVERAGE" ]; then +echo " coverage: on" +else +echo " coverage: off" +fi echo # generate the config.mk file
--- a/make/project.xml Wed Dec 27 16:07:45 2023 +0100 +++ b/make/project.xml Wed Dec 27 16:16:11 2023 +0100 @@ -68,6 +68,11 @@ <dependency name="pandoc"> <test>test -n "$PANDOC"</test> </dependency> + + <dependency name="coverage"> + <cflags>--coverage</cflags> + <ldflags>--coverage</ldflags> + </dependency> <target> <option arg="with-docs"> @@ -99,6 +104,9 @@ <default value="api"/> <default value="none"/> </option> + <feature name="coverage"> + <dependencies>coverage</dependencies> + </feature> <dependencies>c,file-tools</dependencies> </target> </project>