diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/msvc/Mkvcbuild.pm | 69 | ||||
-rw-r--r-- | src/tools/msvc/Project.pm | 37 |
2 files changed, 97 insertions, 9 deletions
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index aab559e3ef9..3cb46832abf 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -36,16 +36,12 @@ my @unlink_on_exit; # Set of variables for modules in contrib/ and src/test/modules/ my $contrib_defines = {}; -my @contrib_uselibpq = - ('dblink', 'oid2name', 'postgres_fdw', 'vacuumlo', 'libpq_pipeline'); -my @contrib_uselibpgport = ('libpq_pipeline', 'oid2name', 'vacuumlo'); -my @contrib_uselibpgcommon = ('libpq_pipeline', 'oid2name', 'vacuumlo'); +my @contrib_uselibpq = (); +my @contrib_uselibpgport = (); +my @contrib_uselibpgcommon = (); my $contrib_extralibs = { 'libpq_pipeline' => ['ws2_32.lib'] }; -my $contrib_extraincludes = {}; -my $contrib_extrasource = { - 'cube' => [ 'contrib/cube/cubescan.l', 'contrib/cube/cubeparse.y' ], - 'seg' => [ 'contrib/seg/segscan.l', 'contrib/seg/segparse.y' ], -}; +my $contrib_extraincludes = {}; +my $contrib_extrasource = {}; my @contrib_excludes = ( 'bool_plperl', 'commit_ts', 'hstore_plperl', 'hstore_plpython', @@ -1010,6 +1006,61 @@ sub AddContrib $proj->AddDefine($1); } } + elsif ($flag =~ /^-I(.*)$/) + { + if ($1 eq '$(libpq_srcdir)') + { + foreach my $proj (@projects) + { + $proj->AddIncludeDir('src/interfaces/libpq'); + $proj->AddReference($libpq); + } + } + } + } + } + + if ($mf =~ /^SHLIB_LINK_INTERNAL\s*[+:]?=\s*(.*)$/mg) + { + foreach my $lib (split /\s+/, $1) + { + if ($lib eq '$(libpq)') + { + foreach my $proj (@projects) + { + $proj->AddIncludeDir('src/interfaces/libpq'); + $proj->AddReference($libpq); + } + } + } + } + + if ($mf =~ /^PG_LIBS_INTERNAL\s*[+:]?=\s*(.*)$/mg) + { + foreach my $lib (split /\s+/, $1) + { + if ($lib eq '$(libpq_pgport)') + { + foreach my $proj (@projects) + { + $proj->AddReference($libpgport); + $proj->AddReference($libpgcommon); + } + } + } + } + + foreach my $line (split /\n/, $mf) + { + if ($line =~ /^[A-Za-z0-9_]*\.o:\s(.*)/) + { + foreach my $file (split /\s+/, $1) + { + foreach my $proj (@projects) + { + $proj->AddDependantFiles("$subdir/$n/$file"); + } + } } } diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm index f1c93a3fa32..aec922279df 100644 --- a/src/tools/msvc/Project.pm +++ b/src/tools/msvc/Project.pm @@ -47,10 +47,19 @@ sub AddFile { my ($self, $filename) = @_; + $self->FindAndAddAdditionalFiles($filename); $self->{files}->{$filename} = 1; return; } +sub AddDependantFiles +{ + my ($self, $filename) = @_; + + $self->FindAndAddAdditionalFiles($filename); + return; +} + sub AddFiles { my $self = shift; @@ -63,6 +72,34 @@ sub AddFiles return; } +# Handle Makefile rules by searching for other files which exist with the same +# name but a different file extension and add those files too. +sub FindAndAddAdditionalFiles +{ + my $self = shift; + my $fname = shift; + $fname =~ /(.*)(\.[^.]+)$/; + my $filenoext = $1; + my $fileext = $2; + + # For .c files, check if either a .l or .y file of the same name + # exists and add that too. + if ($fileext eq ".c") + { + my $file = $filenoext . ".l"; + if (-e $file) + { + $self->AddFile($file); + } + + $file = $filenoext . ".y"; + if (-e $file) + { + $self->AddFile($file); + } + } +} + sub ReplaceFile { my ($self, $filename, $newname) = @_; |