Building Qt5 with Visual Studio 2012 / Visual Studio 2013, and integrating with the IDE

前端 未结 5 1961
时光说笑
时光说笑 2020-11-28 18:19

How do you get Qt5 to download and integrate with Visual Studio 2012? What are some of the problems you will encounter, and how do you solve those problems?

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 19:21

    I was finally able to compile QT 5.1 (git) with QWebKit on Windows 8 x64 using Visual Studio 2012 and figured I'd share my experience with those that had problems as well.

    Did step 1 and 2 as stated in the above post. I tried to do step 3 but SmartGit pulled a bunch of extra projects that wouldn't compile with Qt5. I was able to solve most of the problems by cloning from a different fork (e.g. https://qt.gitorious.org/qt/qt3d/), but this became too tedious to do for every extra module, so I decided against compiling any of them.

    The post at ICU support in a 32-bit build of Qt5 with the VS2012 compiler causes Qt5 build failure; Webkit is also therefore unbuildable told me how to fix the ICU problem.

    Download the source code at http://download.icu-project.org/files/icu4c/51.2/icu4c-51_2-src.zip and add the line

    #define U_CHARSET_IS_UTF8 1
    

    to the file %ICU%\source\common\unicode\platform.h , where %ICU% is the path to the ICU source code.

    Open %ICU%\source\allinone\allinone.sln file in Visual Studio 2012 and compile. Add %ICU%\bin to your path

    set PATH=%ICU%\bin64;%PATH%
    

    Then I ran the following command in the QT root directory

    configure -platform win32-msvc2012 -opengl desktop -opensource -debug-and-release -I %ICU%\include -L %ICU%\icu\lib64 -mp -qt-freetype -icu
    

    At this point I started to suspect that no one tried to do what I was doing, because nmake started to complain about unexpected lines in the makefiles (all of which had the extension DerivedSources, e.g. Makefile.JavaScriptCore.DerivedSources and Makefile.WebCore.DerivedSources))

    (set PATH=;%PATH%) && ....
    

    do the set PATH manually before running nmake and delete the characters up to and including && e.g.

     (set PATH=;%PATH%) && perl -ne "print $1" css\CSSPropertyNames.in ...
    

    Becomes

    perl -ne "print $1" css\CSSPropertyNames.in ...
    

    Finally, one of these files will try to call win_flex.exe (or win-flex.exe) instead of flex. I changed it to flex.exe and everything finally compiled (Had to change it twice, because I think the file got regenerated).

    Brief experience with a program that uses QWebKit and linked against this build leads me to believe everything is fine.

    --Update--

    Just to be complete. According to What does (set PATH=...;%PATH:)=^)%) mean in a Windows shell script, and how can I overcome failure of this line in the context of a Qt5 nmake build? (which points to http://qt-project.org/forums/viewthread/20605) most of the Makefile problems should be solvable by using jsom instead of nmake (although I still wonder about win-flex.exe)

提交回复
热议问题