2007-09-23 23:52:56 +02:00
|
|
|
# -*-perl-*- hey - emacs - this is a perl file
|
|
|
|
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/tools/msvc/build.pl
|
2007-09-23 23:52:56 +02:00
|
|
|
|
2016-12-04 18:00:00 +01:00
|
|
|
use strict;
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
BEGIN
|
|
|
|
{
|
2010-04-09 15:05:58 +02:00
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
chdir("../../..") if (-d "../msvc" && -d "../../../src");
|
2010-04-09 15:05:58 +02:00
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
use lib "src/tools/msvc";
|
|
|
|
|
|
|
|
use Cwd;
|
|
|
|
|
|
|
|
use Mkvcbuild;
|
|
|
|
|
|
|
|
# buildenv.pl is for specifying the build environment settings
|
|
|
|
# it should contain lines like:
|
|
|
|
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
|
|
|
|
|
2012-06-10 21:20:04 +02:00
|
|
|
if (-e "src/tools/msvc/buildenv.pl")
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
2017-03-27 04:24:13 +02:00
|
|
|
do "src/tools/msvc/buildenv.pl";
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
2012-06-10 21:20:04 +02:00
|
|
|
elsif (-e "./buildenv.pl")
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
2017-03-27 04:24:13 +02:00
|
|
|
do "./buildenv.pl";
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# set up the project
|
|
|
|
our $config;
|
2017-03-27 04:24:13 +02:00
|
|
|
do "config_default.pl";
|
|
|
|
do "config.pl" if (-f "src/tools/msvc/config.pl");
|
2007-09-23 23:52:56 +02:00
|
|
|
|
2012-01-03 14:44:26 +01:00
|
|
|
my $vcver = Mkvcbuild::mkvcbuild($config);
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
# check what sort of build we are doing
|
|
|
|
|
2017-05-18 01:01:23 +02:00
|
|
|
my $bconf = $ENV{CONFIG} || "Release";
|
2016-09-08 07:42:09 +02:00
|
|
|
my $msbflags = $ENV{MSBFLAGS} || "";
|
2017-05-18 01:01:23 +02:00
|
|
|
my $buildwhat = $ARGV[1] || "";
|
2014-01-23 18:18:15 +01:00
|
|
|
if (uc($ARGV[0]) eq 'DEBUG')
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
2012-06-10 21:20:04 +02:00
|
|
|
$bconf = "Debug";
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
2014-01-23 18:18:15 +01:00
|
|
|
elsif (uc($ARGV[0]) ne "RELEASE")
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
2012-06-10 21:20:04 +02:00
|
|
|
$buildwhat = $ARGV[0] || "";
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# ... and do it
|
|
|
|
|
2013-02-06 20:52:29 +01:00
|
|
|
if ($buildwhat and $vcver >= 10.00)
|
2012-01-03 14:44:26 +01:00
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
system(
|
2017-05-18 01:01:23 +02:00
|
|
|
"msbuild $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf"
|
2016-06-12 10:19:56 +02:00
|
|
|
);
|
2012-01-03 14:44:26 +01:00
|
|
|
}
|
|
|
|
elsif ($buildwhat)
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
2016-09-08 07:42:09 +02:00
|
|
|
system("vcbuild $msbflags $buildwhat.vcproj $bconf");
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-18 01:01:23 +02:00
|
|
|
system(
|
|
|
|
"msbuild pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf");
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# report status
|
|
|
|
|
2016-12-04 18:00:00 +01:00
|
|
|
my $status = $? >> 8;
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
exit $status;
|