Skip to content

Commit cd3b369

Browse files
Codym48jef-n
authored andcommittedMay 11, 2020
Clarify Windows configonly.bat workflow and fix user-specific path
The previous workflow encouraged the user to create a batch file pointing to a nonexistant file before cloning the source code repository. Rearrange the calls so that the user can succesfully clone the QGIS repository, then create a batch file that calls a file in that source tree, then open the command prompt created by that batch file, then call a series of commands that configures using CMake, builds using Visual Studio, and runs QGIS.
1 parent b0e87db commit cd3b369

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed
 

‎doc/msvc.t2t

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Download and install following packages:
3131
For the QGIS build you need to install following packages from cygwin:
3232
- bison
3333
- flex
34-
- git
34+
- git (even if you already have Git for Windows installed)
3535
-
3636

3737
and from OSGeo4W (select //Advanced Install//):
@@ -51,62 +51,81 @@ dependencies. If you're interested in that, check the history of this page in t
5151
or the SVN repository.
5252

5353
ninja:
54-
copy ninja.exe to d:\OSGeo4W64\bin\
54+
copy ninja.exe to C:\OSGeo4W64\bin\
5555

56-
=== Setting up the Visual Studio project with CMake ===
57-
58-
/!\ Consider this section as example. It tends to outdate, when OSGeo4W and
59-
SDKs move on. ``ms-windows/osgeo4w/package-nightly.cmd`` is used for the
60-
nightly builds and constantly updated and hence might contain necessary
61-
updates that are not yet reflected here.
56+
=== Clone the QGIS Source Code ===
6257

63-
To start a command prompt with an environment that both has the VC++ and the OSGeo4W
64-
variables create the following batch file (assuming the above packages were
65-
installed in the default locations):
58+
Chose a directory to store the QGIS source code.
59+
For example, to put it in the OSGeo4W64 install, navigate there:
6660

6761
```
68-
@echo off
69-
call X:\src\qgis\ms-windows\osgeo4w\msvc-env.bat x86_64
70-
@cmd
62+
cd C:\OSGeo4W64
7163
```
7264

73-
Save the batch file as ``d:\OSGeo4W64\OSGeo4W-dev.bat`` and run it.
74-
On the command prompt checkout the QGIS source from
65+
This directory will be assumed for all instructions
66+
that follow.
67+
68+
On the command prompt clone the QGIS source from
7569
git to the source directory ``QGIS``:
7670

7771
```
7872
git clone git://github.com/qgis/QGIS.git
7973
```
8074

75+
This requires Git. If you have Git for Windows on your PATH already,
76+
you can do this from a normal command prompt. If you do not, you can
77+
use the Git package that was installed as part of Cygwin by opening
78+
a Cygwin[64] Terminal
79+
8180
And, to avoid Git in Windows reporting changes to files not actually modified:
8281

8382
```
8483
git config core.filemode false
8584
```
8685

86+
=== Setting up the Visual Studio project with CMake ===
87+
88+
/!\ Consider this section as example. It tends to outdate, when OSGeo4W and
89+
SDKs move on. ``ms-windows/osgeo4w/package-nightly.cmd`` is used for the
90+
nightly builds and constantly updated and hence might contain necessary
91+
updates that are not yet reflected here.
92+
93+
To start a command prompt with an environment that both has the VC++ and the OSGeo4W
94+
variables create the following batch file (assuming the above packages were
95+
installed in the default locations):
96+
97+
```
98+
@echo off
99+
call C:\OSGeo4W64\QGIS\ms-windows\osgeo4w\msvc-env.bat x86_64
100+
@cmd
101+
```
102+
103+
Save the batch file as ``C:\OSGeo4W64\OSGeo4W-dev.bat`` and run it.
104+
87105

88106
Using configonly.bat to create the MSVC solution file:
89-
We will be using the file ms-windows/osgeo4w/configonly.bat to create an MSVC solution file.
107+
We will be using the file ``ms-windows/osgeo4w/configonly.bat`` to create an MSVC solution file.
90108
There are a few options for a solution file, following are the options: ninja, native MSVC.
91-
The advantage of using native MSVC solution is that you can find the root of build problems much easily.
109+
The advantage of using native MSVC solution is that you can find the root of build problems much more easily.
92110
configonly.bat is meant to create a configured build directory with a MSVC solution file:
93111

94-
```
95-
configonly.bat
96-
```
112+
```
113+
cd C:\OSGeo4W64\QGIS\ms-windows\osgeo4w
114+
configonly.bat
115+
```
97116

98117
Compiling QGIS with MSVC:
99118
We will need to run MSVC with all the environment variables set, thus we will run it as follows:
100-
Run the batch file OSGeo4W-dev.bat you created before. On the command prompt run: ``devenv``
119+
Run the batch file OSGeo4W-dev.bat you created before. On the command prompt run: ``devenv`` to open MSVC.
101120
From MSVC, open the solution file
102-
``d:\OSGeo4W64\QGIS\ms-windows\osgeo4w\build-qgis-test-x86_64\qgis.sln``
121+
``C:\OSGeo4W64\QGIS\ms-windows\osgeo4w\build-qgis-test-x86_64\qgis.sln``
103122
Try to build the solution (go grab a cup of tea, it may take a while).
104123
If it fails, run it again and again until there are (hopefully) no errors.
105124

106125

107126
Running QGIS from within MSVC:
108127
Edit the properties of the project ALL_BUILD:
109-
Debugging -> Command -> D:\OSGeo4W64\QGIS\ms-windows\osgeo4w\build-qgis-test-x86_64\output\bin\RelWithDebInfo\qgis.exe
128+
Debugging -> Command -> ``C:\OSGeo4W64\QGIS\ms-windows\osgeo4w\build-qgis-test-x86_64\output\bin\RelWithDebInfo\qgis.exe``
110129
Run.
111130
Ignore the "These projects are out of date" message, it appears even if no files were changed.
112131

0 commit comments

Comments
 (0)