window下编译qt5.6.1含QWebengine模块开启M

2018-01-05  本文已影响1111人  Gmail163

首先需要准备python2,ruby,perl,后面编译会用到。

  1. 在D:\qt\Qt5.6.1\5.6\Src\qtwebengine下执行D:\qt\Qt5.6.1\5.6\msvc2015\bin\qmake WEBENGINE_CONFIG+=use_proprietary_codecs(此处的Qt路径根据实际情况做适当更改);
  2. 在src文件夹下新建build.bat文件,输入如下内容进行配置:
    CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
    SET _ROOT=D:\Qt5.6.1\5.6\Src
    SET PATH=C:\Windows;C:\Windows\system32;
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;%PATH%
    SET PATH=C:\Program Files (x86)\Windows Kits\10\bin\x86;%PATH%
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    SET PATH=D:\icu\bin;D:\qtopenssl_x86\bin;%PATH%
    SET PATH=D:\Ruby25-x64\bin;D:\Strawberry\perl\bin;D:\Python27;%PATH%
    SET INCLUDE=D:\icu\include;D:\qtopenssl_x86\include;%INCLUDE%
    SET LIB=D:\icu\lib;D:\qtopenssl_x86\lib;%LIB%
    SET QMAKESPEC=win32-msvc2015

configure -debug-and-release -opensource -platform win32-msvc2015 -prefix "D:\Qt5.6.1_bin_win32" -confirm-license -opengl dynamic -mp -icu -openssl -nomake examples -nomake tests -no-directwrite

  1. nmake(执行编译)
  2. nmake install(复制完成库到指定文件夹)

错误处理方法:
1.错误: ffmpeg.lib(ffmpeg.wavdec.obj) : error LNK2001:
找到文件:D:\Qt5.6.1\5.6\Src\qtwebengine\src\3rdparty\chromium\third_party\ffmpeg\libavformat\wavdec.c,修改554到557行为:
#if CONFIG_W64_DEMUXER
if (CONFIG_W64_DEMUXER && wav->w64)
left = find_guid(s->pb, ff_w64_guid_data) - 24;
else
left = find_tag(wav, s->pb, MKTAG('d', 'a', 't', 'a'));
#endif

  1. 错误:运行QWebEngineView加载网页出现“QtWebEngineProcess.exe已停止工作”,此时是因为资源未复制到目标文件夹,复制D:\Qt5.6.1\5.6\msvc2015\resources与D:\Qt5.6.1\5.6\msvc2015\translations到目标文件夹即可解决问题;
上一篇下一篇

猜你喜欢

热点阅读