Compiling PostGIS 1.5 under VC++
This is still a work in progress: A good tool for extracting tar, gz, and bz files: http://www.7-zip.org/
Compile PostgreSQL under VC++ 2008/2010 (express or Studio)
Note that if you are compiling for 64-bit, Express Does not include the needed libraries by default. Refer to http://msdn.microsoft.com/en-us/library/9yb4317s.aspx for details. Full details here
We will just cover enough to be able to compile PostGIS so will not be compiling with additional dependencies
- Install Active State ActivePerl (5.8+) http://www.activestate.com/activeperl/downloads
- Download PostgreSQL source and Extract PostgreSQL 9.0 source tar ball http://www.postgresql.org/ftp/source/ into folder C:\Projects\PostgreSQL\postgresql-9.0.1win
- Create a file C:\Projects\PostgreSQL\postgresql-9.0.1win\src\tools\msvc\buildenv.pl
Add add a line — note in our case — we compile with mingw usually, so we are completely overwriting the path with one that doesn't contain mingw because mingw and VC++ don't play well together when compiling PostgreSQL
#-- buildenv.pl starts here -- $ENV{PATH}='C:\perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\Support Tools\;C:\opt\gtk\bin;C:\Program Files\R\R-2.10.1\bin'; $ENV{PATH} = $ENV{PATH} . ';C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages'; # -- buildenv.pl ends here --
- Open up VC ++ commandling from: start→Programs→Visual c++ Express 2008 →Visual Studio Tools
- cd C:\Projects\PostgreSQL\postgresql-9.0.1win\src\tools\msvc
- clean.bat
- build.bat
Compile GEOS 3.2.2 under VC++
Note that from GEOS 3.3+ — GEOS is moving to CMake build If you wish to compile GEOS 3.3+ instead, please refer to GEOS Windows CMake build instructions
- download http://download.osgeo.org/geos/geos-3.2.2.tar.bz2
- extract into c:\projects\geos\geos-3.2.2win
- Launch start-programs→MS visual c++ 2008→Visual Studio tools command prompt
- cd c:\projects\geos\geos-3.2.2win
- Following nmake directions from http://trac.osgeo.org/geos/wiki/BuildingOnWindowsWithNMake
autogen.bat nmake /f makefile.vc MSVC_VER=1400
- The above will generate 2 dlls in the c:\projects\geos\geos-3.2.2win\source folder (geos.dll, geos_c.dll )
Compile Proj under VC++
- download http://download.osgeo.org/proj/proj-4.7.0.tar.gz
- extract into c:\projects\proj\proj-4.7.0win
- Download the http://download.osgeo.org/proj/proj-datumgrid-1.5.zip and extract into your proj-4.7.0-win\nad folder
- At your VC++ prompt
cd C:\projects\proj\proj-4.7.0win nmake /f makefile.vc MSVC_VER=1400
- the above will create a proj.dll in your C:\Projects\proj\proj-4.7.0win\src folder
Compile libi-conv
Compile or get binaries for libxml2
Compiling PostGIS
- Extract into c:\projects\postgis\postgis-1.5.3win
- Copy the build and platform folders from Mateusz zip file http://mateusz.loskot.net/2009/03/29/building-postgis-using-visual-cpp/ and copy into your postgis-1.5.2win folder