- build with gcov when --define "gcov 1" option is passed to gbs
Change-Id: I1997b14b8330eca41b5e8f2599b3b606b78ccb26
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=%{_libdir}")
+IF("${GCOV}" STREQUAL "1")
+ STRING(REPLACE "-O2" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+ STRING(REPLACE "-D_FORTIFY_SOURCE=2 " "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fprofile-arcs -ftest-coverage")
+ SET(${fw_name}_LDFLAGS "${${fw_name}_LDFLAGS} -lgcov")
+ENDIF()
+
SET(SOURCES src/peripheral_gpio.c
src/peripheral_i2c.c
src/peripheral_pwm.c
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(capi-system-info)
+%if 0%{?gcov:1}
+BuildRequires: lcov
+BuildRequires: zip
+%endif
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
+%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DGCOV=%{gcov}
%install
%make_install