core: add CMake option "ENABLE_CODE_COVERAGE" to compile with code coverage options

This option is OFF by default and should be enabled only for tests, to measure
test coverage.
v2.8-utf8proc
Sébastien Helleu 2019-03-24 09:02:04 +01:00
parent 47c4329404
commit 2612adf899
35 changed files with 107 additions and 66 deletions

View File

@ -82,38 +82,46 @@ else()
set(INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
endif()
option(ENABLE_NCURSES "Compile the Ncurses interface" ON)
option(ENABLE_HEADLESS "Compile the headless binary (required for tests)" ON)
option(ENABLE_NLS "Enable Native Language Support" ON)
option(ENABLE_GNUTLS "Enable SSLv3/TLS support" ON)
option(ENABLE_LARGEFILE "Enable Large File Support" ON)
option(ENABLE_ALIAS "Enable Alias plugin" ON)
option(ENABLE_BUFLIST "Enable Buflist plugin" ON)
option(ENABLE_CHARSET "Enable Charset plugin" ON)
option(ENABLE_EXEC "Enable Exec plugin" ON)
option(ENABLE_FIFO "Enable FIFO plugin" ON)
option(ENABLE_FSET "Enable Fast Set plugin" ON)
option(ENABLE_IRC "Enable IRC plugin" ON)
option(ENABLE_LOGGER "Enable Logger plugin" ON)
option(ENABLE_RELAY "Enable Relay plugin" ON)
option(ENABLE_SCRIPT "Enable Script plugin (script manager)" ON)
option(ENABLE_SCRIPTS "Enable script plugins (perl, python, ...)" ON)
option(ENABLE_PERL "Enable Perl scripting language" ON)
option(ENABLE_PYTHON "Enable Python scripting language" ON)
option(ENABLE_PYTHON3 "Use Python 3.x if found (NOT recommended because many \"official\" scripts won't work)" OFF)
option(ENABLE_RUBY "Enable Ruby scripting language" ON)
option(ENABLE_LUA "Enable Lua scripting language" ON)
option(ENABLE_TCL "Enable Tcl scripting language" ON)
option(ENABLE_GUILE "Enable Scheme (guile) scripting language" ON)
option(ENABLE_JAVASCRIPT "Enable JavaScript scripting language" ON)
option(ENABLE_PHP "Enable PHP scripting language" ON)
option(ENABLE_SPELL "Enable Spell checker plugin" ON)
option(ENABLE_ENCHANT "Enable Enchant lib for Spell checker plugin" OFF)
option(ENABLE_TRIGGER "Enable Trigger plugin" ON)
option(ENABLE_XFER "Enable Xfer plugin" ON)
option(ENABLE_MAN "Enable build of man page" OFF)
option(ENABLE_DOC "Enable build of documentation" OFF)
option(ENABLE_TESTS "Enable tests" OFF)
option(ENABLE_NCURSES "Compile the Ncurses interface" ON)
option(ENABLE_HEADLESS "Compile the headless binary (required for tests)" ON)
option(ENABLE_NLS "Enable Native Language Support" ON)
option(ENABLE_GNUTLS "Enable SSLv3/TLS support" ON)
option(ENABLE_LARGEFILE "Enable Large File Support" ON)
option(ENABLE_ALIAS "Enable Alias plugin" ON)
option(ENABLE_BUFLIST "Enable Buflist plugin" ON)
option(ENABLE_CHARSET "Enable Charset plugin" ON)
option(ENABLE_EXEC "Enable Exec plugin" ON)
option(ENABLE_FIFO "Enable FIFO plugin" ON)
option(ENABLE_FSET "Enable Fast Set plugin" ON)
option(ENABLE_IRC "Enable IRC plugin" ON)
option(ENABLE_LOGGER "Enable Logger plugin" ON)
option(ENABLE_RELAY "Enable Relay plugin" ON)
option(ENABLE_SCRIPT "Enable Script plugin (script manager)" ON)
option(ENABLE_SCRIPTS "Enable script plugins (perl, python, ...)" ON)
option(ENABLE_PERL "Enable Perl scripting language" ON)
option(ENABLE_PYTHON "Enable Python scripting language" ON)
option(ENABLE_PYTHON3 "Use Python 3.x if found (NOT recommended because many \"official\" scripts won't work)" OFF)
option(ENABLE_RUBY "Enable Ruby scripting language" ON)
option(ENABLE_LUA "Enable Lua scripting language" ON)
option(ENABLE_TCL "Enable Tcl scripting language" ON)
option(ENABLE_GUILE "Enable Scheme (guile) scripting language" ON)
option(ENABLE_JAVASCRIPT "Enable JavaScript scripting language" ON)
option(ENABLE_PHP "Enable PHP scripting language" ON)
option(ENABLE_SPELL "Enable Spell checker plugin" ON)
option(ENABLE_ENCHANT "Enable Enchant lib for Spell checker plugin" OFF)
option(ENABLE_TRIGGER "Enable Trigger plugin" ON)
option(ENABLE_XFER "Enable Xfer plugin" ON)
option(ENABLE_MAN "Enable build of man page" OFF)
option(ENABLE_DOC "Enable build of documentation" OFF)
option(ENABLE_TESTS "Enable tests" OFF)
option(ENABLE_CODE_COVERAGE "Enable code coverage" OFF)
# code coverage
add_library(coverage_config INTERFACE)
if(ENABLE_CODE_COVERAGE)
target_compile_options(coverage_config INTERFACE -O0 -g --coverage)
target_link_libraries(coverage_config INTERFACE --coverage)
endif()
# headless mode is required for tests
if(ENABLE_TESTS AND NOT ENABLE_HEADLESS)

View File

@ -43,8 +43,9 @@ Bug fixes::
Build::
* lua: add detection of Lua 5.3 with autotools
* core: add CMake option "ENABLE_CODE_COVERAGE" to compile with code coverage options
* core: fix compilation on Mac OS (issue #1308)
* lua: add detection of Lua 5.3 with autotools
[[v2.4]]
== Version 2.4 (2019-02-17)

View File

@ -293,6 +293,11 @@ Liste von häufig verwendeten Optionen:
| ENABLE_TESTS | `ON`, `OFF` | OFF |
kompiliert Testumgebung.
// TRANSLATION MISSING
| ENABLE_CODE_COVERAGE | `ON`, `OFF` | OFF |
Compile with code coverage options. +
This option should be used only for tests, to measure test coverage.
|===
Weitere Optionen können mit folgendem Befehl angezeigt werden:

View File

@ -285,6 +285,10 @@ List of commonly used options:
| ENABLE_TESTS | `ON`, `OFF` | OFF |
Compile tests.
| ENABLE_CODE_COVERAGE | `ON`, `OFF` | OFF |
Compile with code coverage options. +
This option should be used only for tests, to measure test coverage.
|===
The other options can be displayed with this command:

View File

@ -289,6 +289,11 @@ Liste des options couramment utilisées :
| ENABLE_TESTS | `ON`, `OFF` | OFF |
Compiler les tests.
| ENABLE_CODE_COVERAGE | `ON`, `OFF` | OFF |
Compiler avec les options de couverture de code. +
Cette option ne devrait être utilisée que pour les tests, pour mesurer la
couverture de tests.
|===
Les autres options peuvent être affichées avec cette commande :

View File

@ -320,6 +320,11 @@ List of commonly used options:
// TRANSLATION MISSING
| ENABLE_TESTS | `ON`, `OFF` | OFF |
Compile tests.
// TRANSLATION MISSING
| ENABLE_CODE_COVERAGE | `ON`, `OFF` | OFF |
Compile with code coverage options. +
This option should be used only for tests, to measure test coverage.
|===
The other options can be displayed with this command:

View File

@ -289,6 +289,11 @@ cmake に対するオプションを指定するには、以下の書式を使
| ENABLE_TESTS | `ON`, `OFF` | OFF |
コンパイルテスト。
// TRANSLATION MISSING
| ENABLE_CODE_COVERAGE | `ON`, `OFF` | OFF |
Compile with code coverage options. +
This option should be used only for tests, to measure test coverage.
|===
その他のオプションは以下のコマンドで確認してください:

View File

@ -291,6 +291,11 @@ Lista popularnych opcji:
| ENABLE_TESTS | `ON`, `OFF` | OFF |
Kompiluje testy.
// TRANSLATION MISSING
| ENABLE_CODE_COVERAGE | `ON`, `OFF` | OFF |
Compile with code coverage options. +
This option should be used only for tests, to measure test coverage.
|===
Pozostałe opcje można wyświetlić poleceniem:

View File

@ -88,4 +88,5 @@ include_directories(${CURL_INCLUDE_DIRS})
include_directories(${CMAKE_BINARY_DIR})
add_library(weechat_core STATIC ${LIB_CORE_SRC})
target_link_libraries(weechat_core coverage_config)
add_dependencies(weechat_core version_git)

View File

@ -43,6 +43,7 @@ set(LIB_GUI_COMMON_SRC
include_directories(${CMAKE_BINARY_DIR})
add_library(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})
target_link_libraries(weechat_gui_common coverage_config)
list(APPEND STATIC_LIBS weechat_gui_common)
subdirs(curses)

View File

@ -51,7 +51,7 @@ add_executable(${EXECUTABLE} ${WEECHAT_CURSES_MAIN_HEADLESS_SRC})
add_dependencies(${EXECUTABLE} weechat_gui_headless weechat_ncurses_fake)
# Due to circular references, we must link two times with libweechat_core.a and libweechat_gui_common.a
target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_headless weechat_ncurses_fake ${EXTRA_LIBS} ${STATIC_LIBS})
target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_headless weechat_ncurses_fake ${EXTRA_LIBS} ${STATIC_LIBS} coverage_config)
# Install executable
install(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)

