FreeRDP / FreeRDP

FreeRDP is a free remote desktop protocol library and clients

Home Page:http://www.freerdp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A clean way to success build iOS project.(成功编译iOS工程的记录)

zeku2022 opened this issue · comments

commented

iOS RDP编译记录

git clone [git@github.com](mailto:git@github.com):FreeRDP/FreeRDP.git

安装openssl 路径选这个

./scripts/OpenSSL-DownloadAndBuild.command  /tmp/

需要指定OpenSSL路径

# 设置 OpenSSL 的路径
set(OPENSSL_ROOT_DIR "/tmp/openssl")

# 指定 OpenSSL 的头文件路径和库路径
set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/include")
set(OPENSSL_LIB_DIR "${OPENSSL_ROOT_DIR}/lib")
set(OPENSSL_CRYPTO_LIBRARY "${OPENSSL_ROOT_DIR}/lib/libcrypto_arm64.a")

后面加这个参数 -DPLATFORM=OS64

cmake -DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake -GXcode  -DPLATFORM=OS64

报错 Could NOT find FFmpeg (missing: AVUTIL_FOUND AVCODEC_FOUND
AVRESAMPLE_FOUND)

修改CMakeFiles.txt

set(FFmpeg_LIBRARIES "/opt/homebrew/Cellar/ffmpeg/7.0")
set(AVUTIL_FOUND TRUE)
set(AVCODEC_FOUND TRUE)
set(AVRESAMPLE_FOUND TRUE)

find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h)
find_library(AVCODEC_LIBRARY avcodec)

find_path(AVFORMAT_INCLUDE_DIR libavformat/avformat.h)
find_library(AVFORMAT_LIBRARY avformat)

find_path(AVUTIL_INCLUDE_DIR libavutil/avutil.h)
find_library(AVUTIL_LIBRARY avutil)

find_path(AVDEVICE_INCLUDE_DIR libavdevice/avdevice.h)
find_library(AVDEVICE_LIBRARY avdevice)

其他的参数设置 大家参考,你们可以修改为对应自己的路径

set(SWScale_LIBRARY "${FFmpeg_LIBRARIES}/lib/libswscale.dylib")
# 添加 OpenSSL 相关的头文件路径
include_directories(${OPENSSL_INCLUDE_DIR})

set(PKG_CONFIG_EXECUTABLE "/opt/homebrew/bin/pkg-config")

set(XSLTPROC_EXECUTABLE "xsltproc")

set(DOCBOOK_XSL_DIR "/opt/homebrew/opt/docbook-xsl")

如果缺少一些库的时候,记得brew install

brew install pkg-config xsltproc docbook-xsl SDL2_ttf 

export PKG_CONFIG=/opt/homebrew/bin/pkg-config
export PATH="/usr/bin/xsltproc:$PATH"

最后编译的完整参数为:
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake -GXcode -DPLATFORM=OS64 --trace-source=FindFFmpeg.cmake -DALLOW_IN_SOURCE_BUILD=ON -DWITH_MBEDTLS=ON -DWITH_MANPAGES=OFF

use https://github.com/FreeRDP/FreeRDP/wiki/Compilation#compiling-for-mingw and replace the mingw toolchain with the ios one.