很早就关注QGIS了,关于它的编译,也尝试了好几次,但都没有成功。在要放弃的时候,再尝试了一回,完全按照他的intall指导。终于成功。
择其要点而言,就是要按部就班,不能偷工减料。想要成功编译,请按照以下步骤尝试。
4.1.3. Setting up the Visual Studio project with CMake
======================================================
To start a command prompt with an environment that both has the VC++ and the OSGeo4W variables create the following batch file (assuming the above packages were installed in the default locations):
@echo off
path %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\System32\Wbem;%PROGRAMFILES%\CMake 2.8\bin;%PROGRAMFILES%\subversion\bin;%PROGRAMFILES%\GnuWin32\bin
set PYTHONPATH=
set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
set INCLUDE=%INCLUDE%;%PROGRAMFILES%\Microsoft Platform SDK for Windows Server 2003 R2\include
set LIB=%LIB%;%PROGRAMFILES%\Microsoft Platform SDK for Windows Server 2003 R2\lib
set OSGEO4W_ROOT=C:\OSGeo4W
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
@set GRASS_PREFIX=c:/OSGeo4W/apps/grass/grass-6.4.0
@set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%\include
@set LIB=%LIB%;%OSGEO4W_ROOT%\lib;%OSGEO4W_ROOT%\lib
@cmd
Start the batch file and on the command prompt checkout the QGIS source from git to the source directory Quantum-GIS:
git clone git://github.com/qgis/Quantum-GIS.git
Create a 'build' directory somewhere. This will be where all the build output will be generated.
Now run cmake-gui and in the Where is the source code: box, browse to the top level QGIS directory.
In the Where to build the binaries: box, browse to the 'build' directory you created.
Adjust the path to bison and flex so that the shortened C:/Progra~1 is used rather than C:/Program Files.
Verify that the 'BINDINGS_GLOBAL_INSTALL' option is not checked, so that python bindings are placed into the output directory when you run the INSTALL target.
Hit Configure to start the configuration and select Visual Studio 9 2008 and keep native compilers and click Finish.
The configuration should complete without any further questions and allow you to click Generate.
Now close cmake-gui and continue on the command prompt by starting vcexpress. Use File / Open / Project/Solutions and open the qgis-x.y.z.sln File in your project directory.
Change Solution Configuration from Debug to RelWithDebInfo (Release with Debug Info) or Release before you build QGIS using the ALL_BUILD target (otherwise you need debug libraries that are not included).
After the build completed you should install QGIS using the INSTALL target.
Install QGIS by building the INSTALL project. By default this will install to c:\Program Files\qgis<version> (this can be changed by changing the CMAKE_INSTALL_PREFIX variable in cmake-gui).
You will also either need to add all the dependency DLLs to the QGIS install directory or add their respective directories to your PATH.
上述文字请逐一阅读,不能有遗漏。