Commit 0d0d460c authored by Ghislain MARY's avatar Ghislain MARY

Build tests when building with CMake.

parent 64892163
......@@ -59,6 +59,8 @@ option(ENABLE_STATIC "Build static library (default is shared library)." NO)
option(ENABLE_DEBUG_LOGS "Enable the display of traces showing the execution of the library." NO)
option(ENABLE_FIXED_POINT "Turn on fixed point computations." ${ENABLE_FIXED_POINT_DEFAULT_VALUE})
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES)
cmake_dependent_option(ENABLE_DTLS "Build with DTLS support." YES "ENABLE_SRTP" NO)
option(ENABLE_SRTP "Build with the SRTP transport support." YES)
option(ENABLE_ZRTP "Build with ZRTP support." YES)
......@@ -93,6 +95,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CMakePushCheckState)
if(MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_PREFIX_PATH}/include/MSVC)
......@@ -134,6 +137,22 @@ include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
find_package(ORTP REQUIRED)
if(ENABLE_UNIT_TESTS)
find_package(CUnit)
if(CUNIT_FOUND)
cmake_push_check_state(RESET)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CUNIT_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CUNIT_LIBRARIES})
check_symbol_exists("CU_get_suite" "CUnit/CUnit.h" HAVE_CU_GET_SUITE)
check_symbol_exists("CU_curses_run_tests" "CUnit/CUnit.h" HAVE_CU_CURSES)
cmake_pop_check_state()
else()
message(WARNING "Could not find the cunit library!")
set(ENABLE_UNIT_TESTS OFF CACHE BOOL "Enable compilation of unit tests." FORCE)
endif()
endif()
if(ENABLE_SRTP)
find_package(SRTP)
if(NOT SRTP_FOUND)
......@@ -390,3 +409,6 @@ add_subdirectory(cmake)
add_subdirectory(help)
add_subdirectory(include)
add_subdirectory(src)
if(ENABLE_UNIT_TESTS)
add_subdirectory(tester)
endif()
......@@ -49,6 +49,9 @@
#cmakedefine WORDS_BIGENDIAN
#cmakedefine MS_FIXED_POINT
#cmakedefine HAVE_CU_GET_SUITE 1
#cmakedefine HAVE_CU_CURSES 1
#cmakedefine HAVE_SRTP
#cmakedefine HAVE_ZRTP
#cmakedefine HAVE_DTLS
......
############################################################################
# CMakeLists.txt
# Copyright (C) 2015 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
set(SOURCE_FILES
mediastreamer2_adaptive_tester.c
mediastreamer2_audio_stream_tester.c
mediastreamer2_basic_audio_tester.c
mediastreamer2_framework_tester.c
mediastreamer2_player_tester.c
mediastreamer2_sound_card_tester.c
mediastreamer2_tester.c
mediastreamer2_tester_private.c
)
if(ENABLE_VIDEO)
list(APPEND SOURCE_FILES mediastreamer2_video_stream_tester.c)
endif()
add_executable(mediastreamer2_tester ${SOURCE_FILES})
target_include_directories(mediastreamer2_tester PUBLIC ${CUNIT_INCLUDE_DIRS})
target_link_libraries(mediastreamer2_tester mediastreamer_voip mediastreamer_base ${CUNIT_LIBRARIES})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment