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