From 72e1ee3fb5f926b54e9502522b05605fc0b235c7 Mon Sep 17 00:00:00 2001
From: Takashi Menjo <takashi.menjou.vg@hco.ntt.co.jp>
Date: Fri, 5 Nov 2021 14:16:33 +0900
Subject: [PATCH v6 02/11] Support build with MSVC on Windows

---
 src/tools/msvc/Solution.pm       | 13 +++++++++++++
 src/tools/msvc/config_default.pl |  3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 2c8cd521e9..d843391050 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -304,6 +304,7 @@ sub GenerateFiles
 		HAVE_LIBLZ4                                 => undef,
 		HAVE_LIBM                                   => undef,
 		HAVE_LIBPAM                                 => undef,
+		HAVE_LIBPMEM                                => undef,
 		HAVE_LIBREADLINE                            => undef,
 		HAVE_LIBSELINUX                             => undef,
 		HAVE_LIBSSL                                 => undef,
@@ -488,6 +489,7 @@ sub GenerateFiles
 		USE_BONJOUR         => undef,
 		USE_BSD_AUTH        => undef,
 		USE_ICU => $self->{options}->{icu} ? 1 : undef,
+		USE_LIBPMEM                => undef,
 		USE_LIBXML                 => undef,
 		USE_LIBXSLT                => undef,
 		USE_LZ4                    => undef,
@@ -538,6 +540,11 @@ sub GenerateFiles
 		$define{HAVE_LZ4_H}  = 1;
 		$define{USE_LZ4}     = 1;
 	}
+	if ($self->{options}->{pmem})
+	{
+		$define{HAVE_LIBPMEM} = 1;
+		$define{USE_LIBPMEM}  = 1;
+	}
 	if ($self->{options}->{openssl})
 	{
 		$define{USE_OPENSSL} = 1;
@@ -1085,6 +1092,11 @@ sub AddProject
 		$proj->AddIncludeDir($self->{options}->{uuid} . '\include');
 		$proj->AddLibrary($self->{options}->{uuid} . '\lib\uuid.lib');
 	}
+	if ($self->{options}->{pmem})
+	{
+		$proj->AddIncludeDir($self->{options}->{pmem} . '\include');
+		$proj->AddLibrary($self->{options}->{pmem} . '\lib\libpmem.lib');
+	}
 	return $proj;
 }
 
@@ -1197,6 +1209,7 @@ sub GetFakeConfigure
 	$cfg .= ' --with-tcl'           if ($self->{options}->{tcl});
 	$cfg .= ' --with-perl'          if ($self->{options}->{perl});
 	$cfg .= ' --with-python'        if ($self->{options}->{python});
+	$cfg .= ' --with-libpmem'       if ($self->{options}->{pmem});
 	my $port = $self->{options}->{'--with-pgport'};
 	$cfg .= " --with-pgport=$port" if defined($port);
 
diff --git a/src/tools/msvc/config_default.pl b/src/tools/msvc/config_default.pl
index 460c0375d4..774730c9a8 100644
--- a/src/tools/msvc/config_default.pl
+++ b/src/tools/msvc/config_default.pl
@@ -25,7 +25,8 @@ our $config = {
 	xml       => undef,    # --with-libxml=<path>
 	xslt      => undef,    # --with-libxslt=<path>
 	iconv     => undef,    # (not in configure, path to iconv)
-	zlib      => undef     # --with-zlib=<path>
+	zlib      => undef,    # --with-zlib=<path>
+	pmem      => undef     # --with-libpmem=<path>
 };
 
 1;
-- 
2.25.1

