赞
踩
在前面几篇文章中我们已经进行了依赖库的编译,因此,现在需要最终我们需要使用的库libkvsWebrtcClient.a 或者libkvsWebrtcClient.so
如下操作是编译君正(T31X)平台的libkvsWebrtcClient.a 或者libkvsWebrtcClient.so
1、下载源码(amazon-kinesis-video-streams-webrtc-sdk-c)
我们新建几个目录:
Library/T31X 用于存放依赖的库和头文件;
Build/T31X 用于存放编译脚本;
Bin/T31X 用于存放生成的目标文件;
2、编译脚本
- #***************************This is Project Info****************************
- PROJECT(kvsWebrtcClient)
- CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
- #****************************This is Compile Flag****************************
-
-
- ADD_DEFINITIONS("-Wall")
- ADD_DEFINITIONS("-Wl,-Bsymbolic -lm")
- ADD_DEFINITIONS("-std=c++11")
- ADD_DEFINITIONS("-DLIBSKYAPI_EXPORTS")
- ADD_DEFINITIONS("-DLIBAVXLOG_HAVE_AVXLOG=0")
- ADD_DEFINITIONS("-DKVS_USE_OPENSSL=1")
- ADD_DEFINITIONS("-DKVS_BUILD_WITH_LWS=1")
-
- 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")
-
- #****************************This is Compiling environment Flag****************************
- SET(CMAKE_SYSTEM_NAME linux)
- SET(TOOLCHAIN_DIR "/opt/mips-gcc472-glibc216-64bit")
- SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_DIR})
- SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
- SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
- SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
- SET(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/mips-linux-uclibc-gnu-gcc)
- SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/mips-linux-uclibc-gnu-g++)
-
- #****************************This is Include File/Directories****************************
- #INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/)
- INCLUDE_DIRECTORIES(../../)
- INCLUDE_DIRECTORIES(../../Library/T31X/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/client/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/utils/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/mkvgen/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/view/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/heap/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/state/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/common/include)
-
-
- INCLUDE_DIRECTORIES(../../src)
- INCLUDE_DIRECTORIES(../../src/include)
- INCLUDE_DIRECTORIES(../../src/source/)
-
- INCLUDE_DIRECTORIES(../../Library/T31X/include)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/common)
- INCLUDE_DIRECTORIES(../../Library/T31X/include/common/include)
-
-
- #****************************This is Source File/Directories****************************
-
- #AUX_SOURCE_DIRECTORY(../../src/source/Crypto Crypto_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Ice Ice_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/PeerConnection PeerConnection_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Rtcp Rtcp_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Rtp Rtp_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Sdp Sdp_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Srtp Srtp_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Stun Stun_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Sctp Sctp_SRCS)
- #AUX_SOURCE_DIRECTORY(../../src/source/Metrics Metrics_SRCS)
-
- #SET(DIR_SRCS ${Crypto_SRCS} ${Ice_SRCS} ${PeerConnection_SRCS} ${Rtcp_SRCS} ${Rtp_SRCS} ${Sdp_SRCS} ${Srtp_SRCS} ${Stun_SRCS} ${Sctp_SRCS} ${Metrics_SRCS})
-
- SET(LIBSDK_DIRS ../../src/source)
- SET(LIBCrypto_SRCS ${LIBSDK_DIRS}/Crypto/Dtls.c
- ${LIBSDK_DIRS}/Crypto/Dtls_openssl.c
- ${LIBSDK_DIRS}/Crypto/IOBuffer.c
- ${LIBSDK_DIRS}/Crypto/Tls.c
- ${LIBSDK_DIRS}/Crypto/Tls_openssl.c
- )
-
- SET(LIBIce_SRCS ${LIBSDK_DIRS}/Ice/ConnectionListener.c
- ${LIBSDK_DIRS}/Ice/IceAgent.c
- ${LIBSDK_DIRS}/Ice/IceAgentStateMachine.c
- ${LIBSDK_DIRS}/Ice/IceUtils.c
- ${LIBSDK_DIRS}/Ice/NatBehaviorDiscovery.c
- ${LIBSDK_DIRS}/Ice/Network.c
- ${LIBSDK_DIRS}/Ice/SocketConnection.c
- ${LIBSDK_DIRS}/Ice/TurnConnection.c
- )
-
- SET(LIBPeerConnection_SRCS ${LIBSDK_DIRS}/PeerConnection/DataChannel.c
- ${LIBSDK_DIRS}/PeerConnection/JitterBuffer.c
- ${LIBSDK_DIRS}/PeerConnection/PeerConnection.c
- ${LIBSDK_DIRS}/PeerConnection/Retransimitter.c
- ${LIBSDK_DIRS}/PeerConnection/Rtcp.c
- ${LIBSDK_DIRS}/PeerConnection/Rtp.c
- ${LIBSDK_DIRS}/PeerConnection/SessionDescription.c
- ${LIBSDK_DIRS}/PeerConnection/jsmn.c
- )
-
- SET(LIBRtcp_SRCS ${LIBSDK_DIRS}/Rtcp/RollingBuffer.c
- ${LIBSDK_DIRS}/Rtcp/RtcpPacket.c
- ${LIBSDK_DIRS}/Rtcp/RtpRollingBuffer.c
- )
- SET(LIBRtp_SRCS ${LIBSDK_DIRS}/Rtp/RtpPacket.c
- ${LIBSDK_DIRS}/Rtp/Codecs/RtpG711Payloader.c
- ${LIBSDK_DIRS}/Rtp/Codecs/RtpH264Payloader.c
- ${LIBSDK_DIRS}/Rtp/Codecs/RtpOpusPayloader.c
- ${LIBSDK_DIRS}/Rtp/Codecs/RtpVP8Payloader.c
- )
- SET(LIBSdp_SRCS ${LIBSDK_DIRS}/Sdp/Deserialize.c
- ${LIBSDK_DIRS}/Sdp/Serialize.c
- )
- SET(LIBSrtp_SRCS ${LIBSDK_DIRS}/Srtp/SrtpSession.c
- )
- SET(LIBStun_SRCS ${LIBSDK_DIRS}/Stun/Stun.c
- )
- SET(LIBSctp_SRCS ${LIBSDK_DIRS}/Sctp/Sctp.c
- )
- SET(LIBMetrics_SRCS ${LIBSDK_DIRS}/Metrics/Metrics.c
- )
-
-
- SET(DIR_SRCS ${LIBCrypto_SRCS} ${LIBIce_SRCS} ${LIBPeerConnection_SRCS} ${LIBRtcp_SRCS} ${LIBRtp_SRCS} ${LIBSdp_SRCS} ${LIBSrtp_SRCS} ${LIBStun_SRCS} ${LIBSctp_SRCS} ${LIBMetrics_SRCS})
-
-
- #****************************This is Library Directories****************************
-
- LINK_DIRECTORIES(../../Library/T31X/lib)
-
-
- #****************************This is 3Party Library****************************
- LINK_LIBRARIES(pthread kvspicState kvspicUtils libssl.a libcrypto.a libsrtp2.a libusrsctp.a )
-
- #****************************This is Output Directory****************************
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../../Bin/T31X)
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../../Bin/T31X)
- set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../../Bin/T31X)
-
- #****************************This is Output Library****************************
- ADD_LIBRARY(${PROJECT_NAME} SHARED ${DIR_SRCS} )
- TARGET_LINK_LIBRARIES(${PROJECT_NAME} pthread kvspicState kvspicUtils libssl.a libcrypto.a libsrtp2.a libusrsctp.a )
3、生成结果
这个时候我们只差最后一步了,编译两个最关键的库,详见下一页(点击)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。