Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76ad244

Browse files
committed
Remove some special cases from MSVC build scripts
Here we add additional parsing of Makefiles to determine when to addreferences to libpgport and libpgcommon. We also remove the need foradding the current contrib_extrasource by adding sine very basic logic toimplement the Makefile rules which add .l and .y files when they exist fora given .o file in the Makefile.This is just some very basic additional parsing of Makefiles to try tokeep things more consistent between builds using make and MSVC builds.This happens to work with how our current Makefiles are laid out, but itcould easily be broken in the future if someone chooses do something inthe Makefile that we don't have parsing support for. We will cross thatbridge when we come to it.Author: David RowleyDiscussion:https://postgr.es/m/CAApHDvoPULi5JW3933NxgwxOmu9Ncvpcyt87UhEHAUX16QqmpA@mail.gmail.com
1 parentdeb6ffd commit76ad244

File tree

2 files changed

+97
-9
lines changed

2 files changed

+97
-9
lines changed

‎src/tools/msvc/Mkvcbuild.pm‎

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,12 @@ my @unlink_on_exit;
3636

3737
# Set of variables for modules in contrib/ and src/test/modules/
3838
my$contrib_defines = {};
39-
my@contrib_uselibpq =
40-
('dblink','oid2name','postgres_fdw','vacuumlo','libpq_pipeline');
41-
my@contrib_uselibpgport = ('libpq_pipeline','oid2name','vacuumlo');
42-
my@contrib_uselibpgcommon = ('libpq_pipeline','oid2name','vacuumlo');
39+
my@contrib_uselibpq = ();
40+
my@contrib_uselibpgport = ();
41+
my@contrib_uselibpgcommon = ();
4342
my$contrib_extralibs = {'libpq_pipeline'=> ['ws2_32.lib'] };
44-
my$contrib_extraincludes = {};
45-
my$contrib_extrasource = {
46-
'cube'=> ['contrib/cube/cubescan.l','contrib/cube/cubeparse.y' ],
47-
'seg'=> ['contrib/seg/segscan.l','contrib/seg/segparse.y' ],
48-
};
43+
my$contrib_extraincludes = {};
44+
my$contrib_extrasource = {};
4945
my@contrib_excludes = (
5046
'bool_plperl','commit_ts',
5147
'hstore_plperl','hstore_plpython',
@@ -1010,6 +1006,61 @@ sub AddContrib
10101006
$proj->AddDefine($1);
10111007
}
10121008
}
1009+
elsif ($flag =~/^-I(.*)$/)
1010+
{
1011+
if ($1eq'$(libpq_srcdir)')
1012+
{
1013+
foreachmy$proj (@projects)
1014+
{
1015+
$proj->AddIncludeDir('src/interfaces/libpq');
1016+
$proj->AddReference($libpq);
1017+
}
1018+
}
1019+
}
1020+
}
1021+
}
1022+
1023+
if ($mf =~/^SHLIB_LINK_INTERNAL\s*[+:]?=\s*(.*)$/mg)
1024+
{
1025+
foreachmy$lib (split /\s+/,$1)
1026+
{
1027+
if ($libeq'$(libpq)')
1028+
{
1029+
foreachmy$proj (@projects)
1030+
{
1031+
$proj->AddIncludeDir('src/interfaces/libpq');
1032+
$proj->AddReference($libpq);
1033+
}
1034+
}
1035+
}
1036+
}
1037+
1038+
if ($mf =~/^PG_LIBS_INTERNAL\s*[+:]?=\s*(.*)$/mg)
1039+
{
1040+
foreachmy$lib (split /\s+/,$1)
1041+
{
1042+
if ($libeq'$(libpq_pgport)')
1043+
{
1044+
foreachmy$proj (@projects)
1045+
{
1046+
$proj->AddReference($libpgport);
1047+
$proj->AddReference($libpgcommon);
1048+
}
1049+
}
1050+
}
1051+
}
1052+
1053+
foreachmy$line (split /\n/,$mf)
1054+
{
1055+
if ($line =~/^[A-Za-z0-9_]*\.o:\s(.*)/)
1056+
{
1057+
foreachmy$file (split /\s+/,$1)
1058+
{
1059+
foreachmy$proj (@projects)
1060+
{
1061+
$proj->AddDependantFiles("$subdir/$n/$file");
1062+
}
1063+
}
10131064
}
10141065
}
10151066

‎src/tools/msvc/Project.pm‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,19 @@ sub AddFile
4747
{
4848
my ($self,$filename) =@_;
4949

50+
$self->FindAndAddAdditionalFiles($filename);
5051
$self->{files}->{$filename} = 1;
5152
return;
5253
}
5354

55+
subAddDependantFiles
56+
{
57+
my ($self,$filename) =@_;
58+
59+
$self->FindAndAddAdditionalFiles($filename);
60+
return;
61+
}
62+
5463
subAddFiles
5564
{
5665
my$self =shift;
@@ -63,6 +72,34 @@ sub AddFiles
6372
return;
6473
}
6574

75+
# Handle Makefile rules by searching for other files which exist with the same
76+
# name but a different file extension and add those files too.
77+
subFindAndAddAdditionalFiles
78+
{
79+
my$self =shift;
80+
my$fname =shift;
81+
$fname =~/(.*)(\.[^.]+)$/;
82+
my$filenoext =$1;
83+
my$fileext =$2;
84+
85+
# For .c files, check if either a .l or .y file of the same name
86+
# exists and add that too.
87+
if ($fileexteq".c")
88+
{
89+
my$file =$filenoext .".l";
90+
if (-e$file)
91+
{
92+
$self->AddFile($file);
93+
}
94+
95+
$file =$filenoext .".y";
96+
if (-e$file)
97+
{
98+
$self->AddFile($file);
99+
}
100+
}
101+
}
102+
66103
subReplaceFile
67104
{
68105
my ($self,$filename,$newname) =@_;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp