Skip to content

Commit

Permalink
Merge branch 'dev' into timedwait
Browse files Browse the repository at this point in the history
* dev: (21 commits)
  Fix SRT file transmit app to work in non-blocking mode (Haivision#334)
  Ensure stdout silence in console pipe out mode plus a few minor fixups (Haivision#275)
  Replaced hardcoded installdirs with GNUInstallDirs. Fixed some status messages. (Haivision#323)
  Breaking connection when recv buffer inflation caused sequence discrepancy (Haivision#300)
  Fixed problems with encryption decision and status report on encryption failure. (Haivision#318)
  Fixed invalid symbol names in doc (Haivision#311)
  Dev add version to winpackages (Haivision#328)
  Android build for dev (Haivision#326)
  Change License to MPLv2.0 (Haivision#327)
  Used constants for input rate. Fixed after-start rate sampling period to 1s (Haivision#315)
  Made SockaddrToString use only numeric string by default (Haivision#312)
  Ported change in Haivision#307 PR to dev
  Fixed SockaddrToString to format as 4dotIP if unknown (Haivision#299)
  Build with debug information for lldb on iOS platform (Haivision#302)
  Fix for sudden stop sending data on macOS/iOS (Haivision#303)
  Fix broken build when testing apps enabled (Haivision#296)
  Removed all code introduced for CBR (Haivision#293)
  Added API to get instantaneous stats instead of moving averages for a… (Haivision#288)
  Added toolchain file and build instruction for iOS (Haivision#286)
  Fix windows build (Haivision#290)
  ...
  • Loading branch information
Gummilion committed May 10, 2018
2 parents 7baaa3a + 2499cfe commit 5fbd980
Show file tree
Hide file tree
Showing 106 changed files with 2,682 additions and 2,527 deletions.
5 changes: 1 addition & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
init:
# -ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

configuration:
- Release
- Debug
Expand Down Expand Up @@ -34,4 +31,4 @@ after_build:
appveyor PushArtifact SRT-%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%-%APPVEYOR_BUILD_VERSION%.zip
on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
120 changes: 59 additions & 61 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
#
# SRT - Secure, Reliable, Transport
# Copyright (c) 2017 Haivision Systems Inc.
# Copyright (c) 2018 Haivision Systems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; If not, see <http://www.gnu.org/licenses/>
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
# XXX This can be potentially done in future, but there still exist
# some dependent project using cmake 2.8 - this can't be done this way.
Expand All @@ -26,6 +18,21 @@ set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
include(haiUtil)
include(FindPkgConfig)

# Platform shortcuts
set_if(DARWIN ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set_if(LINUX ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set_if(MICROSOFT WIN32 AND (NOT MINGW AND NOT CYGWIN))
set_if(SYMLINKABLE LINUX OR DARWIN OR CYGWIN)

# Not sure what to do in case of compiling by MSVC.
# This will make installdir in C:\Program Files\SRT then
# inside "bin" and "lib64" directories. At least this maintains
# the current status. Shall this be not desired, override values
# of CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR.
if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
include(GNUInstallDirs)
endif()

set (SRT_VERSION 1.3.0)
set_version_variables(SRT_VERSION ${SRT_VERSION})

Expand Down Expand Up @@ -73,6 +80,7 @@ option(ENABLE_HEAVY_LOGGING "Should heavy debug logging be enabled" ${ENABLE_HEA
option(ENABLE_SHARED "Should libsrt be built as a shared library" ON)
option(ENABLE_STATIC "Should libsrt be built as a static library" ON)
option(ENABLE_SUFLIP "Should suflip tool be built" OFF)
option(ENABLE_GETNAMEINFO "In-logs sockaddr-to-string should do rev-dns" OFF)
option(USE_GNUTLS "Should use gnutls instead of openssl" OFF)
option(ENABLE_C_DEPS "Extra library dependencies in srt.pc for C language" OFF)
option(USE_STATIC_LIBSTDCXX "Should use static rather than shared libstdc++" OFF)
Expand Down Expand Up @@ -131,12 +139,6 @@ if (DEFINED WITH_SRT_TARGET)
set (TARGET_haisrt ${WITH_SRT_TARGET})
endif()

set_if(DARWIN ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set_if(LINUX ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set_if(MICROSOFT WIN32 AND (NOT MINGW AND NOT CYGWIN))

set_if(SYMLINKABLE LINUX OR DARWIN OR CYGWIN)

# When you use crosscompiling, you have to take care that PKG_CONFIG_PATH
# and CMAKE_PREFIX_PATH are set properly.

Expand Down Expand Up @@ -175,7 +177,7 @@ else()
if ("${SSL_LIBRARY_DIRS}" STREQUAL "")
if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
message(STATUS "WARNING: pkg-config has incorrect prefix - enforcing target path prefix: ${CMAKE_PREFIX_PATH}")
set (SSL_LIBRARY_DIRS ${CMAKE_PREFIX_PATH}/lib)
set (SSL_LIBRARY_DIRS ${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR})
set (SSL_INCLUDE_DIRS ${CMAKE_PREFIX_PATH}/include)
endif()
endif()
Expand Down Expand Up @@ -263,19 +265,20 @@ set (SRT_SRC_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
set (SRT_SRC_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools)

if(WIN32)
message(STATUS "DETECTED SYSTEM: WINDOWS; WIN32=1; PTW32_STATIC_LIB=1")
add_definitions(-DWIN32=1 -DPTW32_STATIC_LIB)
elseif(DARWIN)
message(STATUS "DARWIN detected")
message(STATUS "DETECTED SYSTEM: DARWIN; OSX=11; MACOSX_RPATH=OFF")
add_definitions(-DOSX=1)
set(MACOSX_RPATH OFF)
elseif(LINUX)
add_definitions(-DLINUX=1)
message(STATUS "LINUX detected" )
message(STATUS "DETECTED SYSTEM: LINUX; LINUX=1" )
elseif(CYGWIN)
add_definitions(-DCYGWIN=1)
message(STATUS "CYGWIN (posix mode) detected")
message(STATUS "DETECTED SYSTEM: CYGWIN (posix mode); CYGWIN=1")
else()
message(FATAL_ERROR "Unsupported system")
message(FATAL_ERROR "Unsupported system: ${CMAKE_SYSTEM_NAME}")
endif()

add_definitions(
Expand All @@ -296,6 +299,10 @@ if (ENABLE_LOGGING)
endif()
endif()

if (ENABLE_GETNAMEINFO)
list(APPEND SRT_EXTRA_CFLAGS "-DENABLE_GETNAMEINFO=1")
endif()

if (ENABLE_THREAD_CHECK)
add_definitions(
-DSRT_ENABLE_THREADCHECK=1
Expand All @@ -310,10 +317,12 @@ if (${ENABLE_PROFILE} AND HAVE_COMPILER_GNU_COMPAT)
link_libraries(-g -pg)
endif()


if (MINGW)
set (PTHREAD_LIBRARY -lpthreadGC2)
else()
elseif (PTHREAD_LIBRARY AND PTHREAD_INCLUDE_DIR)
message(STATUS "Pthread library: ${PTHREAD_LIBRARY}")
message(STATUS "Pthread include dir: ${PTHREAD_INCLUDE_DIR}")
elseif (WIN32)
# find pthread
find_path(PTHREAD_INCLUDE_DIR pthread.h HINTS C:/pthread-win32/include)
if (PTHREAD_INCLUDE_DIR)
Expand All @@ -326,15 +335,13 @@ else()
if (PTHREAD_LIBRARY)
message(STATUS "Pthread library: ${PTHREAD_LIBRARY}")
else()
if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
message(STATUS "WARNING: cross-compiler pthread not found - fallback to POSIX default")
set (PTHREAD_LIBRARY -pthread)
set (PTHREAD_INCLUDE_DIR "")
else()
message(FATAL_ERROR "Failed to find pthread library. Specify PTHREAD_LIBRARY.")
endif()
message(FATAL_ERROR "Failed to find pthread library. Specify PTHREAD_LIBRARY.")
endif()
endif() # if (NOT MINGW)
else ()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(PTHREAD_LIBRARY ${CMAKE_THREAD_LIBS_INIT})
endif()

# This is required in some projects that add some other sources
# to the SRT library to be compiled together (aka "virtual library").
Expand Down Expand Up @@ -418,7 +425,6 @@ set (VIRTUAL_srt $<TARGET_OBJECTS:srt_virtual> $<TARGET_OBJECTS:haicrypt_virtual
set (HEADERS_srt ${HEADERS_srt} ${HEADERS_srt_win32})

if (srt_libspec_shared)
message (STATUS "SRT: defining SHARED library: ${TARGET_srt} from: ${VIRTUAL_srt}")
add_library(${TARGET_srt}_shared SHARED ${VIRTUAL_srt})
# shared libraries need PIC
set_property(TARGET ${TARGET_srt}_shared PROPERTY OUTPUT_NAME ${TARGET_srt})
Expand All @@ -431,7 +437,6 @@ if (srt_libspec_shared)
endif()

if (srt_libspec_static)
message (STATUS "SRT: defining STATIC library: ${TARGET_srt} from: ${VIRTUAL_srt}")
add_library(${TARGET_srt}_static STATIC ${VIRTUAL_srt})

# For Windows, leave the name to be "srt_static.lib".
Expand Down Expand Up @@ -498,13 +503,6 @@ endforeach()

set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ${PTHREAD_LIBRARY})

if ( LINUX )
# Unsure why libdl was required, keeping for the time being.
#target_link_libraries(${TARGET_srt} PUBLIC dl)
set (IFNEEDED_SRT_LDFLAGS -pthread)
endif()


target_compile_definitions(srt_virtual PRIVATE -DSRT_EXPORTS )
target_compile_definitions(haicrypt_virtual PUBLIC -DHAICRYPT_DYNAMIC)
if (ENABLE_SHARED)
Expand All @@ -518,20 +516,21 @@ endif()

# Cygwin installs the *.dll libraries in bin directory and uses PATH.

set (INSTALL_SHARED_DIR lib)
set (INSTALL_SHARED_DIR ${CMAKE_INSTALL_LIBDIR})
if (CYGWIN)
set (INSTALL_SHARED_DIR bin)
set (INSTALL_SHARED_DIR ${CMAKE_INSTALL_BINDIR})
endif()

message(STATUS "INSTALL DIRS: bin=${CMAKE_INSTALL_BINDIR} lib=${CMAKE_INSTALL_LIBDIR} shlib=${INSTALL_SHARED_DIR} include=${CMAKE_INSTALL_INCLUDEDIR}")

install(TARGETS ${INSTALL_TARGETS}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${INSTALL_SHARED_DIR}
)
install(FILES ${HEADERS_srt} DESTINATION include/srt)
install(FILES ${HEADERS_srt} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/srt)
if (WIN32)
install(FILES ${HEADERS_srt_win32} DESTINATION include/srt/win)
install(FILES ${HEADERS_srt_win32} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/srt/win)
endif()

# ---
Expand Down Expand Up @@ -562,17 +561,17 @@ endif()
# Some sensible solution for that is desired. Currently turned on only on demand.
if (ENABLE_C_DEPS)
if ( LINUX )
set (IFNEEDED_SRT_LDFLAGS "${IFNEEDED_SRT_LDFLAGS} -lstdc++ -lm")
set (IFNEEDED_SRT_LDFLAGS "-lstdc++ -lm")
endif()
endif()

join_arguments(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE})

# haisrt.pc left temporarily for backward compatibility. To be removed in future!
configure_file(scripts/srt.pc.in haisrt.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/haisrt.pc DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/haisrt.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
configure_file(scripts/srt.pc.in srt.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/srt.pc DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/srt.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

# Applications

Expand Down Expand Up @@ -604,7 +603,7 @@ macro(srt_add_program name)
add_executable(${name} ${ARGN})
target_include_directories(${name} PRIVATE apps)
target_include_directories(${name} PRIVATE common)
install(TARGETS ${name} RUNTIME DESTINATION bin)
install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endmacro()

macro(srt_make_application name)
Expand All @@ -616,17 +615,16 @@ macro(srt_make_application name)
# set (CMAKE_SKIP_RPATH FALSE)
# set (CMAKE_SKIP_BUILD_RPATH FALSE)
# set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# set (CMAKE_INSTALL_RPATH "../lib")
# set (CMAKE_INSTALL_RPATH "../${CMAKE_INSTALL_LIBDIR}")
# set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# set (FORCE_RPATH BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH TRUE)

if (LINUX)
# This is only needed on Linux, on Windows (including Cygwin) the library file will
# be placed into the binrary directory anyway.
# XXX not sure about Mac.
# XXX This needs to be probably lib64 on 64-bit systems and 64-bit build.
# See this name used already in install(${TARGET_srt} LIBRARY DESTINATION...).
set(FORCE_RPATH LINK_FLAGS -Wl,-rpath,.,-rpath,../lib,-rpath,../lib64 BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH TRUE)
set(FORCE_RPATH LINK_FLAGS -Wl,-rpath,.,-rpath,../${CMAKE_INSTALL_LIBDIR} BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()

# We state that Darwin always uses CLANG compiler, which honors this flag the same way.
Expand All @@ -638,7 +636,7 @@ endmacro()
macro(srt_add_application name sources)
srt_add_program(${name} apps/${name}.cpp ${sources})
srt_make_application(${name})
install(TARGETS ${name} RUNTIME DESTINATION bin)
install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endmacro()

if ( ENABLE_CXX11 )
Expand Down Expand Up @@ -676,15 +674,15 @@ if ( ENABLE_CXX11 )

if (SYMLINKABLE)
message(STATUS "BACKWARD COMPATIBLE 'stransmit': will use symbolic link")
srt_install_symlink(srt-live-transmit ${CMAKE_INSTALL_PREFIX}/bin/stransmit)
srt_install_symlink(srt-live-transmit ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/stransmit)
elseif(${CMAKE_MAJOR_VERSION} LESS 3)
message(FATAL_ERROR "Your system can't install symbolic link to 'stransmit', copy-on-install requires cmake at least 3.0.2")
else()
# This installation doesn't work with cmake earlier than 3.0
# (looxlike cmake 2.8 somehow doesn't have a problem with resolving the $<TARGET_FILE_DIR:...>
# inside the generated makefile, but does have problem with its own generated cmake_install.cmake :D)
message(STATUS "BACKWARD COMPATIBLE 'stransmit': will use copying")
install(PROGRAMS ${stransmit_path} DESTINATION bin)
install(PROGRAMS ${stransmit_path} DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

# srt-file-transmit must be temporarily blocked on Windows because it's not yet portable
Expand Down Expand Up @@ -745,7 +743,7 @@ if (ENABLE_EXAMPLES)

endif()

install(PROGRAMS scripts/srt-ffplay DESTINATION bin)
install(PROGRAMS scripts/srt-ffplay DESTINATION ${CMAKE_INSTALL_BINDIR})


if (DEFINED SRT_EXTRA_APPS_INC)
Expand All @@ -761,5 +759,5 @@ if ( ENABLE_SUFLIP )
)
srt_add_program(suflip ${SOURCES_suflip})
target_link_libraries(suflip ${srt_link_library})
install(TARGETS suflip RUNTIME DESTINATION bin)
install(TARGETS suflip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## License

By contributing code to the [SRT project](https://github.com/Haivision/srt/), you agree to license your contribution under the [LGPLv2.1 License](COPYING).
By contributing code to the [SRT project](https://github.com/Haivision/srt/), you agree to license your contribution under the [MPLv2.0 License](LICENSE).

## Issues

Expand Down
Loading

0 comments on commit 5fbd980

Please sign in to comment.