9ff1310af5
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources into the same pile, passing them on to the same compiler as for C++ (CXX), with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as variants of the C and C++ languages separately, so that Objective-C sources are built with CC and with CFLAGS, and Objective-C++ sources with CXX, and CXXFLAGS. This lets us remove a lot of duplicated flags and definitions from the QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched the C++ equivalent. The remaining Objective-C/C++ flags are added to CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in C/C++ mode. This matches Xcode, which also doesn't have a separate build setting for Objective-C/C++ flags. The Makefile qmake generator has been rewritten to support Objective-C/C++ fully, by not assuming that we're just iterating over the C and C++ extensions when dealing with compilation rules, precompiled headers, etc. There's some duplicated logic in this code, as inherent by qmake's already duplicated code paths, but this can be cleaned up when C++11 support is mandatory and we can use lambda functions. Task-number: QTBUG-36575 Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
31 lines
1.1 KiB
Plaintext
31 lines
1.1 KiB
Plaintext
#
|
|
# Tested with gcov 4.8.1
|
|
# http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Gcov.html
|
|
|
|
# To instrument a Qt application or library with the gcov coverage
|
|
# tool, do `CONFIG+=gcov' in the application .pro file.
|
|
#
|
|
# To instrument Qt itself with gcov, use the `-gcov' configure
|
|
# option.
|
|
|
|
# The .gcno file is generated when the source file is compiled.
|
|
# The .gcda file is generated when a program is executed.
|
|
|
|
# Example how to generate the html output after you've run the program or test
|
|
#
|
|
# lcov --capture --directory . --output-file coverage-gcov.info --no-external
|
|
# lcov --output-file coverage-gcov.info --remove coverage-gcov.info '*.moc*' '.*rcc*' '*3rdparty*'
|
|
# genhtml coverage-gcov.info --output-directory doc/coverage
|
|
|
|
# If you want to use gcov directly, you most likely need to manually move the .gcda and .gcno files
|
|
# along with the program.
|
|
#
|
|
# mv .obj/debug-shared/tst_example.gc* .
|
|
# gcov -b -c tst_example.cpp
|
|
|
|
QMAKE_CFLAGS += -fprofile-arcs -ftest-coverage
|
|
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
|
|
QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
|
|
|
|
QMAKE_CLEAN += $(OBJECTS_DIR)*.gcno and $(OBJECTS_DIR)*.gcda
|