Build Qt 4.8.6 or 4.8.7 in windows by VS2005

NOTE: Qt 4.8.7 would be planned to be the last version of Qt 4. If your software be required porting to mobile devices deeply, or would be maintained for very long time in the future desktop platform, Qt 5 may be a better selection.

       In this article, I will explain how to build Qt 4.8 in windows by VS 2005. I take Qt 4.8.6 or 4.8.7 as the building target.


Step 0, Download the version 4.8.6 or 4.8.7, and uncompress the package. For me, the source code of Qt is in C:\Lib\Qt\qt-everywhere-opensource-src-4.8.6 (or ...src-4.8.7)


Step 1(skipable): modify the file, qt-everywhere-opensource-src-4.8.6\mkspecs\win32-msvc2005, line 23:


QMAKE_CFLAGS_RELEASE    = -O2 -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
QMAKE_CFLAGS_DEBUG      = -Zi -MDd


 to 
QMAKE_CFLAGS_RELEASE    = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG      = -Zi -MTd



Step 2: Modify the file, qt-everywhere-opensource-src-4.8.6\src\gui\kernel\qclipboard_win.cpp, line 304 as:


static bool isProcessBeingDebugged(HWND hwnd)
{
#if defined(_MSC_VER) && _MSC_VER <= 1400 
    return false;
#else
    DWORD pid = 0;
    if (!GetWindowThreadProcessId(hwnd, &pid) || !pid)
        return false;
    const HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
    if (!processHandle)
       return false;
    BOOL debugged = FALSE;
    CheckRemoteDebuggerPresent(processHandle, &debugged);
    CloseHandle(processHandle);
    return debugged != FALSE;
#endif    
}



Step 3: Modify the file, qt-everywhere-opensource-src-4.8.6\src\3rdparty\webkit\Source\WebCore\platform\DefaultLocalizationStrategy.cpp,  line 237(4.8.6)
or  line 317 (4.8.7) As:

String DefaultLocalizationStrategy::contextMenuItemTagLookUpInDictionary(const String& selectedString)
{
#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
    UNUSED_PARAM(selectedString);
    return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item");
#else
#if USE(CF)
    RetainPtr<CFStringRef> selectedCFString(AdoptCF, truncatedStringForLookupMenuItem(selectedString).createCFString());
    return formatLocalizedString(WEB_UI_STRING("Look Up “%@”", "Look Up context menu item with selected word"), selectedCFString.get());
#else
#if(0)
    return WEB_UI_STRING("Look Up “<selection>”", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
#else    
 return WEB_UI_STRING("Look Up <selection>", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
#endif
#endif
#endif
}

4.
   - α. Create a folder, which would contain the built files, for me, it be C:\Lib\Qt\qt-everywhere-opensource-src-4.8.6\built. Copy mkspecs (folder of Step 1.) folder into this folder.

  - β. (※ for 4.8.7) , add this icon :
into the folder : C:\Lib\Qt\qt-everywhere-opensource-src-4.8.7\src\3rdparty\webkit\Source\WebCore\inspector\front-end\Image. DO NOT change the file name or format, or it would cause compiling fail.


5. open a VS2005 command line prompt to configuration Qt.



The configure arguments, for me , I use

configure.exe -prefix C:\Lib\Qt\qt-everywhere-opensource-src-4.8.6\built -platform win32-msvc2005 -shared -debug-and-release -nomake demos -nomake examples -fast -mp -opensource -stl 

where the path after -prefix should be the same one which be mentioned at Step 4.( the one would contain built files.) .
(for me,
C:\Lib\Qt\qt-everywhere-opensource-src-4.8.6\built
for 4.8.6

C:\Lib\Qt\qt-everywhere-opensource-src-4.8.7\built
,for 4.8.7.)

Press enter key then y, then the nmake file would be generated.


6. After the gernerating has been done, type "nmake" and press enter, wait the binaries has been generated.The building of code cast long time, which depends on how much money you put in your computer.



7. type nmake install, to organize the built folder. DO NOT copy directly "include" folder which lies in the qt source root folder to your destination. The original include folder depends on source code heavily, it is not for working with built libraries.
  After nmake install finish, the librarie, include files and binaries tools are very portable, you could carry them to another windows computer for development usage, and the package would works well.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值