当前位置:   article > 正文

AWS KVS(Kinesis Video Streams)之WebRTC移植编译(四)_kvs wertc和libjingle

kvs wertc和libjingle

在前面几篇文章中我们已经进行了依赖库的编译,因此,现在需要最终我们需要使用的库libkvsWebrtcClient.a 或者libkvsWebrtcClient.so

如下操作是编译君正(T31X)平台的libkvsWebrtcClient.a 或者libkvsWebrtcClient.so

1、下载源码(amazon-kinesis-video-streams-webrtc-sdk-c)

我们新建几个目录:

Library/T31X 用于存放依赖的库和头文件;

Build/T31X 用于存放编译脚本;

Bin/T31X 用于存放生成的目标文件;

2、编译脚本

  1. #***************************This is Project Info****************************
  2. PROJECT(kvsWebrtcClient)
  3. CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
  4. #****************************This is Compile Flag****************************
  5. ADD_DEFINITIONS("-Wall")
  6. ADD_DEFINITIONS("-Wl,-Bsymbolic -lm")
  7. ADD_DEFINITIONS("-std=c++11")
  8. ADD_DEFINITIONS("-DLIBSKYAPI_EXPORTS")
  9. ADD_DEFINITIONS("-DLIBAVXLOG_HAVE_AVXLOG=0")
  10. ADD_DEFINITIONS("-DKVS_USE_OPENSSL=1")
  11. ADD_DEFINITIONS("-DKVS_BUILD_WITH_LWS=1")
  12. SET(CMAKE_CXX_FLAGS "-Wall -s -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fomit-frame-pointer -fvisibility=hidden -ffunction-sections -fdata-sections -Wl,-Bsymbolic -lm -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS")
  13. #****************************This is Compiling environment Flag****************************
  14. SET(CMAKE_SYSTEM_NAME linux)
  15. SET(TOOLCHAIN_DIR "/opt/mips-gcc472-glibc216-64bit")
  16. SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR})
  17. SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  18. SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  19. SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  20. SET(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/mips-linux-uclibc-gnu-gcc)
  21. SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/mips-linux-uclibc-gnu-g++)
  22. #****************************This is Include File/Directories****************************
  23. #INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/)
  24. INCLUDE_DIRECTORIES(../../)
  25. INCLUDE_DIRECTORIES(../../Library/T31X/include)
  26. INCLUDE_DIRECTORIES(../../Library/T31X/include/client/include)
  27. INCLUDE_DIRECTORIES(../../Library/T31X/include/utils/include)
  28. INCLUDE_DIRECTORIES(../../Library/T31X/include/mkvgen/include)
  29. INCLUDE_DIRECTORIES(../../Library/T31X/include/view/include)
  30. INCLUDE_DIRECTORIES(../../Library/T31X/include/heap/include)
  31. INCLUDE_DIRECTORIES(../../Library/T31X/include/state/include)
  32. INCLUDE_DIRECTORIES(../../Library/T31X/include/common/include)
  33. INCLUDE_DIRECTORIES(../../src)
  34. INCLUDE_DIRECTORIES(../../src/include)
  35. INCLUDE_DIRECTORIES(../../src/source/)
  36. INCLUDE_DIRECTORIES(../../Library/T31X/include)
  37. INCLUDE_DIRECTORIES(../../Library/T31X/include/common)
  38. INCLUDE_DIRECTORIES(../../Library/T31X/include/common/include)
  39. #****************************This is Source File/Directories****************************
  40. #AUX_SOURCE_DIRECTORY(../../src/source/Crypto Crypto_SRCS)
  41. #AUX_SOURCE_DIRECTORY(../../src/source/Ice Ice_SRCS)
  42. #AUX_SOURCE_DIRECTORY(../../src/source/PeerConnection PeerConnection_SRCS)
  43. #AUX_SOURCE_DIRECTORY(../../src/source/Rtcp Rtcp_SRCS)
  44. #AUX_SOURCE_DIRECTORY(../../src/source/Rtp Rtp_SRCS)
  45. #AUX_SOURCE_DIRECTORY(../../src/source/Sdp Sdp_SRCS)
  46. #AUX_SOURCE_DIRECTORY(../../src/source/Srtp Srtp_SRCS)
  47. #AUX_SOURCE_DIRECTORY(../../src/source/Stun Stun_SRCS)
  48. #AUX_SOURCE_DIRECTORY(../../src/source/Sctp Sctp_SRCS)
  49. #AUX_SOURCE_DIRECTORY(../../src/source/Metrics Metrics_SRCS)
  50. #SET(DIR_SRCS ${Crypto_SRCS} ${Ice_SRCS} ${PeerConnection_SRCS} ${Rtcp_SRCS} ${Rtp_SRCS} ${Sdp_SRCS} ${Srtp_SRCS} ${Stun_SRCS} ${Sctp_SRCS} ${Metrics_SRCS})
  51. SET(LIBSDK_DIRS ../../src/source)
  52. SET(LIBCrypto_SRCS ${LIBSDK_DIRS}/Crypto/Dtls.c
  53. ${LIBSDK_DIRS}/Crypto/Dtls_openssl.c
  54. ${LIBSDK_DIRS}/Crypto/IOBuffer.c
  55. ${LIBSDK_DIRS}/Crypto/Tls.c
  56. ${LIBSDK_DIRS}/Crypto/Tls_openssl.c
  57. )
  58. SET(LIBIce_SRCS ${LIBSDK_DIRS}/Ice/ConnectionListener.c
  59. ${LIBSDK_DIRS}/Ice/IceAgent.c
  60. ${LIBSDK_DIRS}/Ice/IceAgentStateMachine.c
  61. ${LIBSDK_DIRS}/Ice/IceUtils.c
  62. ${LIBSDK_DIRS}/Ice/NatBehaviorDiscovery.c
  63. ${LIBSDK_DIRS}/Ice/Network.c
  64. ${LIBSDK_DIRS}/Ice/SocketConnection.c
  65. ${LIBSDK_DIRS}/Ice/TurnConnection.c
  66. )
  67. SET(LIBPeerConnection_SRCS ${LIBSDK_DIRS}/PeerConnection/DataChannel.c
  68. ${LIBSDK_DIRS}/PeerConnection/JitterBuffer.c
  69. ${LIBSDK_DIRS}/PeerConnection/PeerConnection.c
  70. ${LIBSDK_DIRS}/PeerConnection/Retransimitter.c
  71. ${LIBSDK_DIRS}/PeerConnection/Rtcp.c
  72. ${LIBSDK_DIRS}/PeerConnection/Rtp.c
  73. ${LIBSDK_DIRS}/PeerConnection/SessionDescription.c
  74. ${LIBSDK_DIRS}/PeerConnection/jsmn.c
  75. )
  76. SET(LIBRtcp_SRCS ${LIBSDK_DIRS}/Rtcp/RollingBuffer.c
  77. ${LIBSDK_DIRS}/Rtcp/RtcpPacket.c
  78. ${LIBSDK_DIRS}/Rtcp/RtpRollingBuffer.c
  79. )
  80. SET(LIBRtp_SRCS ${LIBSDK_DIRS}/Rtp/RtpPacket.c
  81. ${LIBSDK_DIRS}/Rtp/Codecs/RtpG711Payloader.c
  82. ${LIBSDK_DIRS}/Rtp/Codecs/RtpH264Payloader.c
  83. ${LIBSDK_DIRS}/Rtp/Codecs/RtpOpusPayloader.c
  84. ${LIBSDK_DIRS}/Rtp/Codecs/RtpVP8Payloader.c
  85. )
  86. SET(LIBSdp_SRCS ${LIBSDK_DIRS}/Sdp/Deserialize.c
  87. ${LIBSDK_DIRS}/Sdp/Serialize.c
  88. )
  89. SET(LIBSrtp_SRCS ${LIBSDK_DIRS}/Srtp/SrtpSession.c
  90. )
  91. SET(LIBStun_SRCS ${LIBSDK_DIRS}/Stun/Stun.c
  92. )
  93. SET(LIBSctp_SRCS ${LIBSDK_DIRS}/Sctp/Sctp.c
  94. )
  95. SET(LIBMetrics_SRCS ${LIBSDK_DIRS}/Metrics/Metrics.c
  96. )
  97. SET(DIR_SRCS ${LIBCrypto_SRCS} ${LIBIce_SRCS} ${LIBPeerConnection_SRCS} ${LIBRtcp_SRCS} ${LIBRtp_SRCS} ${LIBSdp_SRCS} ${LIBSrtp_SRCS} ${LIBStun_SRCS} ${LIBSctp_SRCS} ${LIBMetrics_SRCS})
  98. #****************************This is Library Directories****************************
  99. LINK_DIRECTORIES(../../Library/T31X/lib)
  100. #****************************This is 3Party Library****************************
  101. LINK_LIBRARIES(pthread kvspicState kvspicUtils libssl.a libcrypto.a libsrtp2.a libusrsctp.a )
  102. #****************************This is Output Directory****************************
  103. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../../Bin/T31X)
  104. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../../Bin/T31X)
  105. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../../Bin/T31X)
  106. #****************************This is Output Library****************************
  107. ADD_LIBRARY(${PROJECT_NAME} SHARED ${DIR_SRCS} )
  108. TARGET_LINK_LIBRARIES(${PROJECT_NAME} pthread kvspicState kvspicUtils libssl.a libcrypto.a libsrtp2.a libusrsctp.a )

3、生成结果

这个时候我们只差最后一步了,编译两个最关键的库,详见下一页(点击)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/612926
推荐阅读
相关标签
  

闽ICP备14008679号