Here is a quick post on how to build the GDAL source.
- Download the latest source code.
- 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.
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:
- 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:
For the official guide to building the GDAL sources see:
The page also lists all the different options available in the nmake.opt file.