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