blob: 34938eabe9d528efede992c7de0f94692c81c96d [file] [log] [blame]
Zachary Ware47343722015-07-16 00:24:48 -05001<?xml version="1.0" encoding="utf-8"?>
2<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup Label="Globals">
4 <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
5 <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
6 <OutDir>$(BuildPath)</OutDir>
7 <IntDir>$(SolutionDir)obj\$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
8 <IntDir Condition="'$(Configuration)' == 'PGInstrument' or '$(Configuration)' == 'PGUpdate'">$(SolutionDir)obj\$(ArchName)\$(ProjectName)\</IntDir>
9 <TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
10 <TargetName>$(TargetName)$(PyDebugExt)</TargetName>
11 <GenerateManifest Condition="'$(GenerateManifest)' == ''">false</GenerateManifest>
12 <EmbedManifest Condition="'$(EmbedManifest)' == ''">false</EmbedManifest>
13 <!-- For VS2008, we have to embed the manifest to be able to run -->
Zachary Ware62a23382015-07-28 00:00:47 -050014 <!-- BasePlatformToolset is for ICC support -->
15 <GenerateManifest Condition="'$(PlatformToolset)' == 'v90' or '$(BasePlatformToolset)' == 'v90'">true</GenerateManifest>
16 <EmbedManifest Condition="'$(PlatformToolset)' == 'v90' or '$(BasePlatformToolset)' == 'v90'">true</EmbedManifest>
Zachary Ware47343722015-07-16 00:24:48 -050017 <SupportPGO Condition="'$(SupportPGO)' == ''">true</SupportPGO>
18 <SupportSigning Condition="'$(SupportSigning)' == ''">true</SupportSigning>
19 <SupportSigning Condition="'$(Configuration)' == 'Debug'">false</SupportSigning>
20 <SupportSigning Condition="'$(ConfigurationType)' == 'StaticLibrary'">false</SupportSigning>
21 </PropertyGroup>
22
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>
29 </PropertyGroup>
30 <ItemDefinitionGroup>
31 <ClCompile>
32 <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
33 <PreprocessorDefinitions>WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
34
35 <Optimization>MaxSpeed</Optimization>
36 <IntrinsicFunctions>true</IntrinsicFunctions>
37 <StringPooling>true</StringPooling>
38 <ExceptionHandling></ExceptionHandling>
39 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
40 <FunctionLevelLinking>true</FunctionLevelLinking>
41 <WarningLevel>Level3</WarningLevel>
42 <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
43 <CompileAs>Default</CompileAs>
44 <SuppressStartupBanner>true</SuppressStartupBanner>
45 <WholeProgramOptimization>true</WholeProgramOptimization>
46 </ClCompile>
47 <ClCompile Condition="$(Configuration) == 'Debug'">
48 <Optimization>Disabled</Optimization>
49 <WholeProgramOptimization>false</WholeProgramOptimization>
50 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
51 </ClCompile>
Zachary Waredc63e9c2016-01-29 19:06:00 -060052 <ClCompile Condition="$(ICCBuild) == 'true'">
53 <FloatingPointModel>Strict</FloatingPointModel>
54 </ClCompile>
Zachary Ware47343722015-07-16 00:24:48 -050055 <Link>
56 <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
57 <GenerateDebugInformation>true</GenerateDebugInformation>
58 <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
59 <SubSystem>Windows</SubSystem>
60 <RandomizedBaseAddress>true</RandomizedBaseAddress>
61 <DataExecutionPrevention>true</DataExecutionPrevention>
62 <SuppressStartupBanner>true</SuppressStartupBanner>
63 <IgnoreSpecificDefaultLibraries>LIBC;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
64 <TargetMachine>MachineX86</TargetMachine>
65 <TargetMachine Condition="'$(Platform)' == 'x64'">MachineX64</TargetMachine>
66 <ProfileGuidedDatabase Condition="$(SupportPGO)">$(OutDir)$(TargetName).pgd</ProfileGuidedDatabase>
67 <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
68 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">PGInstrument</LinkTimeCodeGeneration>
69 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">PGUpdate</LinkTimeCodeGeneration>
70 </Link>
71 <Lib>
72 <LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">true</LinkTimeCodeGeneration>
73 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">true</LinkTimeCodeGeneration>
74 <LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">true</LinkTimeCodeGeneration>
75 </Lib>
76 <ResourceCompile>
77 <AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
78 <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
79 <Culture>0x0409</Culture>
80 </ResourceCompile>
81 <Midl>
82 <PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
83 <MkTypLibCompatible>true</MkTypLibCompatible>
84 <SuppressStartupBanner>true</SuppressStartupBanner>
85 <TargetEnvironment>Win32</TargetEnvironment>
86 <TargetEnvironment Condition="'$(Platform)' == 'x64'">X64</TargetEnvironment>
87 <TypeLibraryName>$(OutDir)wininst.tlb</TypeLibraryName>
88 <HeaderFileName>
89 </HeaderFileName>
90 </Midl>
91 </ItemDefinitionGroup>
92
93 <Target Name="GeneratePythonNtRcH"
94 BeforeTargets="$(MakeVersionInfoBeforeTarget)"
95 Inputs="$(PySourcePath)Include\patchlevel.h"
96 Outputs="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h">
97 <WriteLinesToFile File="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h" Overwrite="true" Encoding="ascii"
98 Lines='/* This file created by python.props /t:GeneratePythonNtRcH */
99#define FIELD3 $(Field3Value)
100#define MS_DLL_ID "$(SysWinVer)"
101#define PYTHON_DLL_NAME "$(PyDllName).dll"
102' />
103 <ItemGroup>
104 <FileWrites Include="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h" />
105 </ItemGroup>
106 </Target>
107
108 <UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
109 <ParameterGroup>
110 <FileName Required="true" />
111 </ParameterGroup>
112 <Task>
113 <Code Type="Fragment" Language="cs">
114<![CDATA[
115string fullPath = System.IO.Path.GetFullPath(FileName);
116Log.LogMessage("Looking for " + fullPath, MessageImportance.Normal);
117foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses()) {
118 try {
119 Log.LogMessage("Found running process: " + p.MainModule.FileName, MessageImportance.Low);
120 if (fullPath.Equals(System.IO.Path.GetFullPath(p.MainModule.FileName), StringComparison.OrdinalIgnoreCase)) {
121 Log.LogMessage("Terminating " + p.MainModule.FileName, MessageImportance.High);
122 p.Kill();
123 }
124 } catch {
125 }
126}
127]]>
128 </Code>
129 </Task>
130 </UsingTask>
131
132 <Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'">
133 <Message Text="Killing any running python.exe instances..." Importance="high" />
134 <KillPython FileName="$(OutDir)python$(PyDebugExt).exe" />
135 </Target>
136
137 <!--
138 A default target to handle msbuild pcbuild.proj /t:CleanAll.
139
140 Some externals projects don't respond to /t:Clean, so we invoke
141 CleanAll on them when we really want to clean up.
142 -->
143 <Target Name="CleanAll" DependsOnTargets="Clean">
144 <MSBuild Projects="@(ProjectReference->'%(FullPath)')"
145 Properties="Configuration=$(Configuration);Platform=$(Platform)"
146 BuildInParallel="true"
147 StopOnFirstFailure="false"
148 Condition="Exists(%(FullPath))"
149 Targets="CleanAll" />
150 </Target>
151
152 <PropertyGroup Condition="'$(SigningCertificate)' != '' and $(SupportSigning)">
153 <SignToolPath Condition="'$(SignToolPath)' == '' or !Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86\signtool.exe</SignToolPath>
154 <SignToolPath Condition="!Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86\signtool.exe</SignToolPath>
155 <SignToolPath Condition="!Exists($(SignToolPath))">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\signtool.exe</SignToolPath>
156 <_SignCommand Condition="Exists($(SignToolPath))">"$(SignToolPath)" sign /q /n "$(SigningCertificate)" /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"</_SignCommand>
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>