Here is a quick post on how to build the GDAL source.
- Download the latest source code.
http://trac.osgeo.org/gdal/wiki/DownloadSource - Unzip the contents of the folder onto your hard drive.
- If you are going to use the GDAL bindings (such as the bindings for C#) then download SWIG.
http://www.swig.org/download.html
Build the swig binaries if required and copy the swig executable (SWIG.exe) to the GDAL source root folder. - In the root directory of the GDAL source that you just unzipped find the file nmake.opt and open it in a text editor and perform the following edits:
- Set the version of VISUAL STUDIO that you are going to use to build the GDAL binaries.
For Visual Studio 2008 - set MSVC_VER = 1500 - Set the GDAL_HOME variable to the GDAL source root folder. This is where all the binaries, includes, library files and html files will be copied upon successful build of GDAL.
I prefer adding Build to the source path - as all the built files will reside under one single folder.
eg: GDAL_HOME = "C:\Development\GDAL\gdal-1.5.0\Build" - In case you are going to be building the bindings then set the location for SWIG (also see step 3).
eg: SWIG = C:\Development\GDAL\gdal-1.5.0\swig.exe - To begin building
- Open a Visual Studio command prompt and navigate to the folder containing the GDAL source.
- Run each of the following commands
nmake /f makefile.vc
nmake /f makefile.vc install
nmake /f makefile.vc devinstall
At the end of running all 3 of the above commands you will find that the GDAL dlls will reside in the GDAL source root folder. Under the Build folder you will find additional folders containing the include files, library files, html files as well as GDAL utility executables. - To build the SWIG bindings for GDAL
- Navigate to the folder containing the bindings for the language that you need it for.
For example for C# navigate to the following folder:
C:\Development\GDAL\gdal-1.5.0\swig\csharp - Run the following commands
nmake /f makefile.vc interface
nmake /f makefile.vc - Once the bindings have been successfully built - the dlls and executables will be found in the root folder of the language. In this case the folder will be:
C:\Development\GDAL\gdal-1.5.0\swig\csharp
For the official guide to building the GDAL sources see:
http://trac.osgeo.org/gdal/wiki/BuildingOnWindows
The page also lists all the different options available in the nmake.opt file.
1 comment:
I have ms Visual C++ 2008 Express Edition running under windows XP.
5.2 nmake /fmakefile.vc
Get the following errors:-
fatal error U1077: 'xcopy' : return code '0x1'
Stop.
fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
Any suggestions ?
Post a Comment