blob: f63c30dd13787779edcb99023eaa667505bbf8e4 [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 Dower6d58f8d2015-06-19 10:49:04 -070039 <RuntimeLibrary>MultiThreaded</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>
46 </ClCompile>
47 <ClCompile Condition="$(Configuration) == 'Debug'">
48 <Optimization>Disabled</Optimization>
49 <WholeProgramOptimization>false</WholeProgramOptimization>
Steve Dower6d58f8d2015-06-19 10:49:04 -070050 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Brian Curtin401f9f32012-05-13 11:19:23 -050051 </ClCompile>
52 <Link>
53 <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
54 <GenerateDebugInformation>true</GenerateDebugInformation>
55 <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
56 <SubSystem>Windows</SubSystem>
Christian Heimesf3bf35e2013-11-20 17:43:23 +010057 <RandomizedBaseAddress>true</RandomizedBaseAddress>
58 <DataExecutionPrevention>true</DataExecutionPrevention>
Steve Dower65e4cb12014-11-22 12:54:57 -080059 <SuppressStartupBanner>true</SuppressStartupBanner>
Steve Dower6d58f8d2015-06-19 10:49:04 -070060 <AdditionalDependencies Condition="$(Configuration) == 'Debug'">ucrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
61 <AdditionalDependencies Condition="$(Configuration) != 'Debug'">ucrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
62 <IgnoreSpecificDefaultLibraries>LIBC;libucrt.lib;libucrtd.lib;%(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 Dower65e4cb12014-11-22 12:54:57 -080076 <AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
77 <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>
86 <TypeLibraryName>$(OutDir)wininst.tlb</TypeLibraryName>
87 <HeaderFileName>
88 </HeaderFileName>
89 </Midl>
Brian Curtin401f9f32012-05-13 11:19:23 -050090 </ItemDefinitionGroup>
Steve Dower65e4cb12014-11-22 12:54:57 -080091
92 <Target Name="GeneratePythonNtRcH"
93 BeforeTargets="$(MakeVersionInfoBeforeTarget)"
94 Inputs="$(PySourcePath)Include\patchlevel.h"
95 Outputs="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h">
96 <WriteLinesToFile File="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h" Overwrite="true" Encoding="ascii"
97 Lines='/* This file created by python.props /t:GeneratePythonNtRcH */
98#define FIELD3 $(Field3Value)
Steve Dower25879522015-01-15 09:10:16 -080099#define MS_DLL_ID "$(SysWinVer)"
Steve Dower65e4cb12014-11-22 12:54:57 -0800100#define PYTHON_DLL_NAME "$(PyDllName).dll"
101' />
102 <ItemGroup>
103 <FileWrites Include="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).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 <Code Type="Fragment" Language="cs">
113<![CDATA[
114string fullPath = System.IO.Path.GetFullPath(FileName);
115Log.LogMessage("Looking for " + fullPath, MessageImportance.Normal);
116foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses()) {
117 try {
118 Log.LogMessage("Found running process: " + p.MainModule.FileName, MessageImportance.Low);
119 if (fullPath.Equals(System.IO.Path.GetFullPath(p.MainModule.FileName), StringComparison.OrdinalIgnoreCase)) {
120 Log.LogMessage("Terminating " + p.MainModule.FileName, MessageImportance.High);
121 p.Kill();
122 }
123 } catch {
124 }
125}
126]]>
127 </Code>
128 </Task>
129 </UsingTask>
Steve Dower10e65852014-12-12 12:18:11 -0800130
Steve Dowerf4f10802014-12-12 13:45:25 -0800131 <Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'">
Steve Dower65e4cb12014-11-22 12:54:57 -0800132 <Message Text="Killing any running python.exe instances..." Importance="high" />
133 <KillPython FileName="$(OutDir)python$(PyDebugExt).exe" />
134 </Target>
135
136 <!--
137 A default target to handle msbuild pcbuild.proj /t:CleanAll.
138
139 Some externals projects don't respond to /t:Clean, so we invoke
140 CleanAll on them when we really want to clean up.
141 -->
142 <Target Name="CleanAll" DependsOnTargets="Clean">
143 <MSBuild Projects="@(ProjectReference->'%(FullPath)')"
144 Properties="Configuration=$(Configuration);Platform=$(Platform)"
145 BuildInParallel="true"
146 StopOnFirstFailure="false"
147 Condition="Exists(%(FullPath))"
148 Targets="CleanAll" />
149 </Target>
Steve Dowerbb240872015-02-05 22:08:48 -0800150
151 <PropertyGroup Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
152 <SignToolPath Condition="'$(SignToolPath)' == '' or !Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86\signtool.exe</SignToolPath>
153 <SignToolPath Condition="!Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86\signtool.exe</SignToolPath>
154 <SignToolPath Condition="!Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\signtool.exe</SignToolPath>
155 <_SignCommand Condition="Exists($(SignToolPath))">"$(SignToolPath)" sign /q /n "$(SigningCertificate)" /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand>
156 </PropertyGroup>
157
158 <Target Name="_SignBuild" AfterTargets="AfterBuild" Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
159 <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
160 <Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
161 </Target>
Zachary Warea191b912014-03-21 22:58:19 -0500162</Project>