This page describes how to build the PostgreSQL ODBC Driver on Windows. There are three methods to build: from command line using nmake makefiles, from command line using MSBuild files, and from Visual Studio IDE.
The following 3rd party software are required for the build:
For the MSBuild method, you will also need PowerShell.
C:\psqlodbc\> nmake /f win64.mak <options>
Despite the name, win64.mak is used to build both 32-bit and 64-bit binaries. With the Microsoft Windows SDK Command Prompt, you can switch between 32-bit and 64-bit target architectures with setenv /x86 and setenv /x64 commands. If using a Visual Studio Command Prompt you can start the x86 or x64 versions from the Start menu, or run vcvarsall.bat with appropriate options to switch architectures.
To build the .msi installer file:
C:\psqlodbc\> nmake /f win64.mak installer
The resulting installer file goes to installer/x64 or installer/x86 directory.
To build both 32-bit and 64-bit versions in one command:
C:\psqlodbc\> nmake /f win64.mak world
The following build options may be used, either on the command line, or by creating a file called "windows-local.mak".
Variable | Values |
CFG | Release(default), or Debug |
PG_INC | $(PROGRAMFILES)\PostgreSQL\9.3\include |
PG_LIB | $(PROGRAMFILES)\PostgreSQL\9.3\lib |
SSL_INC | C:\OpenSSL-Win32\include |
SSL_LIB | C:\OpenSSL-Win32\lib |
LINKMT | MT |
ANSI_VERSION | no (If set to "yes", output dll name to psqlodbc30a.dll) |
MSDTC | yes |
A Microsoft Visual Studio project file (and workspace) is included in the source tree.
psqlodbc.dsp can be used with Microsoft Visual C++ 6.0.
psqlodbc.proj and psqlodbc.sln can be used with Microsoft Visual C++ 2005 Edition (including the Express edition which can be downloaded free of charge from http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx)
Preparation before the build:
If you want to change the installation arrangement, it is necessary to edit the project settings.
Note:
The default build settings will create the following driver: