blob: 7012170e0c7aa42e1018f5b541f193eb2a2ef492 [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 Dower6ed63f32016-07-24 18:03:22 -07008 <Py_IntDir Condition="'$(Py_IntDir)' == ''">$(MSBuildThisFileDirectory)obj\</Py_IntDir>
Steve Dowerde9fb282015-07-27 14:56:58 -07009 <IntDir>$(Py_IntDir)\$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
Steve Dower65e4cb12014-11-22 12:54:57 -080010 <TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
11 <TargetName>$(TargetName)$(PyDebugExt)</TargetName>
12 <GenerateManifest>false</GenerateManifest>
13 <EmbedManifest>false</EmbedManifest>
14 <SupportPGO Condition="'$(SupportPGO)' == ''">true</SupportPGO>
Steve Dowerbb240872015-02-05 22:08:48 -080015 <SupportSigning Condition="'$(SupportSigning)' == ''">true</SupportSigning>
16 <SupportSigning Condition="'$(Configuration)' == 'Debug'">false</SupportSigning>
17 <SupportSigning Condition="'$(ConfigurationType)' == 'StaticLibrary'">false</SupportSigning>
Zachary Ware6373ba52014-03-17 15:57:38 -050018 </PropertyGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -080019
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>
Brian Curtin401f9f32012-05-13 11:19:23 -050026 </PropertyGroup>
Brian Curtin401f9f32012-05-13 11:19:23 -050027 <ItemDefinitionGroup>
28 <ClCompile>
Steve Dower6fd76bc2016-07-16 16:13:19 -070029 <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Steve Dower65e4cb12014-11-22 12:54:57 -080030 <PreprocessorDefinitions>WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
31
Brian Curtin401f9f32012-05-13 11:19:23 -050032 <Optimization>MaxSpeed</Optimization>
Brian Curtin401f9f32012-05-13 11:19:23 -050033 <IntrinsicFunctions>true</IntrinsicFunctions>
Brian Curtin401f9f32012-05-13 11:19:23 -050034 <StringPooling>true</StringPooling>
Steve Dower65e4cb12014-11-22 12:54:57 -080035 <ExceptionHandling></ExceptionHandling>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070036 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
Brian Curtin401f9f32012-05-13 11:19:23 -050037 <FunctionLevelLinking>true</FunctionLevelLinking>
38 <WarningLevel>Level3</WarningLevel>
39 <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
40 <CompileAs>Default</CompileAs>
Steve Dower65e4cb12014-11-22 12:54:57 -080041 <SuppressStartupBanner>true</SuppressStartupBanner>
42 <WholeProgramOptimization>true</WholeProgramOptimization>
Steve Dower5700ae82015-10-11 15:15:52 -070043 <EnableEnhancedInstructionSet Condition="'$(Platform)'=='Win32'">NoExtensions</EnableEnhancedInstructionSet>
Steve Dower65e4cb12014-11-22 12:54:57 -080044 </ClCompile>
45 <ClCompile Condition="$(Configuration) == 'Debug'">
46 <Optimization>Disabled</Optimization>
47 <WholeProgramOptimization>false</WholeProgramOptimization>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070048 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
Brian Curtin401f9f32012-05-13 11:19:23 -050049 </ClCompile>
Zachary Ware4c5ad942016-01-29 19:08:55 -060050 <ClCompile Condition="$(ICCBuild) == 'true'">
51 <FloatingPointModel>Strict</FloatingPointModel>
52 </ClCompile>
Brian Curtin401f9f32012-05-13 11:19:23 -050053 <Link>
54 <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
55 <GenerateDebugInformation>true</GenerateDebugInformation>
56 <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
57 <SubSystem>Windows</SubSystem>
Christian Heimesf3bf35e2013-11-20 17:43:23 +010058 <RandomizedBaseAddress>true</RandomizedBaseAddress>
59 <DataExecutionPrevention>true</DataExecutionPrevention>
Steve Dower65e4cb12014-11-22 12:54:57 -080060 <SuppressStartupBanner>true</SuppressStartupBanner>
Steve Dowerfcbe1df2015-09-08 21:39:01 -070061 <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
Brian Curtin401f9f32012-05-13 11:19:23 -050062 <TargetMachine>MachineX86</TargetMachine>
Steve Dower65e4cb12014-11-22 12:54:57 -080063 <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>
Brian Curtin401f9f32012-05-13 11:19:23 -050068 </Link>
Steve Dower65e4cb12014-11-22 12:54:57 -080069 <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>
Brian Curtin401f9f32012-05-13 11:19:23 -050074 <ResourceCompile>
Steve Dowerb0660582016-04-06 12:35:24 -070075 <AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Steve Dower65e4cb12014-11-22 12:54:57 -080076 <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
77 <Culture>0x0409</Culture>
Brian Curtin401f9f32012-05-13 11:19:23 -050078 </ResourceCompile>
Steve Dower65e4cb12014-11-22 12:54:57 -080079 <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>
Steve Dowerdf450d12016-07-16 16:17:33 -070085 <OutputDirectory>$(IntDir)</OutputDirectory>
86 <InterfaceIdentifierFileName>$(MSBuildProjectName)_i.c</InterfaceIdentifierFileName>
87 <ProxyFileName>$(MSBuildProjectName)_p.c</ProxyFileName>
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
Steve Dower425ec152016-10-09 20:18:52 -0700150 <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>
Steve Dowerbb240872015-02-05 22:08:48 -0800157 </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>
Zachary Warea191b912014-03-21 22:58:19 -0500163</Project>