cmake_minimum_required(VERSION 3.6.3) project(WebRTCClientStressTests LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 11) find_package(Threads REQUIRED) # --------------------------------------------------------------------------- # GStreamer Dependency Setup # --------------------------------------------------------------------------- if(WIN32 AND NOT DEFINED PKG_CONFIG_EXECUTABLE) if(EXISTS "C:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe") set(PKG_CONFIG_EXECUTABLE "C:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe") endif() endif() find_package(PkgConfig REQUIRED) pkg_check_modules(GST gstreamer-1.0) if(GST_FOUND) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig") find_library(Intl "intl" REQUIRED PATHS "/usr/local/opt/gettext/lib") link_directories("/usr/local/opt/gettext/lib") endif() pkg_check_modules(GLIB2 REQUIRED glib-2.0) pkg_check_modules(GST_APP REQUIRED gstreamer-app-1.0) pkg_check_modules(GOBJ2 REQUIRED gobject-2.0) message(STATUS "GStreamer found. Enabling GStreamer for stress tests.") # Collect include directories include_directories( ${GLIB2_INCLUDE_DIRS} ${GST_INCLUDE_DIRS} ${GST_APP_INCLUDE_DIRS} ${GOBJ2_INCLUDE_DIRS} ) # Collect libraries to link set(GST_STRESS_LIBRARIES ${GLIB2_LIBRARIES} ${GST_LIBRARIES} ${GST_APP_LIBRARIES} ${GOBJ2_LIBRARIES} ${Intl} ) # Map library directories link_directories( ${GLIB2_LIBRARY_DIRS} ${GST_LIBRARY_DIRS} ${GST_APP_LIBRARY_DIRS} ${GOBJ2_LIBRARY_DIRS} ) add_definitions(-DHAS_GSTREAMER) else() message(WARNING "GStreamer not found. Stress tests will build without GStreamer features.") endif() # --------------------------------------------------------------------------- # Targets # --------------------------------------------------------------------------- # Keep the tests simple and aligned with the sample architecture. # Each tcX is a pair of binaries: one client-side and one device-side. set(STRESS_TEST_CASES tc01 tc02 ) foreach(tc ${STRESS_TEST_CASES}) add_executable(test_p2p_${tc}_sdk_device ${CMAKE_CURRENT_SOURCE_DIR}/test_p2p_${tc}_sdk_device.c) target_link_libraries(test_p2p_${tc}_sdk_device PRIVATE webrtcClient websockets # Linked unconditionally to all targets now ${GST_STRESS_LIBRARIES} Threads::Threads ${CMAKE_DL_LIBS} rt) if(NOT tc STREQUAL "tc01") add_test(NAME test_p2p_${tc}_sdk_device COMMAND test_p2p_${tc}_sdk_device) endif() endforeach()