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;
|
2020-04-13 17:55:45 +02:00
|
|
|
use warnings;
|
2016-12-04 18:00:00 +01:00
|
|
|
|
2019-02-06 13:32:35 +01:00
|
|
|
use File::Basename;
|
|
|
|
use File::Spec;
|
2019-05-22 19:36:19 +02:00
|
|
|
BEGIN { use lib File::Spec->rel2abs(dirname(__FILE__)); }
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
use Cwd;
|
|
|
|
|
|
|
|
use Mkvcbuild;
|
|
|
|
|
2019-12-20 12:26:01 +01:00
|
|
|
chdir('../../..') if (-d '../msvc' && -d '../../../src');
|
2019-02-06 13:32:35 +01:00
|
|
|
die 'Must run from root or msvc directory'
|
2019-12-20 12:26:01 +01:00
|
|
|
unless (-d 'src/tools/msvc' && -d 'src');
|
2019-02-06 13:32:35 +01:00
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
# 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
|
|
|
{
|
2019-02-06 00:57:12 +01: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;
|
2019-02-06 13:32:35 +01:00
|
|
|
do "./src/tools/msvc/config_default.pl";
|
|
|
|
do "./src/tools/msvc/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
|
|
|
|
|
2018-08-24 03:33:40 +02:00
|
|
|
if ($buildwhat)
|
2012-01-03 14:44:26 +01:00
|
|
|
{
|
2012-07-05 03:47:49 +02:00
|
|
|
system(
|
2018-04-26 17:52:52 +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
|
|
|
}
|
2007-09-23 23:52:56 +02:00
|
|
|
else
|
|
|
|
{
|
2017-05-18 01:01:23 +02:00
|
|
|
system(
|
2018-04-26 17:52:52 +02:00
|
|
|
"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;
|