blob: a3a9c2be64ba817ca34ba9577ef0fe192fb883c0 [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="!HasTrailingSlash($(OutDir))">$(OutDir)\</OutDir>
Steve Dower6fd76bc2016-07-16 16:13:19 -07008 <Py_IntDir Condition="'$(PyIntDir)' == ''">$(SolutionDir)obj\</Py_IntDir>
Steve Dowerde9fb282015-07-27 14:56:58 -07009 <IntDir>$(Py_IntDir)\$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
10 <IntDir Condition="$(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate'">$(Py_IntDir)\$(ArchName)_PGO\$(ProjectName)\</IntDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080011 <TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
12 <TargetName>$(TargetName)$(PyDebugExt)</TargetName>
13 <GenerateManifest>false</GenerateManifest>
14 <EmbedManifest>false</EmbedManifest>
15 <SupportPGO Condition="'$(SupportPGO)' == ''">true</SupportPGO>
Steve Dowerbb240872015-02-05 22:08:48 -080016 <SupportSigning Condition="'$(SupportSigning)' == ''">true</SupportSigning>
17 <SupportSigning Condition="'$(Configuration)' == 'Debug'">false</SupportSigning>
18 <SupportSigning Condition="'$(ConfigurationType)' == 'StaticLibrary'">false</SupportSigning>
Zachary Ware6373ba52014-03-17 15:57:38 -050019 </PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -080020
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>
Brian Curtin401f9f32012-05-13 11:19:23 -050027 </PropertyGroup>
Brian Curtin401f9f32012-05-13 11:19:23 -050028 <ItemDefinitionGroup>
29 <ClCompile>
Steve Dower6fd76bc2016-07-16 16:13:19 -070030 <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Steve Dower65e4cb12014-11-22 12:54:57 -080031 <PreprocessorDefinitions>WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
32
Brian Curtin401f9f32012-05-13 11:19:23 -050033 <Optimization>MaxSpeed</Optimization>
Brian Curtin401f9f32012-05-13 11:19:23 -050034 <IntrinsicFunctions>true</IntrinsicFunctions>
Brian Curtin401f9f32012-05-13 11:19:23 -050035 <StringPooling>true</StringPooling>
Steve Dower65e4cb12014-11-22 12:54:57 -080036 <ExceptionHandling></ExceptionHandling>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070037 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
Brian Curtin401f9f32012-05-13 11:19:23 -050038 <FunctionLevelLinking>true</FunctionLevelLinking>
39 <WarningLevel>Level3</WarningLevel>
40 <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
41 <CompileAs>Default</CompileAs>
Steve Dower65e4cb12014-11-22 12:54:57 -080042 <SuppressStartupBanner>true</SuppressStartupBanner>
43 <WholeProgramOptimization>true</WholeProgramOptimization>
Steve Dower5700ae82015-10-11 15:15:52 -070044 <EnableEnhancedInstructionSet Condition="'$(Platform)'=='Win32'">NoExtensions</EnableEnhancedInstructionSet>
Steve Dower65e4cb12014-11-22 12:54:57 -080045 </ClCompile>
46 <ClCompile Condition="$(Configuration) == 'Debug'">
47 <Optimization>Disabled</Optimization>
48 <WholeProgramOptimization>false</WholeProgramOptimization>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070049 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
Brian Curtin401f9f32012-05-13 11:19:23 -050050 </ClCompile>
Zachary Ware4c5ad942016-01-29 19:08:55 -060051 <ClCompile Condition="$(ICCBuild) == 'true'">
52 <FloatingPointModel>Strict</FloatingPointModel>
53 </ClCompile>
Brian Curtin401f9f32012-05-13 11:19:23 -050054 <Link>
55 <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
56 <GenerateDebugInformation>true</GenerateDebugInformation>
57 <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
58 <SubSystem>Windows</SubSystem>
Christian Heimesf3bf35e2013-11-20 17:43:23 +010059 <RandomizedBaseAddress>true</RandomizedBaseAddress>
60 <DataExecutionPrevention>true</DataExecutionPrevention>
Steve Dower65e4cb12014-11-22 12:54:57 -080061 <SuppressStartupBanner>true</SuppressStartupBanner>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070062 <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
Brian Curtin401f9f32012-05-13 11:19:23 -050063 <TargetMachine>MachineX86</TargetMachine>
Steve Dower65e4cb12014-11-22 12:54:57 -080064 <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>
Brian Curtin401f9f32012-05-13 11:19:23 -050069 </Link>
Steve Dower65e4cb12014-11-22 12:54:57 -080070 <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>
Brian Curtin401f9f32012-05-13 11:19:23 -050075 <ResourceCompile>
Steve Dowerb0660582016-04-06 12:35:24 -070076 <AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Steve Dower65e4cb12014-11-22 12:54:57 -080077 <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
78 <Culture>0x0409</Culture>
Brian Curtin401f9f32012-05-13 11:19:23 -050079 </ResourceCompile>
Steve Dower65e4cb12014-11-22 12:54:57 -080080 <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>
Steve Dower6fd76bc2016-07-16 16:13:19 -070086 <TypeLibraryName>$(OutDir)%(Filename).tlb</TypeLibraryName>
87 <HeaderFileName>$(IntDir)%(Filename)_h.h</HeaderFileName>
Steve Dower65e4cb12014-11-22 12:54:57 -080088 </Midl>
Brian Curtin401f9f32012-05-13 11:19:23 -050089 </ItemDefinitionGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -080090
91 <Target Name="GeneratePythonNtRcH"
Steve Dowerb0660582016-04-06 12:35:24 -070092 BeforeTargets="ClCompile"
Steve Dower65e4cb12014-11-22 12:54:57 -080093 Inputs="$(PySourcePath)Include\patchlevel.h"
Steve Dowerb0660582016-04-06 12:35:24 -070094 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 */
Steve Dower65e4cb12014-11-22 12:54:57 -080097#define FIELD3 $(Field3Value)
Steve Dower25879522015-01-15 09:10:16 -080098#define MS_DLL_ID "$(SysWinVer)"
Steve Dowerb0660582016-04-06 12:35:24 -070099#define PYTHON_DLL_NAME "$(TargetName)$(TargetExt)"
Steve Dower65e4cb12014-11-22 12:54:57 -0800100' />
101 <ItemGroup>
Steve Dowerb0660582016-04-06 12:35:24 -0700102 <FileWrites Include="$(IntDir)pythonnt_rc.h" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800103 </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>
Steve Dower10e65852014-12-12 12:18:11 -0800129
Steve Dowerf4f10802014-12-12 13:45:25 -0800130 <Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'">
Steve Dower940f6a82015-10-31 12:17:11 -0700131 <Message Text="Killing any running python$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" />
132 <KillPython FileName="$(OutDir)python$(PyDebugExt)$(PyTestExt).exe" />
Steve Dower65e4cb12014-11-22 12:54:57 -0800133 </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>
Steve Dowerbb240872015-02-05 22:08:48 -0800149
150 <PropertyGroup Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
151 <SignToolPath Condition="'$(SignToolPath)' == '' or !Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86\signtool.exe</SignToolPath>
152 <SignToolPath Condition="!Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86\signtool.exe</SignToolPath>
153 <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 -0800154 <_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 -0800155 </PropertyGroup>
156
157 <Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
158 <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
159 <Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
160 </Target>
Zachary Warea191b912014-03-21 22:58:19 -0500161</Project>