Windows x64版本
- 准备工具
Vs2019
qt5.15.0
qt5.15.0源码
python-2.7.18.amd64.msi Python只能用2.7以后的版本,且不可用Python3
- 安装Python2,并加入到环境变量中
- Qt源代码修改
参考官方文档Fix build with msvc2019 16.8.0 (I3554ceec) · Gerrit Code Review (qt-project.org)
第3个文件和5.15.0有区别,需要将第190行屏蔽掉,加入下面代码
TimestampedTracePiece& operator=(TimestampedTracePiece&& ttp) {
if (this != &ttp) {
// First invoke the destructor and then invoke the move constructor
// inline via placement-new to implement move-assignment.
this->~TimestampedTracePiece();
new (this) TimestampedTracePiece(std::move(ttp));
}
return *this;
}
#if PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC)
TimestampedTracePiece& operator=(TimestampedTracePiece&& ttp) const
{
if (this != &ttp) {
// First invoke the destructor and then invoke the move constructor
// inline via placement-new to implement move-assignment.
this->~TimestampedTracePiece();
new (const_cast<TimestampedTracePiece*>(this)) TimestampedTracePiece(std::move(ttp));
}
return const_cast<TimestampedTracePiece&>(*this);
}
#endif // PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC)
- 在vs2019工具集中找到x64 Native Tool Command Prompt for VS 2019 ,以管理员权限启动,启动成功如下
- 切换到qt15.0 qtWebEngine源码目录
执行qmake命令生成编译文件 D:\Qt\5.15.0\bin\qmake.exe qtwebengine.pro -- -webengine-proprietary-codecs
执行成功后 执行nmake命令开始编译,然后就是漫长的等待,编译完成后将bin和lib下的文件替换到qt5.15.5对应的地方即可。
Linux x64版本
1.准备工具
qt5.15.0
qt5.15.0源码
2.修改源码,同上
3.安装环境
参考官方编译说明QtWebEngine/How to Try - Qt Wiki
执行sudo apt-get install bison build-essential gperf flex python2.7 libasound2-dev libcups2-dev libdrm-dev libegl1-mesa-dev libnss3-dev libpci-dev libpulse-dev libudev-dev nodejs libxtst-dev gyp ninja-build
执行sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libfontconfig1-dev libxss-dev libsrtp0-dev libwebp-dev libjsoncpp-dev libopus-dev libminizip-dev libavutil-dev libavformat-dev libavcodec-dev libevent-dev libvpx-dev libsnappy-dev libre2-dev libprotobuf-dev protobuf-compiler
4.编译
切换到QtWebEngine源码路径下,执行qmake qtwebengine.pro -- -webengine-proprietary-codecs
成功后 执行make 开始编译,编译完成后将bin和lib下的文件替换到qt5.15.5对应的地方即可。
已编译通过电脑配置:16G内存,CPU6核12线程,编译过程中全部占满,请不要执行其他操作,以免死机。