[Feature][完成编译x86_64的x264库]

This commit is contained in:
like 2025-04-28 10:46:51 +08:00
parent 346ca4802d
commit 70d2efded4
12 changed files with 1174 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# 项目编译输出文件夹
out/
# 第三方库编译输出文件夹
thirdparty/x264_build/x86_64/*
thirdparty/x264_build/arm/*
thirdparty/x264_build/aarch64/*
!thirdparty/x264_build/x86_64/install/
!thirdparty/x264_build/arm/install/
!thirdparty/x264_build/aarch64/install/

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# Universal Camera SDK

View File

@ -0,0 +1,37 @@
# Universal Camera SDK 开发笔记
## 编译器
由于本项目计划在不同平台上均可使用,因此需要对常见的平台的编译器进行配置。
### aarch64-none-linux-gnu
```bash
wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz
```
## 第三方库编译
本项目涉及第三方库主要是opencv、ffmpeg、x264.
### 编译环境:
#### x86_64 平台编译环境
- 操作系统: Debian12(Linux 5.15)
- GCC/G++ version : 12.2.0
- cmake version : 3.25.1
- make version : 4.3
#### arm64平台交叉编译环境
- Host 平台: x86_64
- Target 平台: aarch64
- 交叉编译器: arm官方aarch64-none-linux-gnu
- GCC/G++ version : 12.2.1
### x264 编译
源码下载:
```bash
wget https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.bz2
```
#### arm64平台交叉编译

7
env_init.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# 交叉编译工具链配置
mkdir -p /opt/universal_camera_sdk
cp -a thirdparty/toolchain /opt/universal_camera_sdk/toolchain

Binary file not shown.

73
thirdparty/x264_build/build.sh vendored Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No command line parameters are provided. Please enter '$0 -h' to view usage instructions."
exit 1
fi
if test x"$1" = x"-h" -o x"$1" = x"--help"; then
cat <<EOF
Usage: ./configure [options]
Help:
-h, --help print this message
Standard options:
-x86_64 编译x86_64平台的库文件
-arm 编译arm32平台的库文件
-aarch64 编译aarch64平台的库文件
EOF
exit 1
fi
X264_BUILD_DIR=$(pwd)
# configure
if [[ x"$1" = x"-x86_64" ]];then
if [ -d x86_64 ]; then
rm -rf x86_64
fi
mkdir -p x86_64/install
cd x86_64
./../x264/configure \
--prefix="${X264_BUILD_DIR}/x86_64/install" \
--enable-shared \
--enable-static \
--enable-pic \
--disable-cli \
--disable-asm
if [ $? -ne 0 ]; then
echo "x264 configure failed!"
exit 1
fi
make -j8
if [ $? -ne 0 ]; then
echo "x264 make failed!"
exit 1
fi
make install
if [ $? -ne 0 ]; then
echo "x264 make install failed!"
exit 1
fi
elif [[ x"$1" = x"-arm" ]];then
echo "compile arm32"
elif [[ x"$1" = x"-aarch64" ]];then
echo "compile arm64"
else
echo "parameters error"
fi
# 检查 ./x264/configure 脚本的返回状态
if [ $? -ne 0 ];then
echo "Exec configure failed!"
exit 1
fi

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
#define X264_GPL 1
#define X264_INTERLACED 1
#define X264_BIT_DEPTH 0
#define X264_CHROMA_FORMAT 0
#define X264_VERSION ""
#define X264_POINTVER "0.165.x"

Binary file not shown.

View File

@ -0,0 +1 @@
libx264.so.165

Binary file not shown.

View File

@ -0,0 +1,11 @@
prefix=/home/like/code/universal_camera_sdk/thirdparty/x264_build/x86_64/install
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: x264
Description: H.264 (MPEG4 AVC) encoder library
Version: 0.165.x
Libs: -L${exec_prefix}/lib -lx264
Libs.private: -lpthread -lm -ldl
Cflags: -I${prefix}/include -DX264_API_IMPORTS