View File

@ -57,7 +57,7 @@ add_dependencies(${EXECUTABLE} weechat_gui_curses_normal)
list(APPEND EXTRA_LIBS ${NCURSES_LIBRARY})
# Due to circular references, we must link two times with libweechat_core.a and libweechat_gui_common.a
target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_curses_normal ${EXTRA_LIBS} ${STATIC_LIBS})
target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_curses_normal ${EXTRA_LIBS} ${STATIC_LIBS} coverage_config)
# Create a symbolic link weechat-curses -> weechat
# This link is created for compatibility with old versions on /upgrade.

View File

@ -34,6 +34,7 @@ set(LIB_PLUGINS_SCRIPTS_SRC
include_directories(${CMAKE_BINARY_DIR})
add_library(weechat_plugins STATIC ${LIB_PLUGINS_SRC})
target_link_libraries(weechat_plugins coverage_config)
add_definitions(${CMAKE_SHARED_LIBRARY_C_FLAGS})
if(NOT CYGWIN)

View File

@ -25,6 +25,6 @@ alias-config.c alias-config.h
alias-info.c alias-info.h)
set_target_properties(alias PROPERTIES PREFIX "")
target_link_libraries(alias)
target_link_libraries(alias coverage_config)
install(TARGETS alias LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -25,6 +25,6 @@ buflist-config.c buflist-config.h
buflist-mouse.c buflist-mouse.h)
set_target_properties(buflist PROPERTIES PREFIX "")
target_link_libraries(buflist)
target_link_libraries(buflist coverage_config)
install(TARGETS buflist LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -23,9 +23,9 @@ set_target_properties(charset PROPERTIES PREFIX "")
if(ICONV_FOUND)
include_directories(${ICONV_INCLUDE_PATH})
if(ICONV_LIBRARY)
target_link_libraries(charset ${ICONV_LIBRARY})
target_link_libraries(charset ${ICONV_LIBRARY} coverage_config)
else()
target_link_libraries(charset)
target_link_libraries(charset coverage_config)
endif()
endif()

View File

@ -25,6 +25,6 @@ exec-completion.c exec-completion.h
exec-config.c exec-config.h)
set_target_properties(exec PROPERTIES PREFIX "")
target_link_libraries(exec)
target_link_libraries(exec coverage_config)
install(TARGETS exec LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -24,6 +24,6 @@ fifo-config.c fifo-config.h
fifo-info.c fifo-info.h)
set_target_properties(fifo PROPERTIES PREFIX "")
target_link_libraries(fifo)
target_link_libraries(fifo coverage_config)
install(TARGETS fifo LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -29,6 +29,6 @@ fset-mouse.c fset-mouse.h
fset-option.c fset-option.h)
set_target_properties(fset PROPERTIES PREFIX "")
target_link_libraries(fset)
target_link_libraries(fset coverage_config)
install(TARGETS fset LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -26,7 +26,7 @@ if(GUILE_FOUND)
include_directories(${GUILE_INCLUDE_DIRS})
set(LINK_LIBS)
list(APPEND LINK_LIBS ${GUILE_LDFLAGS})
target_link_libraries(guile ${LINK_LIBS} weechat_plugins_scripts)
target_link_libraries(guile ${LINK_LIBS} weechat_plugins_scripts coverage_config)
endif()
install(TARGETS guile LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -59,6 +59,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND LINK_LIBS "resolv")
endif()
target_link_libraries(irc ${LINK_LIBS})
target_link_libraries(irc ${LINK_LIBS} coverage_config)
install(TARGETS irc LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -27,7 +27,7 @@ set_target_properties(javascript PROPERTIES PREFIX "")
if(V8_FOUND)
include_directories(${V8_INCLUDE_DIR})
target_link_libraries(javascript ${V8_LIBRARY} weechat_plugins_scripts)
target_link_libraries(javascript ${V8_LIBRARY} weechat_plugins_scripts coverage_config)
endif()
install(TARGETS javascript LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -26,6 +26,6 @@ logger-info.c logger-info.h
logger-tail.c logger-tail.h)
set_target_properties(logger PROPERTIES PREFIX "")
target_link_libraries(logger)
target_link_libraries(logger coverage_config)
install(TARGETS logger LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -25,7 +25,7 @@ set_target_properties(lua PROPERTIES PREFIX "")
if(LUA_FOUND)
include_directories(${LUA_INCLUDE_DIRS})
target_link_libraries(lua ${LUA_LDFLAGS} weechat_plugins_scripts)
target_link_libraries(lua ${LUA_LDFLAGS} weechat_plugins_scripts coverage_config)
endif()
install(TARGETS lua LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -36,10 +36,10 @@ if(PERL_FOUND)
string(REPLACE "${PERL_DYNALOADER}" "" PERL_LFLAGS "${PERL_LFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PERL_DYNALOADER} ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a coverage_config)
else()
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts)
target_link_libraries(perl ${PERL_LIBRARY} weechat_plugins_scripts coverage_config)
endif()
endif()

View File

@ -25,7 +25,7 @@ set_target_properties(php PROPERTIES PREFIX "")
if(PHP_FOUND)
include_directories(${PHP_INCLUDE_DIRS})
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PHP_LDFLAGS}")
target_link_libraries(php ${PHP_LIB} weechat_plugins_scripts)
target_link_libraries(php ${PHP_LIB} weechat_plugins_scripts coverage_config)
endif()
install(TARGETS php LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -25,7 +25,7 @@ set_target_properties(python PROPERTIES PREFIX "")
if(PYTHON_FOUND)
include_directories(${PYTHON_INCLUDE_PATH})
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PYTHON_LFLAGS}")
target_link_libraries(python ${PYTHON_LIBRARY} weechat_plugins_scripts)
target_link_libraries(python ${PYTHON_LIBRARY} weechat_plugins_scripts coverage_config)
endif()
install(TARGETS python LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -47,6 +47,6 @@ if(GNUTLS_FOUND)
list(APPEND LINK_LIBS ${GNUTLS_LIBRARY})
endif()
target_link_libraries(relay ${LINK_LIBS})
target_link_libraries(relay ${LINK_LIBS} coverage_config)
install(TARGETS relay LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -26,7 +26,7 @@ if(RUBY_FOUND)
include_directories(${RUBY_INCLUDE_DIRS})
set(LINK_LIBS)
list(APPEND LINK_LIBS ${RUBY_LDFLAGS})
target_link_libraries(ruby ${LINK_LIBS} ${RUBY_LIB} weechat_plugins_scripts)
target_link_libraries(ruby ${LINK_LIBS} ${RUBY_LIB} weechat_plugins_scripts coverage_config)
endif(RUBY_FOUND)
install(TARGETS ruby LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -34,6 +34,6 @@ set(LINK_LIBS)
list(APPEND LINK_LIBS ${ZLIB_LIBRARY})
list(APPEND LINK_LIBS ${GCRYPT_LDFLAGS})
target_link_libraries(script ${LINK_LIBS})
target_link_libraries(script ${LINK_LIBS} coverage_config)
install(TARGETS script LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -30,12 +30,12 @@ set_target_properties(spell PROPERTIES PREFIX "")
if(ENCHANT_FOUND)
include_directories(${ENCHANT_INCLUDE_DIR})
target_link_libraries(spell ${ENCHANT_LIBRARIES})
target_link_libraries(spell ${ENCHANT_LIBRARIES} coverage_config)
add_definitions(-DUSE_ENCHANT)
else()
if(ASPELL_FOUND)
include_directories(${ASPELL_INCLUDE_PATH})
target_link_libraries(spell ${ASPELL_LIBRARY})
target_link_libraries(spell ${ASPELL_LIBRARY} coverage_config)
endif()
endif()

View File

@ -29,7 +29,7 @@ if(TCL_FOUND)
set(CMAKE_REQUIRED_LIBRARIES "${TCL_LIBRARY}")
include_directories(${TCL_INCLUDE_PATH})
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${TCL_LFLAGS}")
target_link_libraries(tcl ${TCL_LIBRARY} weechat_plugins_scripts)
target_link_libraries(tcl ${TCL_LIBRARY} weechat_plugins_scripts coverage_config)
endif()
install(TARGETS tcl LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -26,6 +26,6 @@ trigger-completion.c trigger-completion.h
trigger-config.c trigger-config.h)
set_target_properties(trigger PROPERTIES PREFIX "")
target_link_libraries(trigger)
target_link_libraries(trigger coverage_config)
install(TARGETS trigger LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -40,6 +40,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND LINK_LIBS "resolv")
endif()
target_link_libraries(xfer ${LINK_LIBS})
target_link_libraries(xfer ${LINK_LIBS} coverage_config)
install(TARGETS xfer LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -62,14 +62,14 @@ set(WEECHAT_TESTS_SRC tests.cpp tests.h)
add_executable(tests ${WEECHAT_TESTS_SRC})
set(LIBS
${LIBS}
${PROJECT_BINARY_DIR}/src/core/libweechat_core.a
${PROJECT_BINARY_DIR}/src/plugins/libweechat_plugins.a
${PROJECT_BINARY_DIR}/src/gui/libweechat_gui_common.a
${PROJECT_BINARY_DIR}/src/gui/curses/headless/libweechat_gui_headless.a
${PROJECT_BINARY_DIR}/src/gui/curses/headless/libweechat_ncurses_fake.a
${CMAKE_CURRENT_BINARY_DIR}/libweechat_unit_tests_core.a
weechat_core
weechat_plugins
weechat_gui_common
weechat_gui_headless
weechat_ncurses_fake
weechat_unit_tests_core
# due to circular references, we must link two times with libweechat_core.a
${PROJECT_BINARY_DIR}/src/core/libweechat_core.a
weechat_core
${EXTRA_LIBS}
${CURL_LIBRARIES}
${CPPUTEST_LIBRARIES}