Compiling-ICU-with-MSVC: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
==Compiling <span class="caps">ICU</span> with <span class="caps">MSVC</span> (Microsoft Visual Studio)==
[[Category:Windows]]<br />[[Category:Qt5]]<br />[[Category:ICU]]


Qt 5 / QtWebkit requires <span class="caps">ICU</span>.
== Compiling ICU with MSVC (Microsoft Visual Studio) ==


==Pre-built packages==
Qt 5 / QtWebkit requires ICU.


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


[http://download.qt.io/development_releases/prebuilt/icu/prebuilt download.qt.io] ''[download.qt.io]'' also hosts packages for <span class="caps">MSVC</span> 2010, 2012 and 2013.
The &quot;ICU Project site&amp;quot;: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.


==Compiling on your own==
&quot;download.qt.io&amp;quot;:http://download.qt.io/development_releases/prebuilt/icu/prebuilt also hosts packages for MSVC 2010, 2012 and 2013.


===Requirements===
== Compiling on your own ==


* <span class="caps">MSVC</span> toolchain
=== Requirements ===
* [http://www.cygwin.com/install.html Cygwin] ''[cygwin.com]''


Note: When installing Cygwin and selecting packages, make sure you search for and select ‘make’, ‘dos2unix’ and ‘binutils’.
* MSVC toolchain
* &quot;Cygwin&amp;quot;:http://www.cygwin.com/install.html


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


* Download latest ICU4C source code from http://site.icu-project.org/download (e.g.icu4c-53_1-src.zip), unzip.
* Download latest ICU4C source code from http://site.icu-project.org/download (e.g.icu4c-53_1-src.zip), unzip.
* If you don’t require the full <span class="caps">ICU</span> data library (i.e. you want to end up with a smaller icudt .dll for deployment), use the <span class="caps">ICU</span> 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 <span class="caps">PATH</span>, convert line endings<br />
* Start cmd.exe and put Cygwin in PATH, convert line endings<br /><code><br />C:&gt; set PATH=PATH;C:C:&gt; dos2unix *<br />C:&gt; dos2unix -f configure<br /></code>


Check whether you have e.g. the <span class="caps">MSVC</span> compiler (cl.exe) in <span class="caps">PATH</span>. If not, set it up by calling e.g.
Check whether you have e.g. the MSVC compiler (cl.exe) in PATH. If not, set it up by calling e.g.


Run configure &amp;&amp; build:<br />
<code><br />C:&gt; &quot;C:Files (x86)Visual Studio 10.0\VC\vcvarsall.bat&amp;quot; x86<br /></code>
 
Run configure &amp;&amp; build:<br /><code><br />C:&gt; bash runConfigureICU Cygwin/MSVC —prefix=/cygdrive/c/icu/dist<br /></code>


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


To link <span class="caps">ICU</span> statically (e.g. for a static release build of Qt), you have to ''append'' ‘—enable-static —disable-shared’ :<br />
To link ICU statically (e.g. for a static release build of Qt), you have to ''append'' '—enable-static —disable-shared' :<br /><code><br />C:&gt; bash runConfigureICU Cygwin/MSVC —prefix=/cygdrive/c/icu/dist —enable-static —disable-shared<br /></code>


To link <span class="caps">ICU</span> 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:
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:
 
<code><br />C:&gt; bash runConfigureICU —enable-debug —disable-release Cygwin/MSVC —prefix=/cygdrive/c/icu/dist —enable-static —disable-shared<br /></code>


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


==Usage==
<code><br />C:&gt; make &amp;&amp; make install<br /></code>
 
== Usage ==


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


When you now run Qt’s configure.exe <span class="caps">ICU</span> should be detected, and Qt links against the libraries.
<code><br />C:&gt; set PATH=PATH;C:C:&gt; set INCLUDE=INCLUDE;C:C:&gt; set LIB=LIB;C:</code>
 
===Categories:===


* [[:Category:ICU|ICU]]
When you now run Qt’s configure.exe ICU should be detected, and Qt links against the libraries.
* [[:Category:MSVC|MSVC]]
* [[:Category:Qt5|Qt5]]
* [[:Category:Windows|Windows]]

Revision as of 12:46, 23 February 2015



Compiling ICU with MSVC (Microsoft Visual Studio)

Qt 5 / QtWebkit requires ICU.

Pre-built packages

The "ICU Project site&quot;: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.

"download.qt.io&quot;:http://download.qt.io/development_releases/prebuilt/icu/prebuilt 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

  • Download latest ICU4C source code from http://site.icu-project.org/download (e.g.icu4c-53_1-src.zip), unzip.
  • 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
    <br />C:&gt; set PATH=PATH;C:C:&gt; dos2unix *<br />C:&gt; dos2unix -f configure<br />
    

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

<br />C:&gt; &quot;C:Files (x86)Visual Studio 10.0\VC\vcvarsall.bat&amp;quot; x86<br />

Run configure && build:

<br />C:&gt; bash runConfigureICU Cygwin/MSVC prefix=/cygdrive/c/icu/dist<br />

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' :

<br />C:&gt; bash runConfigureICU Cygwin/MSVC prefix=/cygdrive/c/icu/dist enable-static disable-shared<br />

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:

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

Finally, run make && make install

<br />C:&gt; make &amp;&amp; make install<br />

Usage

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

<br />C:&gt; set PATH=PATH;C:C:&gt; set INCLUDE=INCLUDE;C:C:&gt; set LIB=LIB;C:

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