blob: c56292ab5eea4f81e9549eff27e44cbbfd099c14 [file] [log] [blame]
Brian Curtin401f9f32012-05-13 11:19:23 -05001<?xml version="1.0" encoding="utf-8"?>
Steve Dowerde9fb282015-07-27 14:56:58 -07002<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="Py_IntDir">
Steve Dower65e4cb12014-11-22 12:54:57 -08003 <PropertyGroup Label="Globals">
Stefan Krah318c56c2012-06-24 19:04:35 +02004 <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
Steve Dower65e4cb12014-11-22 12:54:57 -08005 <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
6 <OutDir>$(BuildPath)</OutDir>
Steve Dowerde9fb282015-07-27 14:56:58 -07007 <OutDir Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)</OutDir>
8 <OutDir Condition="!HasTrailingSlash($(OutDir))">$(OutDir)\</OutDir>
9 <Py_IntDir Condition="'$(Py_IntDir)' == ''">$(SolutionDir)obj\</Py_IntDir>
10 <IntDir Condition="!HasTrailingSlash($(IntDir))">$(IntDir)\</IntDir>
11 <IntDir>$(Py_IntDir)\$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
12 <IntDir Condition="$(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate'">$(Py_IntDir)\$(ArchName)_PGO\$(ProjectName)\</IntDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080013 <TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
14 <TargetName>$(TargetName)$(PyDebugExt)</TargetName>
15 <GenerateManifest>false</GenerateManifest>
16 <EmbedManifest>false</EmbedManifest>
17 <SupportPGO Condition="'$(SupportPGO)' == ''">true</SupportPGO>
Steve Dowerbb240872015-02-05 22:08:48 -080018 <SupportSigning Condition="'$(SupportSigning)' == ''">true</SupportSigning>
19 <SupportSigning Condition="'$(Configuration)' == 'Debug'">false</SupportSigning>
20 <SupportSigning Condition="'$(ConfigurationType)' == 'StaticLibrary'">false</SupportSigning>
Zachary Ware6373ba52014-03-17 15:57:38 -050021 </PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -080022
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>
Brian Curtin401f9f32012-05-13 11:19:23 -050029 </PropertyGroup>
Brian Curtin401f9f32012-05-13 11:19:23 -050030 <ItemDefinitionGroup>
31 <ClCompile>
Steve Dower65e4cb12014-11-22 12:54:57 -080032 <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
33 <PreprocessorDefinitions>WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
34
Brian Curtin401f9f32012-05-13 11:19:23 -050035 <Optimization>MaxSpeed</Optimization>
Brian Curtin401f9f32012-05-13 11:19:23 -050036 <IntrinsicFunctions>true</IntrinsicFunctions>
Brian Curtin401f9f32012-05-13 11:19:23 -050037 <StringPooling>true</StringPooling>
Steve Dower65e4cb12014-11-22 12:54:57 -080038 <ExceptionHandling></ExceptionHandling>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070039 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
Brian Curtin401f9f32012-05-13 11:19:23 -050040 <FunctionLevelLinking>true</FunctionLevelLinking>
41 <WarningLevel>Level3</WarningLevel>
42 <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
43 <CompileAs>Default</CompileAs>
Steve Dower65e4cb12014-11-22 12:54:57 -080044 <SuppressStartupBanner>true</SuppressStartupBanner>
45 <WholeProgramOptimization>true</WholeProgramOptimization>
Steve Dower5700ae82015-10-11 15:15:52 -070046 <EnableEnhancedInstructionSet Condition="'$(Platform)'=='Win32'">NoExtensions</EnableEnhancedInstructionSet>
Steve Dower65e4cb12014-11-22 12:54:57 -080047 </ClCompile>
48 <ClCompile Condition="$(Configuration) == 'Debug'">
49 <Optimization>Disabled</Optimization>
50 <WholeProgramOptimization>false</WholeProgramOptimization>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070051 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
Brian Curtin401f9f32012-05-13 11:19:23 -050052 </ClCompile>
Zachary Ware4c5ad942016-01-29 19:08:55 -060053 <ClCompile Condition="$(ICCBuild) == 'true'">
54 <FloatingPointModel>Strict</FloatingPointModel>
55 </ClCompile>
Brian Curtin401f9f32012-05-13 11:19:23 -050056 <Link>
57 <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
58 <GenerateDebugInformation>true</GenerateDebugInformation>
59 <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
60 <SubSystem>Windows</SubSystem>
Christian Heimesf3bf35e2013-11-20 17:43:23 +010061 <RandomizedBaseAddress>true</RandomizedBaseAddress>
62 <DataExecutionPrevention>true</DataExecutionPrevention>
Steve Dower65e4cb12014-11-22 12:54:57 -080063 <SuppressStartupBanner>true</SuppressStartupBanner>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070064 <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
Brian Curtin401f9f32012-05-13 11:19:23 -050065 <TargetMachine>MachineX86</TargetMachine>
Steve Dower65e4cb12014-11-22 12:54:57 -080066 <TargetMachine Condition="'$(Platform)' == 'x64'">MachineX64</TargetMachine>
67 <ProfileGuidedDatabase Condition="$(SupportPGO)">$(OutDir)$(TargetName).pgd</ProfileGuidedDatabase>
68 <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
69 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">PGInstrument</LinkTimeCodeGeneration>
70 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">PGUpdate</LinkTimeCodeGeneration>
Brian Curtin401f9f32012-05-13 11:19:23 -050071 </Link>
Steve Dower65e4cb12014-11-22 12:54:57 -080072 <Lib>
73 <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">true</LinkTimeCodeGeneration>
74 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">true</LinkTimeCodeGeneration>
75 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">true</LinkTimeCodeGeneration>
76 </Lib>
Brian Curtin401f9f32012-05-13 11:19:23 -050077 <ResourceCompile>
Steve Dowerb0660582016-04-06 12:35:24 -070078 <AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Steve Dower65e4cb12014-11-22 12:54:57 -080079 <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
80 <Culture>0x0409</Culture>
Brian Curtin401f9f32012-05-13 11:19:23 -050081 </ResourceCompile>
Steve Dower65e4cb12014-11-22 12:54:57 -080082 <Midl>
83 <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
84 <MkTypLibCompatible>true</MkTypLibCompatible>
85 <SuppressStartupBanner>true</SuppressStartupBanner>
86 <TargetEnvironment>Win32</TargetEnvironment>
87 <TargetEnvironment Condition="'$(Platform)' == 'x64'">X64</TargetEnvironment>
88 <TypeLibraryName>$(OutDir)wininst.tlb</TypeLibraryName>
89 <HeaderFileName>
90 </HeaderFileName>
91 </Midl>
Brian Curtin401f9f32012-05-13 11:19:23 -050092 </ItemDefinitionGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -080093
94 <Target Name="GeneratePythonNtRcH"
Steve Dowerb0660582016-04-06 12:35:24 -070095 BeforeTargets="ClCompile"
Steve Dower65e4cb12014-11-22 12:54:57 -080096 Inputs="$(PySourcePath)Include\patchlevel.h"
Steve Dowerb0660582016-04-06 12:35:24 -070097 Outputs="$(IntDir)pythonnt_rc.h">
98 <WriteLinesToFile File="$(IntDir)pythonnt_rc.h" Overwrite="true" Encoding="ascii"
99 Lines='/* This file created by pyproject.props /t:GeneratePythonNtRcH */
Steve Dower65e4cb12014-11-22 12:54:57 -0800100#define FIELD3 $(Field3Value)
Steve Dower25879522015-01-15 09:10:16 -0800101#define MS_DLL_ID "$(SysWinVer)"
Steve Dowerb0660582016-04-06 12:35:24 -0700102#define PYTHON_DLL_NAME "$(TargetName)$(TargetExt)"
Steve Dower65e4cb12014-11-22 12:54:57 -0800103' />
104 <ItemGroup>
Steve Dowerb0660582016-04-06 12:35:24 -0700105 <FileWrites Include="$(IntDir)pythonnt_rc.h" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800106 </ItemGroup>
107 </Target>
108
109 <UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
110 <ParameterGroup>
111 <FileName Required="true" />
112 </ParameterGroup>
113 <Task>
114 <Code Type="Fragment" Language="cs">
115<![CDATA[
116string fullPath = System.IO.Path.GetFullPath(FileName);
117Log.LogMessage("Looking for " + fullPath, MessageImportance.Normal);
118foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses()) {
119 try {
120 Log.LogMessage("Found running process: " + p.MainModule.FileName, MessageImportance.Low);
121 if (fullPath.Equals(System.IO.Path.GetFullPath(p.MainModule.FileName), StringComparison.OrdinalIgnoreCase)) {
122 Log.LogMessage("Terminating " + p.MainModule.FileName, MessageImportance.High);
123 p.Kill();
124 }
125 } catch {
126 }
127}
128]]>
129 </Code>
130 </Task>
131 </UsingTask>
Steve Dower10e65852014-12-12 12:18:11 -0800132
Steve Dowerf4f10802014-12-12 13:45:25 -0800133 <Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'">
Steve Dower940f6a82015-10-31 12:17:11 -0700134 <Message Text="Killing any running python$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" />
135 <KillPython FileName="$(OutDir)python$(PyDebugExt)$(PyTestExt).exe" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800136 </Target>
137
138 <!--
139 A default target to handle msbuild pcbuild.proj /t:CleanAll.
140
141 Some externals projects don't respond to /t:Clean, so we invoke
142 CleanAll on them when we really want to clean up.
143 -->
144 <Target Name="CleanAll" DependsOnTargets="Clean">
145 <MSBuild Projects="@(ProjectReference->'%(FullPath)')"
146 Properties="Configuration=$(Configuration);Platform=$(Platform)"
147 BuildInParallel="true"
148 StopOnFirstFailure="false"
149 Condition="Exists(%(FullPath))"
150 Targets="CleanAll" />
151 </Target>
Steve Dowerbb240872015-02-05 22:08:48 -0800152
153 <PropertyGroup Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
154 <SignToolPath Condition="'$(SignToolPath)' == '' or !Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86\signtool.exe</SignToolPath>
155 <SignToolPath Condition="!Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86\signtool.exe</SignToolPath>
156 <SignToolPath Condition="!Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\signtool.exe</SignToolPath>
Steve Dower84d9fe32016-02-08 09:24:46 -0800157 <_SignCommand Condition="Exists($(SignToolPath))">"$(SignToolPath)" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand>
Steve Dowerbb240872015-02-05 22:08:48 -0800158 </PropertyGroup>
159
160 <Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
161 <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
162 <Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
163 </Target>
Zachary Warea191b912014-03-21 22:58:19 -0500164</Project>