使用vc9 编译Qt5.4

来源:互联网 发布:网络炼钢大赛 编辑:程序博客网 时间:2024/05/22 14:14

官方的Qt
只有vc10以上的版本
若是想vc9 只能自己编译

so 开始干
搜索资料
1)vc9不能支持webkit的编译 直接删除掉
2)有部分地方 vc9默认支持LONG转ULONG 需要自己改代码
3)需要OPENSSL
4)需要python3.4.3
5)需要activePerl

开工
1。下载安装activeperl
2。下载安装python3.4.3
3。编译openssl 0.9.8k
perl Configure VC-WIN32 –prefix=C:\Build-OpenSSL-VC-32
ms\do_ms
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
4。开始config Qt5 一个bat搞定

cd /d "C:\Program Files\7-Zip"call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"if exist E:\qt-everywhere-opensource-src-5.4.0 ( echo "QT FIles exists") else ( REM 7z x D:\Qt\qt-everywhere-opensource-src-5.4.0.zip -oE:\ echo "COPY Qt 5.4.0 Source"xcopy %~dp0\qt5.4-source E:\qt-everywhere-opensource-src-5.4.0 /s /e /I)rd /s /q E:\qt-everywhere-opensource-src-5.4.0\qtwebkitrd /s /q E:\qt-everywhere-opensource-src-5.4.0\qtwebkit-examplescopy /y %~dp0\dscamerasession.cpp  E:\qt-everywhere-opensource-src-5.4.0\qtmultimedia\src\plugins\directshow\cameracd /d E:\qt-everywhere-opensource-src-5.4.0set PATH=C:\Python34;C:\Program Files\7-Zip;%CD%\qtbase\bin;%PATH%set QTDIR=C:\Qt\5.4.0configure.bat -developer-build -opensource -nomake examples -nomake tests -mp -confirm-license -opengl desktop -no-icu -skip qtserialport -platform win32-msvc2008 -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -I "C:\Python34\include" -I C:\Build-OpenSSL-VC9-32\include -L C:\Build-OpenSSL-VC9-32\lib -L "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" -L C:\Python34\libs -l Gdi32 -l User32  -prefix C:\Qt\5.4.0 -mpnmakenmake installpause

附上文中改掉的cpp文件 找到对应位置自行修改

  STDMETHODIMP_(ULONG) AddRef()    {        #if _MSC_VER==1500            volatile LONG *p_ref=reinterpret_cast<volatile LONG *>(&m_ref);            return InterlockedIncrement(p_ref);        #else            return InterlockedIncrement(&m_ref);        #endif    }    STDMETHODIMP_(ULONG) Release()    {        #if _MSC_VER==1500            volatile LONG *p_ref=reinterpret_cast<volatile LONG *>(&m_ref);            ULONG ref = InterlockedDecrement(p_ref);        #else            ULONG ref = InterlockedDecrement(&m_ref);        #endif        if (ref == 0)            delete this;        return ref;    }

完工

0 0
原创粉丝点击