Compiling-ICU-with-MSVC: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add "cleanup" tag)
(Forget to --disable-release in debug build)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
[[Category:MSVC]]
[[Category:MSVC]]
[[Category:Windows]]
[[Category:Windows]]
Line 12: Line 10:
== Pre-built packages ==
== Pre-built packages ==


The "ICU Project site":http://site.icu-project.org/download provides pre-built packages for MSVC 2010, which should work with compilers too. Anyhow, you have to compile your own version if you want to avoid the MSVC 2010 runtime dependency (because you're using another MSVC version), or want to tailor the ICU configuration.
The [http://site.icu-project.org/download ICU Project site] provides pre-built packages for MSVC 2010, which should work with compilers too. Anyhow, you have to compile your own version if you want to avoid the MSVC 2010 runtime dependency (because you're using another MSVC version), or want to tailor the ICU configuration.


"download.qt.io":http://download.qt.io/development_releases/prebuilt/icu/prebuilt also hosts packages for MSVC 2010, 2012 and 2013.
[http://download.qt.io/development_releases/prebuilt/icu/prebuilt download.qt.io] also hosts packages for MSVC 2010, 2012 and 2013.


== Compiling on your own ==
== Compiling on your own ==
Line 21: Line 19:


* MSVC toolchain
* MSVC toolchain
* "Cygwin":http://www.cygwin.com/install.html
* [http://www.cygwin.com/install.html Cygwin]


Note: When installing Cygwin and selecting packages, make sure you search for and select 'make', 'dos2unix' and 'binutils'.
Note: When installing Cygwin and selecting packages, make sure you search for and select 'make', 'dos2unix' and 'binutils'.
Line 30: Line 28:
* If you don't require the full ICU data library (i.e. you want to end up with a smaller icudt .dll for deployment), use the ICU data library customizer here: http://apps.icu-project.org/datacustom/ICUData53.html (select the version and options you need).
* If you don't require the full ICU data library (i.e. you want to end up with a smaller icudt .dll for deployment), use the ICU data library customizer here: http://apps.icu-project.org/datacustom/ICUData53.html (select the version and options you need).
* Start cmd.exe and put Cygwin in PATH, convert line endings
* Start cmd.exe and put Cygwin in PATH, convert line endings
<code>
<code>
C:> set PATH=PATH;C:C:> dos2unix *
C:> set PATH=%PATH%;C:\Cygwin\bin
C:> dos2unix *
C:> dos2unix -f configure
C:> dos2unix -f configure
</code>
</code>
Line 38: Line 38:


<code>
<code>
C:> "C:Files (x86)Visual Studio 10.0\VC\vcvarsall.bat" x86
C:> "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
</code>
</code>


Run configure &amp;&amp; build:
Run configure && build:
<code>
<code>
C:> bash runConfigureICU Cygwin/MSVC —prefix=/cygdrive/c/icu/dist
C:> bash runConfigureICU Cygwin/MSVC -prefix=/cygdrive/c/icu/dist
</code>
</code>


Line 50: Line 50:
To link ICU statically (e.g. for a static release build of Qt), you have to ''append'' '—enable-static —disable-shared' :
To link ICU statically (e.g. for a static release build of Qt), you have to ''append'' '—enable-static —disable-shared' :
<code>
<code>
C:> bash runConfigureICU Cygwin/MSVC —prefix=/cygdrive/c/icu/dist —enable-static —disable-shared
C:> bash runConfigureICU Cygwin/MSVC -prefix=/cygdrive/c/icu/dist -enable-static -disable-shared
</code>
</code>


Line 56: Line 56:


<code>
<code>
C:> bash runConfigureICU —enable-debug —disable-release Cygwin/MSVC —prefix=/cygdrive/c/icu/dist —enable-static —disable-shared
C:> bash runConfigureICU --enable-debug --disable-release Cygwin/MSVC -prefix=/cygdrive/c/icu/dist -enable-static -disable-shared
</code>
</code>


Finally, run make &amp;&amp; make install
Finally, run make && make install


<code>
<code>
C:> make &amp;&amp; make install
C:> make && make install
</code>
</code>


Line 70: Line 70:


<code>
<code>
C:> set PATH=PATH;C:C:> set INCLUDE=INCLUDE;C:C:> set LIB=LIB;C:</code>
C:> set PATH=%PATH%;C:\icu\dist\bin; set INCLUDE=%INCLUDE%;C:\icu\dist\include; set LIB=%LIB%;C:\icu\dist\bin</code>


When you now run Qt’s configure.exe ICU should be detected, and Qt links against the libraries.
When you now run Qt’s configure.exe ICU should be detected, and Qt links against the libraries.

Latest revision as of 14:22, 6 June 2016


Compiling ICU with MSVC (Microsoft Visual Studio)

Qt 5 / QtWebkit requires ICU.

Pre-built packages

The ICU Project site provides pre-built packages for MSVC 2010, which should work with compilers too. Anyhow, you have to compile your own version if you want to avoid the MSVC 2010 runtime dependency (because you're using another MSVC version), or want to tailor the ICU configuration.

download.qt.io also hosts packages for MSVC 2010, 2012 and 2013.

Compiling on your own

Requirements

Note: When installing Cygwin and selecting packages, make sure you search for and select 'make', 'dos2unix' and 'binutils'.

How to build

C:> set PATH=%PATH%;C:\Cygwin\bin
C:> dos2unix *
C:> dos2unix -f configure

Check whether you have e.g. the MSVC compiler (cl.exe) in PATH. If not, set it up by calling e.g.

C:> "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86

Run configure && build:

C:> bash runConfigureICU Cygwin/MSVC -prefix=/cygdrive/c/icu/dist

This will generate a release shared build that you can use in both a debug and release build of Qt.

To link ICU statically (e.g. for a static release build of Qt), you have to append '—enable-static —disable-shared' :

C:> bash runConfigureICU Cygwin/MSVC -prefix=/cygdrive/c/icu/dist -enable-static -disable-shared

To link ICU statically and build it in debug mode (e.g. for a static debug build of Qt), you have to prepend '—enable-debug —disable-release' to the arguments:

C:> bash runConfigureICU --enable-debug --disable-release Cygwin/MSVC -prefix=/cygdrive/c/icu/dist -enable-static -disable-shared

Finally, run make && make install

C:> make && make install

Usage

Add the include, lib folders to your compilation environment, e.g. for cmd.exe :

C:> set PATH=%PATH%;C:\icu\dist\bin; set INCLUDE=%INCLUDE%;C:\icu\dist\include; set LIB=%LIB%;C:\icu\dist\bin

When you now run Qt’s configure.exe ICU should be detected, and Qt links against the libraries.