Home | History | Annotate | Download | only in support
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      3   <PropertyGroup Condition="$(Platform) == '$$PYTHON_PLATFORM$$'">
      4     <PythonHome>$(MSBuildThisFileDirectory)\..\..\tools</PythonHome>
      5     <PythonInclude>$(PythonHome)\include</PythonInclude>
      6     <PythonLibs>$(PythonHome)\libs</PythonLibs>
      7     <PythonTag>$$PYTHON_TAG$$</PythonTag>
      8     <PythonVersion>$$PYTHON_VERSION$$</PythonVersion>
      9     
     10     <IncludePythonExe Condition="$(IncludePythonExe) == ''">true</IncludePythonExe>
     11     <IncludeDistutils Condition="$(IncludeDistutils) == ''">false</IncludeDistutils>
     12     <IncludeLib2To3 Condition="$(IncludeLib2To3) == ''">false</IncludeLib2To3>
     13     <IncludeVEnv Condition="$(IncludeVEnv) == ''">false</IncludeVEnv>
     14 
     15     <GetPythonRuntimeFilesDependsOn>$$PYTHON_TARGET$$;$(GetPythonRuntimeFilesDependsOn)</GetPythonRuntimeFilesDependsOn>
     16   </PropertyGroup>
     17 
     18   <ItemDefinitionGroup Condition="$(Platform) == '$$PYTHON_PLATFORM$$'">
     19     <ClCompile>
     20       <AdditionalIncludeDirectories>$(PythonInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     21       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     22     </ClCompile>
     23     <Link>
     24       <AdditionalLibraryDirectories>$(PythonLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     25     </Link>
     26   </ItemDefinitionGroup>
     27 
     28   <Target Name="GetPythonRuntimeFiles" Returns="@(PythonRuntime)" DependsOnTargets="$(GetPythonRuntimeFilesDependsOn)" />
     29 
     30   <Target Name="$$PYTHON_TARGET$$" Returns="@(PythonRuntime)">
     31     <ItemGroup>
     32       <_PythonRuntimeExe Include="$(PythonHome)\python*.dll" />
     33       <_PythonRuntimeExe Include="$(PythonHome)\vcruntime140.dll" />
     34       <_PythonRuntimeExe Include="$(PythonHome)\python*.exe" Condition="$(IncludePythonExe) == 'true'" />
     35       <_PythonRuntimeExe>
     36         <Link>%(Filename)%(Extension)</Link>
     37       </_PythonRuntimeExe>
     38       <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.pyd" />
     39       <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.dll" />
     40       <_PythonRuntimeDlls>
     41         <Link>DLLs\%(Filename)%(Extension)</Link>
     42       </_PythonRuntimeDlls>
     43       <_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" />
     44       <_PythonRuntimeLib Remove="$(PythonHome)\Lib\distutils\**\*" Condition="$(IncludeDistutils) != 'true'" />
     45       <_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" />
     46       <_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" />
     47       <_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" />
     48       <_PythonRuntimeLib>
     49         <Link>Lib\%(RecursiveDir)%(Filename)%(Extension)</Link>
     50       </_PythonRuntimeLib>
     51       <PythonRuntime Include="@(_PythonRuntimeExe);@(_PythonRuntimeDlls);@(_PythonRuntimeLib)" />
     52     </ItemGroup>
     53     
     54     <Message Importance="low" Text="Collected Python runtime from $(PythonHome):%0D%0A@(PythonRuntime->'  %(Link)','%0D%0A')" />
     55   </Target>
     56 </Project>
     57