请选择 进入手机版 | 继续访问电脑版
MSIPO技术圈 首页 IT技术 查看内容

windows 编译libyuv

2023-07-13

一、libyuv下载

git clone https://chromium.googlesource.com/external/libyuv

二、libjpeg-turbo下

git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git

三、编译可以参考 BUILDING.md

需要环境: VS2019

CMake

YASM

启动vs工具 编译:

cd libjpeg-turbo
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
nmake

编译生成

jpeg-static.lib Static link library for the libjpeg API

jpeg{version}.dll DLL for the libjpeg API

jpeg.lib Import library for the libjpeg API

turbojpeg-static.lib Static link library for the TurboJPEG API

turbojpeg.dll DLL for the TurboJPEG API

turbojpeg.lib Import library for the TurboJPEG API

四、打开libyuv CMakeLists.txt

1、默认libyuv是没有配置JPEG的

2、libyuv目录下创建libjpeg,拷贝库和头文件

-libjpeg

    -jpeglib.h

    -jconfig.h

    -jmorecfg.h

    -lib

        -jpeg.lib

        -jpeg62.dll

3、修改CMakeLists.txt

A、SET ( ly_lib_shared ${ly_lib_name}_shared )后面添加

SET ( JPEG_INCLUDE_DIR ${ly_base_dir}/libjpeg)
SET ( JPEG_LIBRARY jpeg)

B、ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) 后面添加

TARGET_LINK_LIBRARIES   (${ly_lib_static} ${JPEG_LIBRARY})

C、ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )后面添加

TARGET_LINK_LIBRARIES   (${ly_lib_shared} ${JPEG_LIBRARY})

D、去掉

target_compile_options(${ly_lib_static} PRIVATE
  -Wno-sign-compare
  -Wno-unused-function
  -Wunused-variable
  -Wuninitialized)

如图:

4、编译libyuv

md out
cd out
cmake ..
手动打开 YUV.sln 
编译生成 yuv.lib

注:编译出来的是yuv.lib,建议直接修改为libyuv.lib和工程名称一致

六、打包库

-libyuv

    -include // 这里是libyuv的include文件夹

    -lib  // libyuv.lib jpeg.lib

    -dll //  jpeg62.dll 

相关阅读

手机版|MSIPO技术圈 皖ICP备19022944号-2

Copyright © 2024, msipo.com

返回顶部