Integrating SDK
Prepare Environment
Before starting to integrate ZEGO Express SDK, please ensure that the development environment meets the following requirements:
- Any Linux distribution system with GLIBC 2.16 or higher version, supporting x86_64, aarch64, armhf, armel architectures.
- libasound (ALSA).
- libv4l2 (v4l utils).
- CMake 3.7 or higher version.
- SDK depends on libasound (ALSA) and libv4l2 (v4l utils).
- CentOS (RHEL/Fedora) can be installed by executing
yum install alsa-lib-devel libv4lcommand. - Ubuntu (Debian/Deepin) can be installed by executing
apt install libasound2-dev libv4l-devcommand. - For other platforms and systems, please install by yourself.
- If cross-compilation is needed, please refer to How to cross-compile Linux alsa-lib dependency library? and How to cross-compile Linux v4l-utils dependency library? documents. At the same time, the target machine needs to have libasound and libv4l2 dependency libraries installed.
When integrating SDK using Qt + qmake, please download any version of Qt between 5.9 and 5.15. For detailed information, please refer to Getting Started with Qt.
Integrating SDK
-
Please download the latest version of SDK through the Download documentation.
It is recommended to refer to the project in Running Example Source Code to integrate SDK.
-
Decompress the SDK, and copy all contents under the "release/Library" directory to your project.
-
When integrating SDK using CMake, please import SDK according to the following process
Introduce SDK in the "CMakeLists.txt" file of your project.
cmake_minimum_required(VERSION 3.7) project(MyAwesomeProject) # Add header search path include_directories("./libs/zego/include") # Add lib search path link_directories("./libs/zego") # Link SDK link_libraries(ZegoExpressEngine rt) add_compile_options( -std=c++11 ) aux_source_directory(./src SRC_LIST) add_executable(MyAwesomeProject ${SRC_LIST}) -
When integrating SDK using Qt + qmake, please import SDK according to the following process
Add the following configuration in the
<project_name>.profile of your project to import SDK library and header files.unix { contains(QT_ARCH, arm64) { INCLUDEPATH += $$PWD/../libs/ZegoExpress/linux/aarch64/include DEPENDPATH += $$PWD/../libs/ZegoExpress/linux/aarch64/include LIBS += -L$$PWD/../libs/ZegoExpress/linux/aarch64 -lZegoExpressEngine } else:contains(QT_ARCH, arm) { INCLUDEPATH += $$PWD/../libs/ZegoExpress/linux/armhf/include DEPENDPATH += $$PWD/../libs/ZegoExpress/linux/armhf/include LIBS += -L$$PWD/../libs/ZegoExpress/linux/armhf -lZegoExpressEngine } else { # Assume other archs are x86_64 INCLUDEPATH += $$PWD/../libs/ZegoExpress/linux/x86_64/include DEPENDPATH += $$PWD/../libs/ZegoExpress/linux/x86_64/include LIBS += -L$$PWD/../libs/ZegoExpress/linux/x86_64 -lZegoExpressEngine } }
-
-
(Optional) The Linux SDK does not block the SIGPIPE signal. Developers need to choose whether to block the SIGPIPE signal according to the actual situation during actual development.
In most cases, you need to block this signal, otherwise the client process will exit by default after receiving this signal. You can also directly ignore this signal: signal(SIGPIPE,SIG_IGN);.
static void ExceptionSigHandler(int signum)
{
char exitSignalStr[1024] = {0};
sprintf(exitSignalStr,"exception signal : %d",signum);
log("------------------------------");
log(exitSignalStr);
log("------------------------------");
}
int main(int argc, const char * argv[]) {
signal(SIGPIPE, ExceptionSigHandler);
// your code
return 0;
}