postgresql/src/tools/msvc
Peter Eisentraut 1933ae629e Add PostgreSQL home page to --help output
Per emerging standard in GNU programs and elsewhere.  Autoconf already
has support for specifying a home page, so we can just that.

Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/flat/8d389c5f-7fb5-8e48-9a4a-68cec44786fa%402ndquadrant.com
2020-02-28 13:12:21 +01:00
..
dummylib perltidy run prior to branching 2018-06-30 12:28:55 -04:00
.gitignore Ignore config.pl and buildenv.pl in src/tools/msvc. 2014-05-12 14:24:18 -04:00
Install.pm Use zic's new "-b slim" option to generate smaller timezone files. 2019-08-19 13:17:02 -04:00
MSBuildProject.pm Fix syntax error in commit 20e99cddd. 2019-07-25 14:42:02 -04:00
Mkvcbuild.pm Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
Project.pm Allow running src/tools/msvc/mkvcbuild.pl under not Windows 2020-02-21 20:57:43 +01:00
README Add support for Visual Studio 2019 in build scripts 2019-07-02 14:02:33 +09:00
Solution.pm Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
VSObjectFactory.pm Allow running src/tools/msvc/mkvcbuild.pl under not Windows 2020-02-21 20:57:43 +01:00
build.bat Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
build.pl Clean up inconsistent backslash use in paths 2019-12-20 12:29:07 +01:00
clean.bat Remove separate files for the initial contents of pg_(sh)description 2020-01-19 13:54:58 +02:00
config_default.pl Move configure --disable-float8-byval to pg_config_manual.h 2019-11-27 12:27:20 +01:00
ecpg_regression.proj Fix inconsistencies and typos in the tree, take 11 2019-08-19 16:21:39 +09:00
gendef.pl MSVC: Build ~35% faster by calling dumpbin just once per directory. 2019-05-03 21:56:47 -07:00
install.bat Turn install.bat into a pure one line wrapper fort he perl script. 2015-07-06 22:18:26 +03:00
install.pl Initial pgperltidy run for v12. 2019-05-22 13:36:19 -04:00
mkvcbuild.pl Clean up inconsistent backslash use in paths 2019-12-20 12:29:07 +01:00
pgbison.bat Fix comments over eagerly c&p'd. 2011-07-07 03:53:49 -04:00
pgbison.pl Fix included file path for modern perl 2019-02-05 19:27:47 -05:00
pgflex.bat Fix comments over eagerly c&p'd. 2011-07-07 03:53:49 -04:00
pgflex.pl Fix included file path for modern perl 2019-02-05 19:27:47 -05:00
vcregress.bat Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
vcregress.pl Fix vcregress.pl for new plperl test case. 2020-01-29 19:13:34 -05:00

README

src/tools/msvc/README

MSVC build
==========

This directory contains the tools required to build PostgreSQL using
Microsoft Visual Studio 2013 - 2019. This builds the whole backend, not just
the libpq frontend library. For more information, see the documentation
chapter "Installation on Windows" and the description below.


Notes about Visual Studio Express
---------------------------------
To build PostgreSQL using Visual Studio Express, the Microsoft Windows SDK
has to be installed. Since this is not included in the product
originally, extra steps are needed to make it work.

First, download and install a supported version of the Microsoft Windows SDK
from www.microsoft.com (v8.1a or greater).

Locate the files vcprojectengine.dll.express.config and
vcprojectengine.dll.config in the vc\vcpackages directory of
the Visual C++ Express installation. In these files, add the paths
to the Platform SDK to the Include, Library and Path tags. Be sure
to add them to the beginning of the list.

This should work for both GUI and commandline builds, but a restart
may be necessary.

If you are using a recent version of the Microsoft Windows SDK that includes
the compilers and build tools you probably don't even need Visual Studio
Express to build PostgreSQL.


Structure of the build tools
----------------------------
The tools for building PostgreSQL using Microsoft Visual Studio currently
consist of the following files:

- Configuration files -
config_default.pl      default configuration arguments

A typical build environment has two more files, buildenv.pl and config.pl
that contain the user's build environment settings and configuration
arguments.


- User tools -
build.pl               tool to build the binaries
clean.bat              batch file for cleaning up generated files
install.pl             tool to install the generated files
mkvcbuild.pl           tool to generate the Visual Studio build files
vcregress.pl           tool to run the regression tests


- Internal tools -
gendef.pl              internal tool to generate .DEF files
pgbison.pl             internal tool to process .y files using bison
pgflex.pl              internal tool to process .l files using flex

Many of those .pl files also have a corresponding .bat-wrapper that doesn't
contain any additional logic.


- Internal modules -
Install.pm             module containing the install logic
Mkvcbuild.pm           module containing the code to generate the Visual
                       Studio build (project/solution) files
MSBuildProject.pm      module containing the code to generate MSBuild based
                       project files (Visual Studio 2013 or greater)
Project.pm             module containing the common code to generate the
                       Visual Studio project files. Also provides the
                       common interface of all project file generators
Solution.pm            module containing the code to generate the Visual
                       Studio solution files.
VSObjectFactory.pm     factory module providing the code to create the
                       appropriate project/solution files for the current
                       environment


Description of the internals of the Visual Studio build process
---------------------------------------------------------------
By typing 'build' the user starts the build.bat wrapper which simply passes
it's arguments to build.pl.
In build.pl the user's buildenv.pl is used to set up the build environment
(i. e. path to bison and flex). In addition his config.pl file is merged into
config_default.pl to create the configuration arguments.
These configuration arguments are passed over to Mkvcbuild::mkvcbuild
(Mkvcbuild.pm) which creates the Visual Studio project and solution files.
It does this by using VSObjectFactory::CreateSolution to create an object
implementing the Solution interface (this could be either VS2013Solution,
VS2015Solution, VS2017Solution or VS2019Solution, all in Solution.pm,
depending on the user's build environment) and adding objects implementing
the corresponding Project interface (VC2013Project, VC2015Project,
VC2017Project or VC2019Project from MSBuildProject.pm) to it.
When Solution::Save is called, the implementations of Solution and Project
save their content in the appropriate format.
The final step of starting the appropriate build program (msbuild) is
performed in build.pl again.