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)\$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
10    <TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
11    <TargetName>$(TargetName)$(PyDebugExt)</TargetName>
12    <GenerateManifest>false</GenerateManifest>
13    <EmbedManifest>false</EmbedManifest>
14    <SupportPGO Condition="'$(SupportPGO)' == ''">true</SupportPGO>
15    <SupportSigning Condition="'$(SupportSigning)' == ''">true</SupportSigning>
16    <SupportSigning Condition="'$(Configuration)' == 'Debug'">false</SupportSigning>
17    <SupportSigning Condition="'$(ConfigurationType)' == 'StaticLibrary'">false</SupportSigning>
18  </PropertyGroup>
19
20  <PropertyGroup>
21    <_DebugPreprocessorDefinition>NDEBUG;</_DebugPreprocessorDefinition>
22    <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG;</_DebugPreprocessorDefinition>
23    <_PlatformPreprocessorDefinition>_WIN32;</_PlatformPreprocessorDefinition>
24    <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;_M_X64;</_PlatformPreprocessorDefinition>
25    <_PydPreprocessorDefinition Condition="$(TargetExt) == '.pyd'">Py_BUILD_CORE_MODULE;</_PydPreprocessorDefinition>
26  </PropertyGroup>
27  <ItemDefinitionGroup>
28    <ClCompile>
29      <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
30      <PreprocessorDefinitions>WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
31
32      <Optimization>MaxSpeed</Optimization>
33      <IntrinsicFunctions>true</IntrinsicFunctions>
34      <StringPooling>true</StringPooling>
35      <ExceptionHandling></ExceptionHandling>
36      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
37      <FunctionLevelLinking>true</FunctionLevelLinking>
38      <WarningLevel>Level3</WarningLevel>
39      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
40      <CompileAs>Default</CompileAs>
41      <SuppressStartupBanner>true</SuppressStartupBanner>
42      <WholeProgramOptimization>true</WholeProgramOptimization>
43      <EnableEnhancedInstructionSet Condition="'$(Platform)'=='Win32'">NoExtensions</EnableEnhancedInstructionSet>
44    </ClCompile>
45    <ClCompile Condition="$(Configuration) == 'Debug'">
46      <Optimization>Disabled</Optimization>
47      <WholeProgramOptimization>false</WholeProgramOptimization>
48      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
49    </ClCompile>
50    <ClCompile Condition="$(ICCBuild) == 'true'">
51      <FloatingPointModel>Strict</FloatingPointModel>
52    </ClCompile>
53    <Link>
54      <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
55      <GenerateDebugInformation>true</GenerateDebugInformation>
56      <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
57      <SubSystem>Windows</SubSystem>
58      <RandomizedBaseAddress>true</RandomizedBaseAddress>
59      <DataExecutionPrevention>true</DataExecutionPrevention>
60      <SuppressStartupBanner>true</SuppressStartupBanner>
61      <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
62      <TargetMachine>MachineX86</TargetMachine>
63      <TargetMachine Condition="'$(Platform)' == 'x64'">MachineX64</TargetMachine>
64      <ProfileGuidedDatabase Condition="$(SupportPGO)">$(OutDir)$(TargetName).pgd</ProfileGuidedDatabase>
65      <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
66      <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">PGInstrument</LinkTimeCodeGeneration>
67      <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">PGUpdate</LinkTimeCodeGeneration>
68    </Link>
69    <Lib>
70      <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">true</LinkTimeCodeGeneration>
71      <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">true</LinkTimeCodeGeneration>
72      <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">true</LinkTimeCodeGeneration>
73    </Lib>
74    <ResourceCompile>
75      <AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
76      <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
77      <Culture>0x0409</Culture>
78    </ResourceCompile>
79    <Midl>
80      <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
81      <MkTypLibCompatible>true</MkTypLibCompatible>
82      <SuppressStartupBanner>true</SuppressStartupBanner>
83      <TargetEnvironment>Win32</TargetEnvironment>
84      <TargetEnvironment Condition="'$(Platform)' == 'x64'">X64</TargetEnvironment>
85      <OutputDirectory>$(IntDir)</OutputDirectory>
86      <InterfaceIdentifierFileName>$(MSBuildProjectName)_i.c</InterfaceIdentifierFileName>
87      <ProxyFileName>$(MSBuildProjectName)_p.c</ProxyFileName>
88    </Midl>
89  </ItemDefinitionGroup>
90
91  <Target Name="GeneratePythonNtRcH"
92          BeforeTargets="ClCompile"
93          Inputs="$(PySourcePath)Include\patchlevel.h"
94          Outputs="$(IntDir)pythonnt_rc.h">
95    <WriteLinesToFile File="$(IntDir)pythonnt_rc.h" Overwrite="true" Encoding="ascii"
96                      Lines='/* This file created by pyproject.props /t:GeneratePythonNtRcH */
97#define FIELD3 $(Field3Value)
98#define MS_DLL_ID "$(SysWinVer)"
99#define PYTHON_DLL_NAME "$(TargetName)$(TargetExt)"
100' />
101    <ItemGroup>
102        <FileWrites Include="$(IntDir)pythonnt_rc.h" />
103    </ItemGroup>
104  </Target>
105
106  <UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
107    <ParameterGroup>
108      <FileName Required="true" />
109    </ParameterGroup>
110    <Task>
111      <Code Type="Fragment" Language="cs">
112<![CDATA[
113string fullPath = System.IO.Path.GetFullPath(FileName);
114Log.LogMessage("Looking for " + fullPath, MessageImportance.Normal);
115foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses()) {
116    try {
117        Log.LogMessage("Found running process: " + p.MainModule.FileName, MessageImportance.Low);
118        if (fullPath.Equals(System.IO.Path.GetFullPath(p.MainModule.FileName), StringComparison.OrdinalIgnoreCase)) {
119            Log.LogMessage("Terminating " + p.MainModule.FileName, MessageImportance.High);
120            p.Kill();
121        }
122    } catch {
123    }
124}
125]]>
126      </Code>
127    </Task>
128  </UsingTask>
129
130  <Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'">
131    <Message Text="Killing any running python$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" />
132    <KillPython FileName="$(OutDir)python$(PyDebugExt)$(PyTestExt).exe" />
133  </Target>
134
135  <!--
136  A default target to handle msbuild pcbuild.proj /t:CleanAll.
137
138  Some externals projects don't respond to /t:Clean, so we invoke
139  CleanAll on them when we really want to clean up.
140  -->
141  <Target Name="CleanAll" DependsOnTargets="Clean">
142    <MSBuild Projects="@(ProjectReference->'%(FullPath)')"
143             Properties="Configuration=$(Configuration);Platform=$(Platform)"
144             BuildInParallel="true"
145             StopOnFirstFailure="false"
146             Condition="Exists(%(FullPath))"
147             Targets="CleanAll" />
148  </Target>
149
150  <PropertyGroup>
151    <SdkBinPath Condition="'$(SdkBinPath)' == '' or !Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86</SdkBinPath>
152    <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86</SdkBinPath>
153    <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86</SdkBinPath>
154    <SdkBinPath Condition="!Exists($(SdkBinPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\</SdkBinPath>
155    <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand>
156    <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe"</_MakeCatCommand>
157  </PropertyGroup>
158
159  <Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
160    <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
161    <Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
162  </Target>
163</Project>