Difference between revisions of "Building Qt Creator from Git"

From Qt Wiki
Jump to: navigation, search
Line 1: Line 1:
[[Category:HowTo]]<br />[[Category:Developing_with_Qt::Qt 5]]
+
[[Category:HowTo]]
 +
[[Category:Developing_with_Qt::Qt 5]]
  
 
'''English''' [[Building-Qt-Creator-from-Git-SimplifiedChinese|简体中文]]
 
'''English''' [[Building-Qt-Creator-from-Git-SimplifiedChinese|简体中文]]
  
[toc align_right=&quot;yes&amp;quot; depth=&quot;3&amp;quot;]
+
[toc align_right="yes" depth="3"]
  
 
= Building Qt Creator from git =
 
= Building Qt Creator from git =
Line 9: Line 10:
 
== Dependencies ==
 
== Dependencies ==
  
To build Qt Creator from git, you need to first prepare some dependencies:<br />* Qt libraries from Qt 5.3.1 (or newer) are needed. You can use one of the prebuilt packages from &quot;the Downloads Page&amp;quot;:http://qt.io/download, or, if you want to go with git all the way, &quot;compile Qt 5 from git&amp;quot;:http://wiki.qt.io/Building_Qt_5_from_Git . These Qt modules are required: qtscript, qttools and qtdeclarative.
+
To build Qt Creator from git, you need to first prepare some dependencies:
 +
* Qt libraries from Qt 5.3.1 (or newer) are needed. You can use one of the prebuilt packages from "the Downloads Page":http://qt.io/download, or, if you want to go with git all the way, "compile Qt 5 from git":http://wiki.qt.io/Building_Qt_5_from_Git . These Qt modules are required: qtscript, qttools and qtdeclarative.
  
 
If you have Qt installed, you probably have all the other dependencies of Qt Creator, too. There are numerous Qt Creator plugins, and they may require additional packages to be installed (but they usually don't block the compilation, so don't worry).
 
If you have Qt installed, you probably have all the other dependencies of Qt Creator, too. There are numerous Qt Creator plugins, and they may require additional packages to be installed (but they usually don't block the compilation, so don't worry).
Line 15: Line 17:
 
== Getting the source code ==
 
== Getting the source code ==
  
To get Qt Creator source code, type this. If you do not want to include the QBS (Qt Build Suite) plugin, you may omit —recursive:<br /><code><br />git clone —recursive https://git.gitorious.org/qt-creator/qt-creator.git<br /></code>
+
To get Qt Creator source code, type this. If you do not want to include the QBS (Qt Build Suite) plugin, you may omit —recursive:
 +
<code>
 +
git clone —recursive https://git.gitorious.org/qt-creator/qt-creator.git
 +
</code>
  
This should be enough to compile Qt Creator from source. If you are interested in using other branches of the Qt Creator repository, please see the Qt Creator section at &quot;Branch Guidelines&amp;quot;:http://wiki.qt.io/Branches.
+
This should be enough to compile Qt Creator from source. If you are interested in using other branches of the Qt Creator repository, please see the Qt Creator section at "Branch Guidelines":http://wiki.qt.io/Branches.
  
 
== Compiling Qt Creator ==
 
== Compiling Qt Creator ==
Line 23: Line 28:
 
For building Qt Creator, an out-of-source build is recommended. For simplicity, this tutorial gives instructions for a build directory (namely 'qt-creator-build') that is located in parallel to the source directory ('qt-creator'), but any other folder can be used. If you have checked out '''QBS''', it will be compiled together with the rest of the code, you do not need to do anything special.
 
For building Qt Creator, an out-of-source build is recommended. For simplicity, this tutorial gives instructions for a build directory (namely 'qt-creator-build') that is located in parallel to the source directory ('qt-creator'), but any other folder can be used. If you have checked out '''QBS''', it will be compiled together with the rest of the code, you do not need to do anything special.
  
Before you start with building, make sure you are using correct version of Qt. This can be done with the following command:<br /><code><br />qmake -v<br /></code>
+
Before you start with building, make sure you are using correct version of Qt. This can be done with the following command:
 +
<code>
 +
qmake -v
 +
</code>
  
If the output points to a wrong version of Qt, or returns an error, you need to show the qmake binary to your environment (it may also mean that something is wrong with your Qt installation). You need to modify your PATH environment variable to include the directory with the qmake executable, e.g. &lt;Qt installation directory&amp;gt;/qtbase/bin.
+
If the output points to a wrong version of Qt, or returns an error, you need to show the qmake binary to your environment (it may also mean that something is wrong with your Qt installation). You need to modify your PATH environment variable to include the directory with the qmake executable, e.g. <Qt installation directory>/qtbase/bin.
  
<code><br />mkdir qt-creator-build<br />cd qt-creator-build<br />qmake -r ../qt-creator/qtcreator.pro<br /></code>
+
<code>
 +
