Compile from source using latest Microsoft Windows SDK - Mailing list pgsql-hackers

From Peifeng Qiu
Subject Compile from source using latest Microsoft Windows SDK
Date
Msg-id CABmtVJhw1boP_bd4=b3Qv5YnqEdL696NtHFi2ruiyQ6mFHkeQQ@mail.gmail.com
Whole thread Raw
Responses Re: Compile from source using latest Microsoft Windows SDK
List pgsql-hackers
Hi, hackers.

The current Windows build system supports compiling with Windows SDK up to v8.1. When building with the latest Windows SDK v10 which is the default for Visual Studio 2017, we will get the following error:

error MSB8036: The Windows SDK version 8.1 was not found.

When the build system generates projects files for MSBuild to consume, it doesn't include a SDK version number. Then MSBuild will assume v8.1 as default.
But if we only install the latest v10 but not v8.1, MSBuild will error out.

If we open the Visual Studio solution and manually chooses the correct Windows SDK version in project property dialog, it will compile without problem.
By doing this, we actually add a "WindowsTargetPlatformVersion" element in the vcxproj xml file, under "Global" property group like this:

  <PropertyGroup Label="Globals">
    <ProjectGuid>{E0F9C6B0-1947-4EBE-9848-9AB367FFC49E}</ProjectGuid>
    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
  </PropertyGroup>

So if we add WindowsTargetPlatformVersion to every project the whole pgsql solution will compile.
The SDK version number can be obtained from "WindowsSDKVersion" environment variable.
This is setup when you start with the Visual Studio Command Prompt.
Attached a patch to fix the build system.

Best regards,
Peifeng Qiu
Attachment

pgsql-hackers by date:

Previous
From: Adrien NAYRAT
Date:
Subject: Re: clean up docs for log_statement_sample_rate
Next
From: Alvaro Herrera
Date:
Subject: Re: monitoring CREATE INDEX [CONCURRENTLY]