Visual Studio Add-in: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Describe contributing changes)
(Describe installing or building Qt 5)
Line 17: Line 17:
<code lang="bash">git clone https://code.qt.io/qt-labs/vstools.git</code>
<code lang="bash">git clone https://code.qt.io/qt-labs/vstools.git</code>


==== Contributing Changes ====
==== Contribute changes ====
 
Contributions to the Qt Visual Studio Tools project must be submitted to the [https://codereview.qt-project.org/admin/repos/qt-labs/vstools qt-labs/vstools] Gerrit repository. For instructions on how to set up a Gerrit account and contribute to Qt projects, see [[Setting up Gerrit]].
Contributions to the Qt Visual Studio Tools project must be submitted to the [https://codereview.qt-project.org/admin/repos/qt-labs/vstools qt-labs/vstools] Gerrit repository. For instructions on how to set up a Gerrit account and contribute to Qt projects, see [[Setting up Gerrit]].


===Build a static Qt===
===Install Qt===
 
To build the Qt Visual Studio Tools, an installation of Qt is required. The version of Qt that is
currently supported is 5.12.9. Either build Qt from the sources available in the
[https://code.qt.io/cgit/qt/qt5.git/tag/?h=v5.12.9 Qt Project Git Repository Browser]
or install a [https://download.qt.io/official_releases/qt/5.12/5.12.9/ pre-built binary package].
 
===Build Qt from sources===
 
See [[Building Qt 5 from Git]] for the prerequisites and steps to build Qt from sources.
 
Recommended options for the configure tool:
 
<code lang="bash">configure -static -opensource -confirm-license -nomake examples -nomake tests -opengl desktop</code>
 
Recommended options for [[Jom]]:
 
<code lang="bash">jom module-qtbase module-qtdeclarative</code>
 
===32-bit or 64-bit===
 
Visual Studio 2022 is a 64-bit application, whereas VS 2019 and 2017 are 32-bit applications. The
target platform for which Qt is built must reflect this:


Building the Qt Visual Studio Tools from sources requires a static build of Qt (version 5.6.0 or newer).Supported
* For Visual Studio 2022, use Qt built for the x64 platform.
compilers are MSVC 2013 or newer, GCC 4.7 or newer, and Clang 3.1 or newer. See the Qt documentation
* For Visual Studio 2019, use Qt built for the x86 platform.
for the prerequisites and steps to build Qt from sources. https://wiki.qt.io/Building_Qt_5_from_Git#Windows<br /><br />
* For Visual Studio 2017, use Qt built for the x86 platform.
'''''Recommended configuration options:''''' configure -prefix %CD%\qtbase -release -static -static-runtime -opensource -nomake examples -nomake tests<br />
'''''Recommended (n)make options:''''' (n)make module-qtbase


===Build the Qt Visual Studio Tools===
===Build the Qt Visual Studio Tools===

Revision as of 08:59, 7 December 2021

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

French translators see also: http://qt-devnet.developpez.com/tutoriels/add-in-visual-studio/compiler/

Qt Visual Studio Tools

The Qt Visual Studio Tools integrate the Qt development tools into Microsoft Visual Studio. This enables developers to use the standard Windows development environment without having to worry about Qt-related build steps or tools.

Get the sources

Use Git to check out the Qt Visual Studio Tools sources that are hosted at: http://code.qt.io/cgit/qt-labs/vstools.git

To create a repository clone, execute one of the following commands:

git clone git://code.qt.io/qt-labs/vstools.git
git clone https://code.qt.io/qt-labs/vstools.git

Contribute changes

Contributions to the Qt Visual Studio Tools project must be submitted to the qt-labs/vstools Gerrit repository. For instructions on how to set up a Gerrit account and contribute to Qt projects, see Setting up Gerrit.

Install Qt

To build the Qt Visual Studio Tools, an installation of Qt is required. The version of Qt that is currently supported is 5.12.9. Either build Qt from the sources available in the Qt Project Git Repository Browser or install a pre-built binary package.

Build Qt from sources

See Building Qt 5 from Git for the prerequisites and steps to build Qt from sources.

Recommended options for the configure tool:

configure -static -opensource -confirm-license -nomake examples -nomake tests -opengl desktop

Recommended options for Jom:

jom module-qtbase module-qtdeclarative

32-bit or 64-bit

Visual Studio 2022 is a 64-bit application, whereas VS 2019 and 2017 are 32-bit applications. The target platform for which Qt is built must reflect this:

  • For Visual Studio 2022, use Qt built for the x64 platform.
  • For Visual Studio 2019, use Qt built for the x86 platform.
  • For Visual Studio 2017, use Qt built for the x86 platform.

Build the Qt Visual Studio Tools

Change the directory into 'src' and run 'qmake && make' (or 'mingw32-make', 'nmake' ...) to build the Qt Visual Studio Tools command line applications. Once finished, open the solution QtVsTools.sln in Visual Studio and build the solution.

Build the Qt Visual Studio Tools documentation

Run 'qmake && make docs' (or 'mingw32-make docs', 'nmake docs' ...) from the root directory to build the Qt Visual Studio Tools documentation. You need to have 'qdoc' and friends built already. See the Qt documentation for the prerequisites and steps to build Qt documentation from sources. https://wiki.qt.io/Building_Qt_Documentation

How to debug the Qt Visual Studio Tools

To debug the resulting VSIX, select the 'QtVsTools' node, right click and choose 'Properties|Debug'. Update 'Start Action|Start external program:' to point to your Visual Studio 'devenv.exe' application. Update 'Start Options|Command line arguments:' with '/rootSuffix Exp'. Note: The implemented post build targets will only work reliable if you use the 'Exp' hive of Visual Studio.

How to locally test the Qt Visual Studio Tools update

Inside the src\config directory, edit the qt.io.xml file and modify the following tags:

   <updated>2016-11-11T10:51:55Z</updated>   Use the current date and time, keep the 'T' and 'Z'
   <id>{ Product ID }</id>                   Set to the Product ID that can be found in the 'source.extension.vsixmanifest' file,
                                             for example: <id>QtVsTools.30112013-cd02-4fd0-89bd-e36f85abe16a</id>
   <Version>{ Version }</Version>            Set to the Version that can be found in the 'source.extension.vsixmanifest' file,
                                             for example: <Version>2.0.0</Version>

Copy the XML file and the VSIX package inside a new folder side by side and open the 'Tools | Options | Extensions and Updates' settings dialog in Visual Studio. Add a new entry in the Additional Extension Gallery, like this:

   Name: qt.io
   Url: file://path/to/your/atom.xml