1<?xml version="1.0" encoding="utf-8"?> 2<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="Py_IntDir"> 3 <Import Project="python.props" Condition="$(__Python_Props_Imported) != 'true'" /> 4 <PropertyGroup Label="Globals"> 5 <__PyProject_Props_Imported>true</__PyProject_Props_Imported> 6 <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> 7 <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> 8 <OutDir>$(BuildPath)</OutDir> 9 <OutDir Condition="!HasTrailingSlash($(OutDir))">$(OutDir)\</OutDir> 10 <Py_IntDir Condition="'$(Py_IntDir)' == ''">$(MSBuildThisFileDirectory)obj\</Py_IntDir> 11 <IntDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir> 12 <IntDir>$(IntDir.Replace(`\\`, `\`))</IntDir> 13 <TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName> 14 <TargetName>$(TargetName)$(PyDebugExt)</TargetName> 15 <GenerateManifest>false</GenerateManifest> 16 <EmbedManifest>false</EmbedManifest> 17 <SupportPGO Condition="'$(SupportPGO)' == ''">true</SupportPGO> 18 <SupportSigning Condition="'$(SupportSigning)' == ''">true</SupportSigning> 19 <SupportSigning Condition="'$(Configuration)' == 'Debug'">false</SupportSigning> 20 <SupportSigning Condition="'$(ConfigurationType)' == 'StaticLibrary'">false</SupportSigning> 21 </PropertyGroup> 22 23 <PropertyGroup> 24 <_DebugPreprocessorDefinition>NDEBUG;</_DebugPreprocessorDefinition> 25 <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG;</_DebugPreprocessorDefinition> 26 <_PlatformPreprocessorDefinition>_WIN32;</_PlatformPreprocessorDefinition> 27 <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;_M_X64;</_PlatformPreprocessorDefinition> 28 <_PydPreprocessorDefinition Condition="$(TargetExt) == '.pyd'">Py_BUILD_CORE_MODULE;</_PydPreprocessorDefinition> 29 <_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)";</_Py3NamePreprocessorDefinition> 30 </PropertyGroup> 31 <ItemDefinitionGroup> 32 <ClCompile> 33 <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 34 <PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions> 35 36 <Optimization>MaxSpeed</Optimization> 37 <IntrinsicFunctions>true</IntrinsicFunctions> 38 <StringPooling>true</StringPooling> 39 <ExceptionHandling></ExceptionHandling> 40 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> 41 <FunctionLevelLinking>true</FunctionLevelLinking> 42 <WarningLevel>Level3</WarningLevel> 43 <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> 44 <CompileAs>Default</CompileAs> 45 <SuppressStartupBanner>true</SuppressStartupBanner> 46 <WholeProgramOptimization>true</WholeProgramOptimization> 47 <ControlFlowGuard Condition="$(EnableControlFlowGuard) != ''">$(EnableControlFlowGuard)</ControlFlowGuard> 48 <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> 49 </ClCompile> 50 <ClCompile Condition="$(Configuration) == 'Debug'"> 51 <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> 52 <Optimization>Disabled</Optimization> 53 <WholeProgramOptimization>false</WholeProgramOptimization> 54 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> 55 </ClCompile> 56 <ClCompile Condition="$(ICCBuild) == 'true'"> 57 <FloatingPointModel>Strict</FloatingPointModel> 58 </ClCompile> 59 <Link> 60 <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 61 <GenerateDebugInformation>true</GenerateDebugInformation> 62 <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> 63 <SubSystem>Windows</SubSystem> 64 <RandomizedBaseAddress>true</RandomizedBaseAddress> 65 <DataExecutionPrevention>true</DataExecutionPrevention> 66 <SuppressStartupBanner>true</SuppressStartupBanner> 67 <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> 68 <TargetMachine>MachineX86</TargetMachine> 69 <TargetMachine Condition="'$(Platform)' == 'x64'">MachineX64</TargetMachine> 70 <TargetMachine Condition="'$(Platform)'=='ARM'">MachineARM</TargetMachine> 71 <TargetMachine Condition="'$(Platform)'=='ARM64'">MachineARM64</TargetMachine> 72 <ProfileGuidedDatabase Condition="$(SupportPGO)">$(OutDir)$(TargetName).pgd</ProfileGuidedDatabase> 73 <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> 74 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">PGInstrument</LinkTimeCodeGeneration> 75 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">PGUpdate</LinkTimeCodeGeneration> 76 <AdditionalDependencies>advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;%(AdditionalDependencies)</AdditionalDependencies> 77 <AdditionalOptions Condition="$(Configuration) != 'Debug'">/OPT:REF,NOICF %(AdditionalOptions)</AdditionalOptions> 78 </Link> 79 <Lib> 80 <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">true</LinkTimeCodeGeneration> 81 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">true</LinkTimeCodeGeneration> 82 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">true</LinkTimeCodeGeneration> 83 </Lib> 84 <ResourceCompile> 85 <AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 86 <PreprocessorDefinitions>ORIGINAL_FILENAME=\"$(TargetName)$(TargetExt)\";FIELD3=$(Field3Value);$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions> 87 <Culture>0x0409</Culture> 88 </ResourceCompile> 89 <Midl> 90 <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions> 91 <MkTypLibCompatible>true</MkTypLibCompatible> 92 <SuppressStartupBanner>true</SuppressStartupBanner> 93 <TargetEnvironment>Win32</TargetEnvironment> 94 <TargetEnvironment Condition="'$(Platform)' == 'x64'">X64</TargetEnvironment> 95 <OutputDirectory>$(IntDir)</OutputDirectory> 96 <InterfaceIdentifierFileName>$(MSBuildProjectName)_i.c</InterfaceIdentifierFileName> 97 <ProxyFileName>$(MSBuildProjectName)_p.c</ProxyFileName> 98 </Midl> 99 </ItemDefinitionGroup> 100 101 <UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> 102 <ParameterGroup> 103 <FileName Required="true" /> 104 </ParameterGroup> 105 <Task> 106 <Using Namespace="System.Diagnostics"/> 107 <Using Namespace="System.IO"/> 108 <Using Namespace="System.Runtime.InteropServices"/> 109 <Using Namespace="System.Text"/> 110 <Code Type="Method" Language="cs"> 111<![CDATA[ 112[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Unicode)] 113public static extern bool QueryFullProcessImageName([In]IntPtr hProcess, [In]int dwFlags, 114 [Out]StringBuilder lpExeName, ref int lpdwSize); 115public override bool Execute() { 116 string fullPath = Path.GetFullPath(FileName); 117 Log.LogMessage("Looking for " + fullPath, MessageImportance.Normal); 118 foreach (Process p in Process.GetProcesses()) { 119 try { 120 int pathLength = 32768; 121 StringBuilder pathBuilder = new StringBuilder(pathLength); 122 if (QueryFullProcessImageName(p.Handle, 0, pathBuilder, ref pathLength)) { 123 string exeName = Path.GetFullPath(pathBuilder.ToString()); 124 Log.LogMessage("Found running process: " + exeName, MessageImportance.Low); 125 if (fullPath.Equals(exeName, StringComparison.OrdinalIgnoreCase)) { 126 Log.LogMessage("Terminating " + exeName, MessageImportance.High); 127 p.Kill(); 128 } 129 } 130 } catch { 131 } 132 } 133 return true; 134} 135]]> 136 </Code> 137 </Task> 138 </UsingTask> 139 140 <Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'"> 141 <Message Text="Killing any running python$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" /> 142 <KillPython FileName="$(OutDir)python$(PyDebugExt)$(PyTestExt).exe" /> 143 </Target> 144 145 <!-- 146 A default target to handle msbuild pcbuild.proj /t:CleanAll. 147 148 Some externals projects don't respond to /t:Clean, so we invoke 149 CleanAll on them when we really want to clean up. 150 --> 151 <Target Name="CleanAll" DependsOnTargets="Clean"> 152 <MSBuild Projects="@(ProjectReference->'%(FullPath)')" 153 Properties="Configuration=$(Configuration);Platform=$(Platform)" 154 BuildInParallel="true" 155 StopOnFirstFailure="false" 156 Condition="Exists(%(FullPath))" 157 Targets="CleanAll" /> 158 </Target> 159 160 <Target Name="CopyPGCFiles" BeforeTargets="PrepareForBuild" Condition="$(Configuration) == 'PGUpdate'"> 161 <ItemGroup> 162 <_PGCFiles Include="$(OutDir)instrumented\$(TargetName)!*.pgc" /> 163 <_PGDFile Include="$(OutDir)instrumented\$(TargetName).pgd" /> 164 <_CopyFiles Include="@(_PGCFiles);@(_PGDFile)" Condition="Exists(%(FullPath))" /> 165 </ItemGroup> 166 <Delete Files="@(_CopyFiles->'$(OutDir)%(Filename)%(Extension)')" /> 167 <Error Text="PGO run did not succeed (no $(TargetName)!*.pgc files) and there is no data to merge" 168 Condition="$(RequirePGCFiles) == 'true' and @(_PGCFiles) == ''" /> 169 <Copy SourceFiles="@(_CopyFiles)" 170 DestinationFolder="$(OutDir)" 171 UseHardLinksIfPossible="true" 172 OverwriteReadOnlyFiles="true" /> 173 </Target> 174 175 <PropertyGroup> 176 <SdkBinPath Condition="'$(SdkBinPath)' == '' or !Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\$(DefaultWindowsSDKVersion)\x86</SdkBinPath> 177 <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86</SdkBinPath> 178 <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86</SdkBinPath> 179 <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86</SdkBinPath> 180 <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\</SdkBinPath> 181 <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /a /n "$(SigningCertificate)" /fd sha256 /tr http://timestamp.digicert.com/ /td sha256 /d "Python $(PythonVersion)"</_SignCommand> 182 <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificateSha1)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /a /sha1 "$(SigningCertificateSha1)" /fd sha256 /tr http://timestamp.digicert.com/ /td sha256 /d "Python $(PythonVersion)"</_SignCommand> 183 <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe"</_MakeCatCommand> 184 </PropertyGroup> 185 186 <Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(_SignCommand)' != '' and $(SupportSigning)"> 187 <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> 188 <Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" /> 189 </Target> 190 191 192 <Target Name="FindVCRedistDir"> 193 <!-- Hard coded path for VS 2015 --> 194 <PropertyGroup Condition="$(PlatformToolset) == 'v140'"> 195 <VCRedistDir>$(VCInstallDir)\redist\</VCRedistDir> 196 </PropertyGroup> 197 198 <!-- Search for version number in some broken Build Tools installs --> 199 <ItemGroup Condition="$(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''"> 200 <_RedistFiles Include="$(VCInstallDir)\Redist\MSVC\*\*.*" /> 201 </ItemGroup> 202 <PropertyGroup Condition="$(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''"> 203 <_RedistDir>%(_RedistFiles.Directory)</_RedistDir> 204 <VCToolsRedistVersion>$([System.IO.Path]::GetFileName($(_RedistDir.Trim(`\`))))</VCToolsRedistVersion> 205 </PropertyGroup> 206 207 <!-- Use correct path for VS 2017 and later --> 208 <PropertyGroup Condition="$(VCRedistDir) == ''"> 209 <VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir> 210 </PropertyGroup> 211 212 <PropertyGroup> 213 <VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir> 214 <VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir> 215 </PropertyGroup> 216 217 <Message Text="VC Redist Directory: $(VCRedistDir)" /> 218 <Message Text="VC Redist Version: $(VCToolsRedistVersion)" /> 219 </Target> 220 221 <Target Name="FindVCRuntime" Returns="VCRuntimeDLL" DependsOnTargets="FindVCRedistDir"> 222 <ItemGroup Condition="$(VCInstallDir) != ''"> 223 <VCRuntimeDLL Include="$(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" /> 224 </ItemGroup> 225 226 <Warning Text="vcruntime*.dll not found under $(VCRedistDir)." Condition="@(VCRuntimeDLL) == ''" /> 227 <Message Text="VC Runtime DLL(s):%0A- @(VCRuntimeDLL,'%0A- ')" /> 228 </Target> 229</Project> 230