mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SRT: Build SRT from source by SRS. 4.0.115
This commit is contained in:
parent
262f0fc8c8
commit
90f1b482ab
115 changed files with 44513 additions and 19 deletions
115
trunk/3rdparty/srt-1-fit/scripts/FindMbedTLS.cmake
vendored
Normal file
115
trunk/3rdparty/srt-1-fit/scripts/FindMbedTLS.cmake
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
# original file from obs-studio:
|
||||
# https://github.com/obsproject/obs-studio
|
||||
# /cmake/Modules/FindMbedTLS.cmake
|
||||
#
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# LIBMBEDTLS_FOUND
|
||||
# LIBMBEDTLS_INCLUDE_DIRS
|
||||
# LIBMBEDTLS_LIBRARIES
|
||||
#
|
||||
# For use in OBS:
|
||||
#
|
||||
# MBEDTLS_INCLUDE_DIR
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_MBEDTLS QUIET mbedtls)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
# If we're on MacOS or Linux, please try to statically-link mbedtls.
|
||||
if(STATIC_MBEDTLS AND (APPLE OR UNIX))
|
||||
set(_MBEDTLS_LIBRARIES libmbedtls.a)
|
||||
set(_MBEDCRYPTO_LIBRARIES libmbedcrypto.a)
|
||||
set(_MBEDX509_LIBRARIES libmbedx509.a)
|
||||
endif()
|
||||
|
||||
find_path(MBEDTLS_INCLUDE_DIR
|
||||
NAMES mbedtls/ssl.h
|
||||
HINTS
|
||||
${MBEDTLS_PREFIX}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES
|
||||
include)
|
||||
|
||||
find_library(MBEDTLS_LIB
|
||||
NAMES ${_MBEDTLS_LIBRARIES} mbedtls libmbedtls
|
||||
HINTS
|
||||
${MBEDTLS_PREFIX}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin
|
||||
../lib${_lib_suffix} ../lib
|
||||
../libs${_lib_suffix} ../libs
|
||||
../bin${_lib_suffix} ../bin)
|
||||
|
||||
find_library(MBEDCRYPTO_LIB
|
||||
NAMES ${_MBEDCRYPTO_LIBRARIES} mbedcrypto libmbedcrypto
|
||||
HINTS
|
||||
${MBEDTLS_PREFIX}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin
|
||||
../lib${_lib_suffix} ../lib
|
||||
../libs${_lib_suffix} ../libs
|
||||
../bin${_lib_suffix} ../bin)
|
||||
|
||||
find_library(MBEDX509_LIB
|
||||
NAMES ${_MBEDX509_LIBRARIES} mbedx509 libmbedx509
|
||||
HINTS
|
||||
${MBEDTLS_PREFIX}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin
|
||||
../lib${_lib_suffix} ../lib
|
||||
../libs${_lib_suffix} ../libs
|
||||
../bin${_lib_suffix} ../bin)
|
||||
|
||||
# Sometimes mbedtls is split between three libs, and sometimes it isn't.
|
||||
# If it isn't, let's check if the symbols we need are all in MBEDTLS_LIB.
|
||||
if(MBEDTLS_LIB AND NOT MBEDCRYPTO_LIB AND NOT MBEDX509_LIB)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MBEDTLS_LIB})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIR})
|
||||
check_symbol_exists(mbedtls_x509_crt_init "mbedtls/x509_crt.h" MBEDTLS_INCLUDES_X509)
|
||||
check_symbol_exists(mbedtls_sha256_init "mbedtls/sha256.h" MBEDTLS_INCLUDES_CRYPTO)
|
||||
unset(CMAKE_REQUIRED_INCLUDES)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
endif()
|
||||
|
||||
# If we find all three libraries, then go ahead.
|
||||
if(MBEDTLS_LIB AND MBEDCRYPTO_LIB AND MBEDX509_LIB)
|
||||
set(LIBMBEDTLS_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
|
||||
set(LIBMBEDTLS_LIBRARIES ${MBEDTLS_LIB} ${MBEDCRYPTO_LIB} ${MBEDX509_LIB})
|
||||
set(MBEDTLS_INCLUDE_DIRS ${LIBMBEDTLS_INCLUDE_DIRS})
|
||||
set(MBEDTLS_LIBRARIES ${LIBMBEDTLS_LIBRARIES})
|
||||
|
||||
# Otherwise, if we find MBEDTLS_LIB, and it has both CRYPTO and x509
|
||||
# within the single lib (i.e. a windows build environment), then also
|
||||
# feel free to go ahead.
|
||||
elseif(MBEDTLS_LIB AND MBEDTLS_INCLUDES_CRYPTO AND MBEDTLS_INCLUDES_X509)
|
||||
set(LIBMBEDTLS_INCLUDE_DIRS ${MBEDTLS_INCLUDE_DIR})
|
||||
set(LIBMBEDTLS_LIBRARIES ${MBEDTLS_LIB})
|
||||
set(MBEDTLS_INCLUDE_DIRS ${LIBMBEDTLS_INCLUDE_DIRS})
|
||||
set(MBEDTLS_LIBRARIES ${LIBMBEDTLS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Now we've accounted for the 3-vs-1 library case:
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libmbedtls DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
|
||||
mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
|
56
trunk/3rdparty/srt-1-fit/scripts/check-deps
vendored
Executable file
56
trunk/3rdparty/srt-1-fit/scripts/check-deps
vendored
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
# Now Check if Tcl is installed, run it if so. The backslash extends the comment and hides the line below against Tcl interpreter \
|
||||
exec tclsh "$0" "$@" || echo "Please install 'tcl' package first - it's required to run any other scripts here." && exit 1
|
||||
|
||||
#
|
||||
# SRT - Secure, Reliable, Transport
|
||||
# Copyright (c) 2018 Haivision Systems Inc.
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
if { [catch {package require Tcl 8.5}] } {
|
||||
puts stderr "Tcl version at least 8.5 required, please upgrade"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set ok 1
|
||||
|
||||
if { [catch {exec pkg-config --exists openssl}] } {
|
||||
set ok 0
|
||||
puts "Openssl: NOT INSTALLED, please install (libssl-dev\[el\], openssl-dev\[el\] etc.)"
|
||||
} else {
|
||||
puts "Openssl: found version [exec pkg-config --modversion openssl] -- ok"
|
||||
}
|
||||
|
||||
|
||||
set nothave [catch {set cmake [exec cmake --version]}]
|
||||
|
||||
if { $nothave } {
|
||||
puts "CMake version >= 2.8 required - please install cmake"
|
||||
set ok 0
|
||||
} else {
|
||||
set cmakel1 [lindex [split $cmake \n] 0]
|
||||
set cv [lindex $cmakel1 end]
|
||||
if { [package vcompare $cv 2.8] == -1 } {
|
||||
puts "CMake version >= 2.8 required - please upgrade cmake"
|
||||
set ok 0
|
||||
} else {
|
||||
puts "Cmake version $cv -- ok."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# May others also apply
|
||||
|
||||
if { $ok } {
|
||||
puts "All dependencies satisfied, you should be good to go."
|
||||
exit 0
|
||||
}
|
||||
|
||||
puts "Please fix the above findings before compiling"
|
||||
exit 1
|
||||
|
||||
|
35
trunk/3rdparty/srt-1-fit/scripts/gather-package.bat
vendored
Normal file
35
trunk/3rdparty/srt-1-fit/scripts/gather-package.bat
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
rem Create empty directories for package bundle
|
||||
@echo off
|
||||
|
||||
IF "%PLATFORM%"=="x86" (
|
||||
SET FOLDER_PLATFORM="32"
|
||||
) ELSE IF "%PLATFORM%"=="x64" (
|
||||
SET FOLDER_PLATFORM="64"
|
||||
) ELSE (
|
||||
echo "Platform %PLATFORM% is not supported"
|
||||
exit 1
|
||||
)
|
||||
|
||||
md %APPVEYOR_BUILD_FOLDER%\package
|
||||
md %APPVEYOR_BUILD_FOLDER%\package\include
|
||||
md %APPVEYOR_BUILD_FOLDER%\package\include\win
|
||||
md %APPVEYOR_BUILD_FOLDER%\package\bin
|
||||
md %APPVEYOR_BUILD_FOLDER%\package\lib
|
||||
md %APPVEYOR_BUILD_FOLDER%\package\openssl-win%FOLDER_PLATFORM%
|
||||
|
||||
rem Gather SRT includes, binaries and libs
|
||||
copy %APPVEYOR_BUILD_FOLDER%\version.h %APPVEYOR_BUILD_FOLDER%\package\include\
|
||||
copy %APPVEYOR_BUILD_FOLDER%\srtcore\*.h %APPVEYOR_BUILD_FOLDER%\package\include\
|
||||
copy %APPVEYOR_BUILD_FOLDER%\haicrypt\*.h %APPVEYOR_BUILD_FOLDER%\package\include\
|
||||
copy %APPVEYOR_BUILD_FOLDER%\common\*.h %APPVEYOR_BUILD_FOLDER%\package\include\
|
||||
copy %APPVEYOR_BUILD_FOLDER%\common\win\*.h %APPVEYOR_BUILD_FOLDER%\package\include\win\
|
||||
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.exe %APPVEYOR_BUILD_FOLDER%\package\bin\
|
||||
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.dll %APPVEYOR_BUILD_FOLDER%\package\bin\
|
||||
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.lib %APPVEYOR_BUILD_FOLDER%\package\lib\
|
||||
IF "%CONFIGURATION%"=="Debug" (
|
||||
copy %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*.pdb %APPVEYOR_BUILD_FOLDER%\package\bin\
|
||||
)
|
||||
|
||||
rem gather 3rd party openssl elements
|
||||
(robocopy c:\openssl-win%FOLDER_PLATFORM%\ %APPVEYOR_BUILD_FOLDER%\package\openssl-win%FOLDER_PLATFORM% /s /e /np) ^& IF %ERRORLEVEL% GTR 1 exit %ERRORLEVEL%
|
||||
exit 0
|
115
trunk/3rdparty/srt-1-fit/scripts/generate-configure-options.tcl
vendored
Executable file
115
trunk/3rdparty/srt-1-fit/scripts/generate-configure-options.tcl
vendored
Executable file
|
@ -0,0 +1,115 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
set cachefile [lindex $argv 0]
|
||||
|
||||
if { $cachefile == "" } {
|
||||
puts stderr "Usage: [file tail $argv0] <existing CMakeCache.txt file>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set struct {
|
||||
name
|
||||
type
|
||||
value
|
||||
description
|
||||
}
|
||||
|
||||
set fd [open $cachefile r]
|
||||
|
||||
set cached ""
|
||||
|
||||
set dbase ""
|
||||
|
||||
while {[gets $fd line] != -1 } {
|
||||
set line [string trim $line]
|
||||
|
||||
# Hash comment
|
||||
if { [string index $line 0] == "#" } {
|
||||
continue
|
||||
}
|
||||
|
||||
# empty line
|
||||
if { $line == "" } {
|
||||
set cached ""
|
||||
continue
|
||||
}
|
||||
|
||||
if { [string range $line 0 1] == "//" } {
|
||||
set linepart [string range $line 2 end]
|
||||
# Variable description. Add to cache.
|
||||
if { $cached != "" && [string index $cached end] != " " && [string index $linepart 0] != " " } {
|
||||
append cached " "
|
||||
}
|
||||
append cached $linepart
|
||||
}
|
||||
|
||||
# Possibly a variable
|
||||
if [string is alpha [string index $line 0]] {
|
||||
# Note: this skips variables starting grom underscore.
|
||||
|
||||
if { [string range $line 0 5] == "CMAKE_" } {
|
||||
# Skip variables with CMAKE_ prefix, they are internal.
|
||||
continue
|
||||
}
|
||||
|
||||
lassign [split $line =] vartype value
|
||||
lassign [split $vartype :] var type
|
||||
|
||||
# Store the variable now
|
||||
set storage [list $var $type $value $cached]
|
||||
set cached ""
|
||||
lappend dbase $storage
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
#puts stderr "Ignored line: $line"
|
||||
|
||||
# Ignored.
|
||||
}
|
||||
|
||||
# Now look over the stored variables
|
||||
|
||||
set lenlimit 80
|
||||
|
||||
foreach stor $dbase {
|
||||
|
||||
lassign $stor {*}$struct
|
||||
|
||||
if { [string length $description] > $lenlimit } {
|
||||
set description [string range $description 0 $lenlimit-2]...
|
||||
}
|
||||
|
||||
if { $type in {STATIC INTERNAL} } {
|
||||
continue
|
||||
}
|
||||
|
||||
# Check special case of CXX to turn back to c++.
|
||||
set pos [string first CXX $name]
|
||||
if { $pos != -1 } {
|
||||
# Check around, actually after XX should be no letter.
|
||||
if { $pos+3 >= [string length $name] || ![string is alpha [string index $name $pos+3]] } {
|
||||
set name [string replace $name $pos $pos+2 C++]
|
||||
}
|
||||
}
|
||||
|
||||
set optname [string tolower [string map {_ -} $name]]
|
||||
|
||||
# Variables of type bool are just empty.
|
||||
# Variables of other types must have =<value> added.
|
||||
# Lowercase cmake type will be used here.
|
||||
set optassign ""
|
||||
set def ""
|
||||
if { $type != "BOOL" } {
|
||||
set optassign "=<[string tolower $type]>"
|
||||
} else {
|
||||
# Supply default for boolean option
|
||||
set def " (default: $value)"
|
||||
}
|
||||
|
||||
puts " $optname$optassign \"$description$def\""
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
19
trunk/3rdparty/srt-1-fit/scripts/googletest-download.cmake
vendored
Normal file
19
trunk/3rdparty/srt-1-fit/scripts/googletest-download.cmake
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
# code copied from https://crascit.com/2015/07/25/cmake-gtest/
|
||||
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||||
|
||||
project(googletest-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(
|
||||
googletest
|
||||
SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src"
|
||||
BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build"
|
||||
GIT_REPOSITORY
|
||||
https://github.com/google/googletest.git
|
||||
GIT_TAG release-1.8.1
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
32
trunk/3rdparty/srt-1-fit/scripts/googletest.cmake
vendored
Normal file
32
trunk/3rdparty/srt-1-fit/scripts/googletest.cmake
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
# the following code to fetch googletest
|
||||
# is inspired by and adapted after https://crascit.com/2015/07/25/cmake-gtest/
|
||||
# download and unpack googletest at configure time
|
||||
|
||||
macro(fetch_googletest _download_module_path _download_root)
|
||||
set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root})
|
||||
configure_file(
|
||||
${_download_module_path}/googletest-download.cmake
|
||||
${_download_root}/CMakeLists.txt
|
||||
@ONLY
|
||||
)
|
||||
unset(GOOGLETEST_DOWNLOAD_ROOT)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY
|
||||
${_download_root}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY
|
||||
${_download_root}
|
||||
)
|
||||
|
||||
# adds the targers: gtest, gtest_main, gmock, gmock_main
|
||||
add_subdirectory(
|
||||
${_download_root}/googletest-src
|
||||
${_download_root}/googletest-build
|
||||
)
|
||||
endmacro()
|
291
trunk/3rdparty/srt-1-fit/scripts/haiUtil.cmake
vendored
Normal file
291
trunk/3rdparty/srt-1-fit/scripts/haiUtil.cmake
vendored
Normal file
|
@ -0,0 +1,291 @@
|
|||
#
|
||||
# SRT - Secure, Reliable, Transport
|
||||
# Copyright (c) 2018 Haivision Systems Inc.
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# Useful for combinging paths
|
||||
|
||||
function(adddirname prefix lst out_lst)
|
||||
set(output)
|
||||
foreach(item ${lst})
|
||||
list(APPEND output "${prefix}/${item}")
|
||||
endforeach()
|
||||
set(${out_lst} ${${out_lst}} ${output} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Splits a version formed as "major.minor.patch" recorded in variable 'prefix'
|
||||
# and writes it into variables started with 'prefix' and ended with _MAJOR, _MINOR and _PATCH.
|
||||
MACRO(set_version_variables prefix value)
|
||||
string(REPLACE "." ";" VERSION_LIST ${value})
|
||||
list(GET VERSION_LIST 0 ${prefix}_MAJOR)
|
||||
list(GET VERSION_LIST 1 ${prefix}_MINOR)
|
||||
list(GET VERSION_LIST 2 ${prefix}_PATCH)
|
||||
set(${prefix}_DEFINESTR "")
|
||||
ENDMACRO(set_version_variables)
|
||||
|
||||
# Sets given variable to 1, if the condition that follows it is satisfied.
|
||||
# Otherwise set it to 0.
|
||||
MACRO(set_if varname)
|
||||
IF(${ARGN})
|
||||
SET(${varname} 1)
|
||||
ELSE(${ARGN})
|
||||
SET(${varname} 0)
|
||||
ENDIF(${ARGN})
|
||||
ENDMACRO(set_if)
|
||||
|
||||
FUNCTION(join_arguments outvar)
|
||||
set (output)
|
||||
|
||||
foreach (i ${ARGN})
|
||||
set(output "${output} ${i}")
|
||||
endforeach()
|
||||
|
||||
set (${outvar} ${output} PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
|
||||
# LEGACY. PLEASE DON'T USE ANYMORE.
|
||||
MACRO(MafRead maffile)
|
||||
message(WARNING "MafRead is deprecated. Please use MafReadDir instead")
|
||||
# ARGN contains the extra "section-variable" pairs
|
||||
# If empty, return nothing
|
||||
set (MAFREAD_TAGS
|
||||
SOURCES # source files
|
||||
PUBLIC_HEADERS # installable headers for include
|
||||
PROTECTED_HEADERS # installable headers used by other headers
|
||||
PRIVATE_HEADERS # non-installable headers
|
||||
)
|
||||
cmake_parse_arguments(MAFREAD_VAR "" "${MAFREAD_TAGS}" "" ${ARGN})
|
||||
# Arguments for these tags are variables to be filled
|
||||
# with the contents of particular section.
|
||||
# While reading the file, extract the section.
|
||||
# Section is recognized by either first uppercase character or space.
|
||||
|
||||
# @c http://cmake.org/pipermail/cmake/2007-May/014222.html
|
||||
FILE(READ ${maffile} MAFREAD_CONTENTS)
|
||||
STRING(REGEX REPLACE ";" "\\\\;" MAFREAD_CONTENTS "${MAFREAD_CONTENTS}")
|
||||
STRING(REGEX REPLACE "\n" ";" MAFREAD_CONTENTS "${MAFREAD_CONTENTS}")
|
||||
|
||||
#message("DEBUG: MAF FILE CONTENTS: ${MAFREAD_CONTENTS}")
|
||||
#message("DEBUG: PASSED VARIABLES:")
|
||||
#foreach(DEBUG_VAR ${MAFREAD_TAGS})
|
||||
# message("DEBUG: ${DEBUG_VAR}=${MAFREAD_VAR_${DEBUG_VAR}}")
|
||||
#endforeach()
|
||||
|
||||
# The unnamed section becomes SOURCES
|
||||
set (MAFREAD_VARIABLE ${MAFREAD_VAR_SOURCES})
|
||||
set (MAFREAD_UNASSIGNED "")
|
||||
|
||||
FOREACH(MAFREAD_LINE ${MAFREAD_CONTENTS})
|
||||
# Test what this line is
|
||||
string(STRIP ${MAFREAD_LINE} MAFREAD_OLINE)
|
||||
string(SUBSTRING ${MAFREAD_OLINE} 0 1 MAFREAD_FIRST)
|
||||
#message("DEBUG: LINE='${MAFREAD_LINE}' FIRST='${MAFREAD_FIRST}'")
|
||||
|
||||
# The 'continue' command is cmake 3.2 - very late discovery
|
||||
if (MAFREAD_FIRST STREQUAL "")
|
||||
#message("DEBUG: ... skipped: empty")
|
||||
elseif (MAFREAD_FIRST STREQUAL "#")
|
||||
#message("DEBUG: ... skipped: comment")
|
||||
else()
|
||||
# Will be skipped if the line was a comment/empty
|
||||
string(REGEX MATCH "[ A-Z]" MAFREAD_SECMARK ${MAFREAD_FIRST})
|
||||
if (MAFREAD_SECMARK STREQUAL "")
|
||||
# This isn't a section, it's a list element.
|
||||
#message("DEBUG: ITEM: ${MAFREAD_OLINE} --> ${MAFREAD_VARIABLE}")
|
||||
LIST(APPEND ${MAFREAD_VARIABLE} ${MAFREAD_OLINE})
|
||||
else()
|
||||
# It's a section - change the running variable
|
||||
# Make it section name
|
||||
STRING(REPLACE " " "_" MAFREAD_SECNAME ${MAFREAD_OLINE})
|
||||
set(MAFREAD_VARIABLE ${MAFREAD_VAR_${MAFREAD_SECNAME}})
|
||||
if (MAFREAD_VARIABLE STREQUAL "")
|
||||
set(MAFREAD_VARIABLE MAFREAD_UNASSIGNED)
|
||||
endif()
|
||||
#message("DEBUG: NEW SECTION: '${MAFREAD_SECNAME}' --> VARIABLE: '${MAFREAD_VARIABLE}'")
|
||||
endif()
|
||||
endif()
|
||||
ENDFOREACH()
|
||||
|
||||
# Final debug report
|
||||
#set (ALL_VARS "")
|
||||
#message("DEBUG: extracted variables:")
|
||||
#foreach(DEBUG_VAR ${MAFREAD_TAGS})
|
||||
# list(APPEND ALL_VARS ${MAFREAD_VAR_${DEBUG_VAR}})
|
||||
#endforeach()
|
||||
#list(REMOVE_DUPLICATES ALL_VARS)
|
||||
#foreach(DEBUG_VAR ${ALL_VARS})
|
||||
# message("DEBUG: --> ${DEBUG_VAR} = ${${DEBUG_VAR}}")
|
||||
#endforeach()
|
||||
ENDMACRO(MafRead)
|
||||
|
||||
# New version of MafRead macro, which automatically adds directory
|
||||
# prefix. This should also resolve each relative path.
|
||||
MACRO(MafReadDir directory maffile)
|
||||
# ARGN contains the extra "section-variable" pairs
|
||||
# If empty, return nothing
|
||||
set (MAFREAD_TAGS
|
||||
SOURCES # source files
|
||||
PUBLIC_HEADERS # installable headers for include
|
||||
PROTECTED_HEADERS # installable headers used by other headers
|
||||
PRIVATE_HEADERS # non-installable headers
|
||||
SOURCES_WIN32_SHARED # windows specific SOURCES
|
||||
PRIVATE_HEADERS_WIN32_SHARED # windows specific PRIVATE_HEADERS
|
||||
OPTIONS
|
||||
)
|
||||
cmake_parse_arguments(MAFREAD_VAR "" "${MAFREAD_TAGS}" "" ${ARGN})
|
||||
# Arguments for these tags are variables to be filled
|
||||
# with the contents of particular section.
|
||||
# While reading the file, extract the section.
|
||||
# Section is recognized by either first uppercase character or space.
|
||||
|
||||
# @c http://cmake.org/pipermail/cmake/2007-May/014222.html
|
||||
FILE(READ ${directory}/${maffile} MAFREAD_CONTENTS)
|
||||
STRING(REGEX REPLACE ";" "\\\\;" MAFREAD_CONTENTS "${MAFREAD_CONTENTS}")
|
||||
STRING(REGEX REPLACE "\n" ";" MAFREAD_CONTENTS "${MAFREAD_CONTENTS}")
|
||||
|
||||
# Once correctly read, declare this file as dependency of the build file.
|
||||
# Normally you should use cmake_configure_depends(), but this is
|
||||
# available only since 3.0 version.
|
||||
configure_file(${directory}/${maffile} dummy_${maffile}.cmake.out)
|
||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/dummy_${maffile}.cmake.out)
|
||||
|
||||
#message("DEBUG: MAF FILE CONTENTS: ${MAFREAD_CONTENTS}")
|
||||
#message("DEBUG: PASSED VARIABLES:")
|
||||
#foreach(DEBUG_VAR ${MAFREAD_TAGS})
|
||||
# message("DEBUG: ${DEBUG_VAR}=${MAFREAD_VAR_${DEBUG_VAR}}")
|
||||
#endforeach()
|
||||
|
||||
# The unnamed section becomes SOURCES
|
||||
set (MAFREAD_VARIABLE ${MAFREAD_VAR_SOURCES})
|
||||
set (MAFREAD_UNASSIGNED "")
|
||||
|
||||
# Default section type. Another is 'flags'.
|
||||
set (MAFREAD_SECTION_TYPE file)
|
||||
|
||||
FOREACH(MAFREAD_LINE ${MAFREAD_CONTENTS})
|
||||
# Test what this line is
|
||||
string(STRIP ${MAFREAD_LINE} MAFREAD_OLINE)
|
||||
string(SUBSTRING ${MAFREAD_OLINE} 0 1 MAFREAD_FIRST)
|
||||
#message("DEBUG: LINE='${MAFREAD_LINE}' FIRST='${MAFREAD_FIRST}'")
|
||||
|
||||
# The 'continue' command is cmake 3.2 - very late discovery
|
||||
if (MAFREAD_FIRST STREQUAL "")
|
||||
#message("DEBUG: ... skipped: empty")
|
||||
elseif (MAFREAD_FIRST STREQUAL "#")
|
||||
#message("DEBUG: ... skipped: comment")
|
||||
else()
|
||||
# Will be skipped if the line was a comment/empty
|
||||
string(REGEX MATCH "[ A-Z-]" MAFREAD_SECMARK ${MAFREAD_FIRST})
|
||||
if (MAFREAD_SECMARK STREQUAL "")
|
||||
# This isn't a section, it's a list element.
|
||||
#message("DEBUG: ITEM: ${MAFREAD_OLINE} --> ${MAFREAD_VARIABLE}")
|
||||
if (${MAFREAD_SECTION_TYPE} STREQUAL file)
|
||||
get_filename_component(MAFREAD_OLINE ${directory}/${MAFREAD_OLINE} ABSOLUTE)
|
||||
endif()
|
||||
LIST(APPEND ${MAFREAD_VARIABLE} ${MAFREAD_OLINE})
|
||||
else()
|
||||
# It's a section - change the running variable
|
||||
# Make it section name
|
||||
STRING(REPLACE " " "_" MAFREAD_SECNAME ${MAFREAD_OLINE})
|
||||
|
||||
# The cmake's version of 'if (MAFREAD_SECNAME[0] == '-')' - sigh...
|
||||
string(SUBSTRING ${MAFREAD_SECNAME} 0 1 MAFREAD_SECNAME0)
|
||||
if (${MAFREAD_SECNAME0} STREQUAL "-")
|
||||
set (MAFREAD_SECTION_TYPE option)
|
||||
string(SUBSTRING ${MAFREAD_SECNAME} 1 -1 MAFREAD_SECNAME)
|
||||
else()
|
||||
set (MAFREAD_SECTION_TYPE file)
|
||||
endif()
|
||||
set(MAFREAD_VARIABLE ${MAFREAD_VAR_${MAFREAD_SECNAME}})
|
||||
if (MAFREAD_VARIABLE STREQUAL "")
|
||||
set(MAFREAD_VARIABLE MAFREAD_UNASSIGNED)
|
||||
endif()
|
||||
#message("DEBUG: NEW SECTION: '${MAFREAD_SECNAME}' --> VARIABLE: '${MAFREAD_VARIABLE}'")
|
||||
endif()
|
||||
endif()
|
||||
ENDFOREACH()
|
||||
|
||||
# Final debug report
|
||||
#set (ALL_VARS "")
|
||||
#message("DEBUG: extracted variables:")
|
||||
#foreach(DEBUG_VAR ${MAFREAD_TAGS})
|
||||
# list(APPEND ALL_VARS ${MAFREAD_VAR_${DEBUG_VAR}})
|
||||
#endforeach()
|
||||
#list(REMOVE_DUPLICATES ALL_VARS)
|
||||
#foreach(DEBUG_VAR ${ALL_VARS})
|
||||
# message("DEBUG: --> ${DEBUG_VAR} = ${${DEBUG_VAR}}")
|
||||
#endforeach()
|
||||
ENDMACRO(MafReadDir)
|
||||
|
||||
# NOTE: This is historical only. Not in use.
|
||||
# It should be a similar interface to mafread.tcl like
|
||||
# the above MafRead macro.
|
||||
MACRO(GetMafHeaders directory outvar)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_MODULE_PATH}/mafread.tcl
|
||||
${CMAKE_SOURCE_DIR}/${directory}/HEADERS.maf
|
||||
"PUBLIC HEADERS"
|
||||
"PROTECTED HEADERS"
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE ${outvar}
|
||||
)
|
||||
SEPARATE_ARGUMENTS(${outvar})
|
||||
adddirname(${CMAKE_SOURCE_DIR}/${directory} "${${outvar}}" ${outvar})
|
||||
ENDMACRO(GetMafHeaders)
|
||||
|
||||
function (getVarsWith _prefix _varResult)
|
||||
get_cmake_property(_vars VARIABLES)
|
||||
string (REGEX MATCHALL "(^|;)${_prefix}[A-Za-z0-9_]*" _matchedVars "${_vars}")
|
||||
set (${_varResult} ${_matchedVars} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (check_testcode_compiles testcode libraries _successful)
|
||||
set (save_required_libraries ${CMAKE_REQUIRED_LIBRARIES})
|
||||
set (CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} ${libraries}")
|
||||
|
||||
check_cxx_source_compiles("${testcode}" ${_successful})
|
||||
set (${_successful} ${${_successful}} PARENT_SCOPE)
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${save_required_libraries})
|
||||
endfunction()
|
||||
|
||||
function (test_requires_clock_gettime _result)
|
||||
# This function tests if clock_gettime can be used
|
||||
# - at all
|
||||
# - with or without librt
|
||||
|
||||
# Result will be:
|
||||
# rt (if librt required)
|
||||
# "" (if no extra libraries required)
|
||||
# -- killed by FATAL_ERROR if clock_gettime is not available
|
||||
|
||||
set (code "
|
||||
#include <time.h>
|
||||
int main() {
|
||||
timespec res\;
|
||||
int result = clock_gettime(CLOCK_MONOTONIC, &res)\;
|
||||
return result == 0\;
|
||||
}
|
||||
")
|
||||
|
||||
check_testcode_compiles(${code} "" HAVE_CLOCK_GETTIME_IN)
|
||||
if (HAVE_CLOCK_GETTIME_IN)
|
||||
message(STATUS "Checked clock_gettime(): no extra libs needed")
|
||||
set (${_result} "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
check_testcode_compiles(${code} "rt" HAVE_CLOCK_GETTIME_LIBRT)
|
||||
if (HAVE_CLOCK_GETTIME_LIBRT)
|
||||
message(STATUS "Checked clock_gettime(): requires -lrt")
|
||||
set (${_result} "-lrt" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(FATAL_ERROR "clock_gettime() is not available on this system")
|
||||
endfunction()
|
173
trunk/3rdparty/srt-1-fit/scripts/iOS.cmake
vendored
Normal file
173
trunk/3rdparty/srt-1-fit/scripts/iOS.cmake
vendored
Normal file
|
@ -0,0 +1,173 @@
|
|||
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
|
||||
# files which are included with CMake 2.8.4
|
||||
# It has been altered for iOS development
|
||||
|
||||
# Options:
|
||||
#
|
||||
# IOS_PLATFORM = OS (default) or SIMULATOR or SIMULATOR64
|
||||
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||
#
|
||||
# IOS_ARCH = arm64 (default for OS), armv7, armv7s, i386 (default for SIMULATOR), x86_64 (default for SIMULATOR64)
|
||||
#
|
||||
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
|
||||
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
|
||||
# If set manually, it will override the default location and force the user of a particular Developer Platform
|
||||
#
|
||||
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
|
||||
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
|
||||
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
|
||||
# If set manually, this will force the use of a specific SDK version
|
||||
#
|
||||
# IOS_DISABLE_BITCODE - set to 1 if you want to disable bitcode generation
|
||||
|
||||
# Standard settings
|
||||
set (CMAKE_SYSTEM_NAME Darwin)
|
||||
set (CMAKE_SYSTEM_VERSION 1)
|
||||
set (UNIX True)
|
||||
set (APPLE True)
|
||||
set (IOS True)
|
||||
|
||||
# Required as of cmake 2.8.10
|
||||
set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
|
||||
|
||||
# Determine the cmake host system version so we know where to find the iOS SDKs
|
||||
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
|
||||
if (CMAKE_UNAME)
|
||||
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
|
||||
string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
|
||||
endif (CMAKE_UNAME)
|
||||
|
||||
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
|
||||
|
||||
set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
|
||||
set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
|
||||
set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
|
||||
set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
|
||||
|
||||
if (NOT DEFINED IOS_DISABLE_BITCODE)
|
||||
set (EMBED_OPTIONS "-fembed-bitcode")
|
||||
endif(NOT DEFINED IOS_DISABLE_BITCODE)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR ENABLE_DEBUG)
|
||||
set(IOS_DEBUG_OPTIONS "-glldb -gmodules")
|
||||
else()
|
||||
set(IOS_DEBUG_OPTIONS "-fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
endif()
|
||||
|
||||
set (CMAKE_C_FLAGS_INIT "${IOS_DEBUG_OPTIONS} ${EMBED_OPTIONS}")
|
||||
set (CMAKE_CXX_FLAGS_INIT "${IOS_DEBUG_OPTIONS} ${EMBED_OPTIONS}")
|
||||
|
||||
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${EMBED_OPTIONS} ${CMAKE_C_LINK_FLAGS}")
|
||||
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${EMBED_OPTIONS} ${CMAKE_CXX_LINK_FLAGS}")
|
||||
|
||||
|
||||
set (CMAKE_PLATFORM_HAS_INSTALLNAME 1)
|
||||
set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib")
|
||||
set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle")
|
||||
set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
|
||||
set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
|
||||
|
||||
# Specify install_name_tool and pkg-config since it outside of SDK path and therefore can't be found by CMake
|
||||
if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
||||
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
|
||||
endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
||||
|
||||
if (NOT DEFINED PKG_CONFIG_EXECUTABLE)
|
||||
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config)
|
||||
if (DEFINED PKG_CONFIG_EXECUTABLE)
|
||||
execute_process(COMMAND pkg-config --version OUTPUT_VARIABLE PKG_CONFIG_VERSION_STRING)
|
||||
endif(DEFINED PKG_CONFIG_EXECUTABLE)
|
||||
endif(NOT DEFINED PKG_CONFIG_EXECUTABLE)
|
||||
|
||||
|
||||
# fffio Specify path to install shared library on device
|
||||
set (CMAKE_INSTALL_NAME_DIR "@executable_path/Frameworks")
|
||||
set (CMAKE_BUILD_WITH_INSTALL_NAME_DIR TRUE)
|
||||
|
||||
# Setup iOS platform unless specified manually with IOS_PLATFORM
|
||||
if (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM "OS")
|
||||
endif (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
|
||||
# Check the platform selection and setup for developer root
|
||||
if (${IOS_PLATFORM} STREQUAL OS)
|
||||
set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||
elseif (${IOS_PLATFORM} STREQUAL SIMULATOR)
|
||||
set (SIMULATOR true)
|
||||
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||
elseif (${IOS_PLATFORM} STREQUAL SIMULATOR64)
|
||||
set (SIMULATOR true)
|
||||
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||
else (${IOS_PLATFORM} STREQUAL OS)
|
||||
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
|
||||
endif (${IOS_PLATFORM} STREQUAL OS)
|
||||
|
||||
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
|
||||
if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)
|
||||
set (CMAKE_IOS_DEVELOPER_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
|
||||
endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
|
||||
|
||||
# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT
|
||||
if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
|
||||
if (_CMAKE_IOS_SDKS)
|
||||
list (SORT _CMAKE_IOS_SDKS)
|
||||
list (REVERSE _CMAKE_IOS_SDKS)
|
||||
list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
|
||||
else (_CMAKE_IOS_SDKS)
|
||||
message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
|
||||
endif (_CMAKE_IOS_SDKS)
|
||||
message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
|
||||
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
|
||||
|
||||
# Set the sysroot default to the most recent SDK
|
||||
set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
|
||||
|
||||
# set the architecture for iOS
|
||||
if (NOT DEFINED IOS_ARCH)
|
||||
if (${IOS_PLATFORM} STREQUAL OS)
|
||||
set (IOS_ARCH arm64)
|
||||
elseif (${IOS_PLATFORM} STREQUAL SIMULATOR)
|
||||
set (IOS_ARCH i386)
|
||||
elseif (${IOS_PLATFORM} STREQUAL SIMULATOR64)
|
||||
set (IOS_ARCH x86_64)
|
||||
endif (${IOS_PLATFORM} STREQUAL OS)
|
||||
endif(NOT DEFINED IOS_ARCH)
|
||||
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS")
|
||||
|
||||
# Set the find root to the iOS developer roots and to user defined paths
|
||||
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root")
|
||||
|
||||
# default to searching for frameworks first
|
||||
set (CMAKE_FIND_FRAMEWORK FIRST)
|
||||
|
||||
# set up the default search directories for frameworks
|
||||
set (CMAKE_SYSTEM_FRAMEWORK_PATH
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
|
||||
)
|
||||
|
||||
# only search the iOS sdks, not the remainder of the host filesystem
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
58
trunk/3rdparty/srt-1-fit/scripts/mafread.tcl
vendored
Executable file
58
trunk/3rdparty/srt-1-fit/scripts/mafread.tcl
vendored
Executable file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
proc is-section line {
|
||||
return [regexp {^[A-Z ]+$} $line]
|
||||
}
|
||||
|
||||
# First argument is Manifest file, others are sections.
|
||||
set sections [lassign $argv maffile]
|
||||
|
||||
if { $sections == "" } {
|
||||
puts stderr "Usage: [file tail $argv0] <MAF file> <section name>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# NOTE: If the file doesn't exist, simply print nothing.
|
||||
# If there's no manifest file under this name, it means that
|
||||
# there are no files that satisfy given manifest and section.
|
||||
if { [catch {set fd [open $maffile r]}] } {
|
||||
exit
|
||||
}
|
||||
|
||||
set extracted ""
|
||||
set insection 0
|
||||
|
||||
while { [gets $fd line] >= 0 } {
|
||||
set oline [string trim $line]
|
||||
if { $oline == "" } {
|
||||
continue
|
||||
}
|
||||
|
||||
if { [string index $oline 0] == "#" } {
|
||||
continue
|
||||
}
|
||||
|
||||
if { !$insection } {
|
||||
# An opportunity to see if this is a section name
|
||||
if { ![is-section $line] } {
|
||||
continue
|
||||
}
|
||||
|
||||
# If it is, then check if this is OUR section
|
||||
if { $oline in $sections } {
|
||||
set insection 1
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
# We are inside the interesting section, so collect filenames
|
||||
# Check if this is a next section name - if it is, stop reading.
|
||||
if { [is-section $line] } {
|
||||
continue
|
||||
}
|
||||
|
||||
# Otherwise read the current filename
|
||||
lappend extracted $oline
|
||||
}
|
||||
}
|
||||
|
||||
puts $extracted
|
47
trunk/3rdparty/srt-1-fit/scripts/set-version-metadata.ps1
vendored
Normal file
47
trunk/3rdparty/srt-1-fit/scripts/set-version-metadata.ps1
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Script for reading generated version values and updating metadata properties
|
||||
|
||||
#read major / minor version values from version.h (generated by cmake via version.h.in)
|
||||
$majorVer=99
|
||||
$minorVer=99
|
||||
$patchVer=0
|
||||
$buildNum=0
|
||||
|
||||
#define regular expressions to be used when checking for #define statements
|
||||
$versionSniffingRegex = "(\s*#define\s+(\S+)\s+)(\d+)"
|
||||
|
||||
#read generated file, load values from this with regular expression
|
||||
Get-Content ".\version.h" | Where-Object { $_ -match $versionSniffingRegex } | ForEach-Object {
|
||||
switch ($Matches[2])
|
||||
{
|
||||
"SRT_VERSION_MAJOR" { $majorVer = $Matches[3] }
|
||||
"SRT_VERSION_MINOR" { $minorVer = $Matches[3] }
|
||||
"SRT_VERSION_PATCH" { $patchVer = $Matches[3] }
|
||||
"SRT_VERSION_BUILD" { $buildNum = $Matches[3] }
|
||||
}
|
||||
}
|
||||
|
||||
$FileDescriptionBranchCommitValue = "SRT Local Build"
|
||||
|
||||
if($Env:APPVEYOR){
|
||||
#make AppVeyor update with this new version number
|
||||
Update-AppveyorBuild -Version "$majorVer.$minorVer.$patchVer.$buildNum"
|
||||
$FileDescriptionBranchCommitValue = "$Env:APPVEYOR_REPO_NAME - $($Env:APPVEYOR_REPO_BRANCH) ($($Env:APPVEYOR_REPO_COMMIT.substring(0,8)))"
|
||||
}
|
||||
|
||||
#find C++ resource files and update file description with branch / commit details
|
||||
$FileDescriptionStringRegex = '(\bVALUE\s+\"FileDescription\"\s*\,\s*\")([^\"]*\\\")*[^\"]*(\")'
|
||||
|
||||
Get-ChildItem -Path "./srtcore/srt_shared.rc" | ForEach-Object {
|
||||
$fileName = $_
|
||||
Write-Host "Processing metadata changes for file: $fileName"
|
||||
|
||||
$FileLines = Get-Content -path $fileName
|
||||
|
||||
for($i=0;$i -lt $FileLines.Count;$i++)
|
||||
{
|
||||
$FileLines[$i] = $FileLines[$i] -Replace $FileDescriptionStringRegex, "`${1}$FileDescriptionBranchCommitValue`${3}"
|
||||
}
|
||||
|
||||
[System.IO.File]::WriteAllLines($fileName.FullName, $FileLines)
|
||||
}
|
||||
|
31
trunk/3rdparty/srt-1-fit/scripts/srt-ffplay
vendored
Executable file
31
trunk/3rdparty/srt-1-fit/scripts/srt-ffplay
vendored
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# SRT - Secure, Reliable, Transport
|
||||
# Copyright (c) 2018 Haivision Systems Inc.
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
FFPLAY=`type -p ffplay || echo none`
|
||||
if [[ $FFPLAY == "none" ]]; then
|
||||
echo >&2 "ERROR: ffplay not available to call. Please install ffplay first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIRNAME=`dirname $0`
|
||||
if [[ ! -x $DIRNAME/srt-live-transmit ]]; then
|
||||
echo >&2 "ERROR: you need 'srt-live-transmit' tool from SRT package in the same directory as this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRCLOC=$1
|
||||
if [[ -z $SRCLOC ]]; then
|
||||
echo >&2 "Usage: `basename $0` <source URL>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DIRNAME/srt-live-transmit "$1" file://con/ | ffplay -
|
||||
|
12
trunk/3rdparty/srt-1-fit/scripts/srt.pc.in
vendored
Normal file
12
trunk/3rdparty/srt-1-fit/scripts/srt.pc.in
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
prefix=@INSTALLDIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: srt
|
||||
Description: SRT library set
|
||||
Version: @SRT_VERSION@
|
||||
Libs: -L${libdir} -l@TARGET_srt@ @IFNEEDED_LINK_HAICRYPT@ @IFNEEDED_SRTBASE@ @IFNEEDED_SRT_LDFLAGS@
|
||||
Libs.private: @SRT_LIBS_PRIVATE@
|
||||
Cflags: -I${includedir} -I${includedir}/srt
|
||||
Requires.private: @SSL_REQUIRED_MODULES@
|
110
trunk/3rdparty/srt-1-fit/scripts/tcp-echo-client.tcl
vendored
Normal file
110
trunk/3rdparty/srt-1-fit/scripts/tcp-echo-client.tcl
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
set read_running 0
|
||||
set write_running 0
|
||||
set read_eof 0
|
||||
set theend 0
|
||||
|
||||
set nread 0
|
||||
set nwritten 0
|
||||
|
||||
proc ReadBack {fd} {
|
||||
|
||||
if { !$::write_running } {
|
||||
puts stderr "ERROR: connection closed unexpectedly!"
|
||||
set ::theend 1
|
||||
return
|
||||
}
|
||||
|
||||
set r [read $fd 4096]
|
||||
if {$r == ""} {
|
||||
|
||||
if {[eof $fd]} {
|
||||
puts stderr "EOF on socket"
|
||||
set ::read_running 0
|
||||
return
|
||||
}
|
||||
|
||||
# --- puts stderr "SPURIOUS, not reading"
|
||||
return
|
||||
}
|
||||
|
||||
# --- puts stderr "REPRINTING [string bytelength $r] bytes"
|
||||
puts -nonewline stdout $r
|
||||
incr ::nwritten [string bytelength $r]
|
||||
# --- puts stderr "DONE"
|
||||
|
||||
set remain [expr {$::nread - $::nwritten}]
|
||||
if { $::read_eof } {
|
||||
puts stderr "Finishing... read=$::nread written=$::nwritten diff=[expr {$::nwritten - $::nread}] - [expr {100.0*$remain/$::nread}]%"
|
||||
}
|
||||
|
||||
# Nothing more to read
|
||||
if {$remain == 0} {
|
||||
puts stderr "NOTHING MORE TO BE WRITTEN - exitting"
|
||||
set ::theend 1
|
||||
return
|
||||
}
|
||||
|
||||
after idle "ReadBack $fd"
|
||||
}
|
||||
|
||||
proc SendToSocket {fd} {
|
||||
global theend
|
||||
|
||||
if { !$::write_running } {
|
||||
# --- puts stderr "SERVER DOWN, not reading"
|
||||
fileevent stdin readable {}
|
||||
return
|
||||
}
|
||||
|
||||
if { $::read_eof } {
|
||||
# Don't read, already EOF.
|
||||
|
||||
}
|
||||
# --- puts stderr "READING cin"
|
||||
set r [read stdin 4096]
|
||||
if {$r == ""} {
|
||||
if {[eof stdin]} {
|
||||
if {!$::read_eof} {
|
||||
puts stderr "EOF, setting server off"
|
||||
set ::read_eof 1
|
||||
}
|
||||
# Just enough when the next SendToSocket will
|
||||
# not be scheduled.
|
||||
return
|
||||
}
|
||||
# --- puts stderr "SPURIOUS, not reading"
|
||||
return
|
||||
}
|
||||
|
||||
# --- puts stderr "SENDING [string bytelength $r] bytes"
|
||||
# Set blocking for a short moment of sending
|
||||
# in order to prevent losing data that must wait
|
||||
fconfigure $fd -blocking yes
|
||||
puts -nonewline $fd $r
|
||||
incr ::nread [string bytelength $r]
|
||||
fconfigure $fd -blocking no
|
||||
|
||||
# --- if {[fblocked stdin]} {
|
||||
# --- # Nothing more to read
|
||||
# --- return
|
||||
# --- }
|
||||
after idle "SendToSocket $fd"
|
||||
}
|
||||
|
||||
set fd [socket {*}$argv]
|
||||
fconfigure $fd -encoding binary -translation binary -blocking no -buffering none
|
||||
fileevent $fd readable "ReadBack $fd"
|
||||
|
||||
fconfigure stdin -encoding binary -translation binary -blocking no
|
||||
fconfigure stdout -encoding binary -translation binary
|
||||
fileevent stdin readable "SendToSocket $fd"
|
||||
|
||||
# --- puts stderr "READY, sending"
|
||||
set read_running 1
|
||||
set write_running 1
|
||||
|
||||
vwait theend
|
||||
|
||||
close $fd
|
51
trunk/3rdparty/srt-1-fit/scripts/tcp-echo-server.tcl
vendored
Normal file
51
trunk/3rdparty/srt-1-fit/scripts/tcp-echo-server.tcl
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
proc SpawnEchoServer {fd host port} {
|
||||
fconfigure $fd -encoding binary -translation binary -blocking no -buffering none
|
||||
fileevent $fd readable "EchoBack $fd"
|
||||
# --- puts stderr "Connected: [fconfigure $fd -peername]"
|
||||
}
|
||||
|
||||
proc EchoBack {fd} {
|
||||
|
||||
# --- puts stderr "READ-READY"
|
||||
|
||||
while 1 {
|
||||
|
||||
# --- puts stderr "READING 4096"
|
||||
set r [read $fd 4096]
|
||||
if {$r == ""} {
|
||||
if {[eof $fd]} {
|
||||
# --- puts stderr "EOF. Closing"
|
||||
close $fd
|
||||
return
|
||||
}
|
||||
|
||||
# --- puts stderr "SPURIOUS, giving up read"
|
||||
return
|
||||
}
|
||||
|
||||
# Set blocking for a short moment of sending
|
||||
# in order to prevent losing data that must wait
|
||||
|
||||
# --- puts stderr "SENDING [string bytelength $r] bytes"
|
||||
fconfigure $fd -blocking yes
|
||||
puts -nonewline $fd $r
|
||||
fconfigure $fd -blocking no
|
||||
|
||||
if {[fblocked $fd]} {
|
||||
# --- puts stderr "NO MORE DATA"
|
||||
# Nothing more to read
|
||||
return
|
||||
}
|
||||
|
||||
# --- puts stderr "AGAIN"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
socket -server SpawnEchoServer $argv
|
||||
puts stderr "SERVER READY"
|
||||
|
||||
vwait tk
|
Loading…
Add table
Add a link
Reference in a new issue