Skip to content

Commit

Permalink
CMakeLists.txt: Allow building using gnustl
Browse files Browse the repository at this point in the history
Mattew created this patch for cerbero, and it is ported to srt 1.3.3.
Refer to
https://gitlab.freedesktop.org/gstreamer/cerbero/commit/8ca02e6fe8bb151496dd6eb9961692c39894ec82
  • Loading branch information
justinjoy authored and rndi committed Aug 12, 2019
1 parent 04f7cce commit 7ec45dd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ option(USE_STATIC_LIBSTDCXX "Should use static rather than shared libstdc++" OFF
option(ENABLE_INET_PTON "Set to OFF to prevent usage of inet_pton when building against modern SDKs while still requiring compatibility with older Windows versions, such as Windows XP, Windows Server 2003 etc." ON)
option(USE_OPENSSL_PC "Use pkg-config to find OpenSSL libraries" ON)
option(USE_BUSY_WAITING "Enable more accurate sending times at a cost of potentially higher CPU load" OFF)
option(USE_GNUSTL "Get c++ library/headers from the gnustl.pc" OFF)

set(TARGET_srt "srt" CACHE STRING "The name for the SRT library")

Expand Down Expand Up @@ -281,6 +282,14 @@ else()
message(STATUS "ENCRYPTION: DISABLED")
endif()

if ( USE_GNUSTL )
pkg_check_modules (GNUSTL REQUIRED gnustl)
link_directories(${GNUSTL_LIBRARY_DIRS})
include_directories(${GNUSTL_INCLUDE_DIRS})
set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ${GNUSTL_LIBRARIES} ${GNUSTL_LDFLAGS})
endif()


# Detect if the compiler is GNU compatable for flags
set(HAVE_COMPILER_GNU_COMPAT 0)
foreach (gnid GNU Intel Clang AppleClang)
Expand Down Expand Up @@ -543,6 +552,9 @@ if (srt_libspec_shared)
elseif (APPLE)
set_property(TARGET ${TARGET_srt}_shared PROPERTY MACOSX_RPATH ON)
endif()
if (USE_GNUSTL)
target_link_libraries(${TARGET_srt}_shared PRIVATE ${GNUSTL_LIBRARIES} ${GNUSTL_LDFLAGS})
endif()
endif()

if (srt_libspec_static)
Expand Down Expand Up @@ -571,6 +583,9 @@ if (srt_libspec_static)
elseif (MINGW)
target_link_libraries(${TARGET_srt}_static PRIVATE wsock32 ws2_32)
endif()
if (USE_GNUSTL)
target_link_libraries(${TARGET_srt}_static PRIVATE ${GNUSTL_LIBRARIES} ${GNUSTL_LDFLAGS})
endif()
endif()


Expand Down Expand Up @@ -743,6 +758,9 @@ macro(srt_make_application name)
set_target_properties(${name} PROPERTIES COMPILE_FLAGS "${CFLAGS_CXX_STANDARD} ${EXTRA_stransmit}" ${FORCE_RPATH})

target_link_libraries(${name} ${srt_link_library})
if (USE_GNUSTL)
target_link_libraries(${name} PRIVATE ${GNUSTL_LIBRARIES} ${GNUSTL_LDFLAGS})
endif()
if (srt_libspec_static AND CMAKE_DL_LIBS)
target_link_libraries(${name} ${CMAKE_DL_LIBS})
endif()
Expand Down

0 comments on commit 7ec45dd

Please sign in to comment.