mkdir qt-creator-build
 +
cd qt-creator-build
 +
qmake -r ../qt-creator/qtcreator.pro
 +
</code>
  
 
This will prepare the Makefile.
 
This will prepare the Makefile.
Line 39: Line 51:
 
</code>make module-qtscript</code>
 
</code>make module-qtscript</code>
  
Now, you can order the compilation:<br />On Linux, OS X:<br /><code><br />make <s>j &lt;number-of-cpu-cores+1&amp;gt;<br /></code><br />On Windows (MSVC):<br /><code><br />nmake<br /></code>
+
Now, you can order the compilation:
<br />Compilation takes a while (only a bit less than compilation of Qt libraries themselves)</s> so be patient. After it's finished, you can safely start using Qt Creator (binaries are located in qt-creator-build/bin directory).
+
On Linux, OS X:
 +
<code>
 +
make -j <number-of-cpu-cores+1>
 +
</code>
 +
On Windows (MSVC):
 +
<code>
 +
nmake
 +
</code>
 +
 
 +
Compilation takes a while (only a bit less than compilation of Qt libraries themselves)- so be patient. After it's finished, you can safely start using Qt Creator (binaries are located in qt-creator-build/bin directory).
  
 
== Installing Qt Creator (optional) ==
 
== Installing Qt Creator (optional) ==
  
No further steps are required, but if you want to install it on your machine, type this:<br />Linux:<br /><code><br />make install INSTALL_ROOT=$INSTALL_DIRECTORY<br /></code><br />On Windows:<br /><code><br />nmake install INSTALL_ROOT=$INSTALL_DIRECTORY<br /></code>
+
No further steps are required, but if you want to install it on your machine, type this:
 +
Linux:
 +
<code>
 +
make install INSTALL_ROOT=$INSTALL_DIRECTORY
 +
</code>
 +
On Windows:
 +
<code>
 +
nmake install INSTALL_ROOT=$INSTALL_DIRECTORY
 +
</code>
  
 
On OS X, just move the Qt Creator app bundle where you like.
 
On OS X, just move the Qt Creator app bundle where you like.

Revision as of 08:42, 25 February 2015


English 简体中文

[toc align_right="yes" depth="3"]

Building Qt Creator from git

Dependencies

To build Qt Creator from git, you need to first prepare some dependencies:

  • Qt libraries from Qt 5.3.1 (or newer) are needed. You can use one of the prebuilt packages from "the Downloads Page":http://qt.io/download, or, if you want to go with git all the way, "compile Qt 5 from git":http://wiki.qt.io/Building_Qt_5_from_Git . These Qt modules are required: qtscript, qttools and qtdeclarative.

If you have Qt installed, you probably have all the other dependencies of Qt Creator, too. There are numerous Qt Creator plugins, and they may require additional packages to be installed (but they usually don't block the compilation, so don't worry).

Getting the source code

To get Qt Creator source code, type this. If you do not want to include the QBS (Qt Build Suite) plugin, you may omit —recursive:

git clone recursive https://git.gitorious.org/qt-creator/qt-creator.git

This should be enough to compile Qt Creator from source. If you are interested in using other branches of the Qt Creator repository, please see the Qt Creator section at "Branch Guidelines":http://wiki.qt.io/Branches.

Compiling Qt Creator

For building Qt Creator, an out-of-source build is recommended. For simplicity, this tutorial gives instructions for a build directory (namely 'qt-creator-build') that is located in parallel to the source directory ('qt-creator'), but any other folder can be used. If you have checked out QBS, it will be compiled together with the rest of the code, you do not need to do anything special.

Before you start with building, make sure you are using correct version of Qt. This can be done with the following command:

qmake -v

If the output points to a wrong version of Qt, or returns an error, you need to show the qmake binary to your environment (it may also mean that something is wrong with your Qt installation). You need to modify your PATH environment variable to include the directory with the qmake executable, e.g. <Qt installation directory>/qtbase/bin.

mkdir qt-creator-build
cd qt-creator-build
qmake -r ../qt-creator/qtcreator.pro

This will prepare the Makefile.

Note: If you built qt5 from the git repository and you get an error like

Project ERROR: Unknown module(s) in QT: script<code>

..then In your qt5 repository run:
make module-qtscript</code>

Now, you can order the compilation: On Linux, OS X:

make -j <number-of-cpu-cores+1>

On Windows (MSVC):

nmake

Compilation takes a while (only a bit less than compilation of Qt libraries themselves)- so be patient. After it's finished, you can safely start using Qt Creator (binaries are located in qt-creator-build/bin directory).

Installing Qt Creator (optional)

No further steps are required, but if you want to install it on your machine, type this: Linux:

make install INSTALL_ROOT=$INSTALL_DIRECTORY

On Windows:

nmake install INSTALL_ROOT=$INSTALL_DIRECTORY

On OS X, just move the Qt Creator app bundle where you like.