msvc: Define main build/include directories in a single location
- Use a single file env.props for defining the main directories used when building. env.props resolves the base directory and defines overridable output directories, and is used by all other build files. - Fix the build currently failing, basically because the preprocessing command for generating qstrdefs uses different include directories than the build itself does. (specifically, qstrdefs.h uses #include "py/mpconfig.h" since the fixes for #1022 in 51dfcb4, so we need to use the base directory as include directory, not the py dir itself). So define a single variable containing the include directories instead and use it where needed.
This commit is contained in:
parent
fd40a9c38e
commit
8dec62a1a4
@ -1,14 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="env.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<OutDir>$(ProjectDir)</OutDir>
|
||||
<IntDir>$(ProjectDir)build\$(Configuration)$(Platform)\</IntDir>
|
||||
<OutDir>$(PyOutDir)</OutDir>
|
||||
<IntDir>$(PyBuildDir)$(Configuration)$(Platform)\</IntDir>
|
||||
<PyIncDirs>$(PyBaseDir);$(PyBaseDir)windows;$(PyBaseDir)windows\msvc;$(PyBuildDir)</PyIncDirs>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\;..\;.\build;.\msvc</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(PyIncDirs);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
|
9
windows/msvc/env.props
Normal file
9
windows/msvc/env.props
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PyBaseDir>$([System.IO.Path]::GetFullPath(`$(MSBuildThisFileDirectory)..\..`))\</PyBaseDir>
|
||||
<PyBuildDir Condition="'$(PyBuildDir)'==''">$(MSBuildThisFileDirectory)build\</PyBuildDir>
|
||||
<PyOutDir Condition="'$(PyOutDir)'==''">$(PyBaseDir)windows\</PyOutDir>
|
||||
<PyEnvIncluded>True</PyEnvIncluded>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="GenerateHeaders">
|
||||
|
||||
<Import Project="env.props" Condition="$(PyEnvIncluded)!=True"/>
|
||||
|
||||
<Target Name="GenerateHeaders" DependsOnTargets="MakeQstrData;MakeVersionHeader">
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
<SrcDir>$(MsBuildThisFileDirectory)..\..\py\</SrcDir>
|
||||
<DestDir>$(MsBuildThisFileDirectory)..\build\genhdr\</DestDir>
|
||||
<SrcDir>$(PyBaseDir)py\</SrcDir>
|
||||
<DestDir>$(PyBuildDir)genhdr\</DestDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="MakeDestDir">
|
||||
@ -17,10 +19,13 @@
|
||||
<Target Name="MakeQstrData" DependsOnTargets="MakeDestDir">
|
||||
<PropertyGroup>
|
||||
<PreProc>$(DestDir)qstrdefs.preprocessed.h</PreProc>
|
||||
<QstrDefs>$(MsBuildThisFileDirectory)..\..\unix\qstrdefsport.h</QstrDefs>
|
||||
<QstrDefs>$(PyBaseDir)unix\qstrdefsport.h</QstrDefs>
|
||||
<DestFile>$(DestDir)qstrdefs.generated.h</DestFile>
|
||||
</PropertyGroup>
|
||||
<Exec Command="cl /nologo /I$(SrcDir) /I$(MsBuildThisFileDirectory).. /Fi$(PreProc) /P $(SrcDir)qstrdefs.h"/>
|
||||
<ItemGroup>
|
||||
<PyIncDirs Include="$(PyIncDirs)"/>
|
||||
</ItemGroup>
|
||||
<Exec Command="cl /nologo /I@(PyIncDirs, ' /I') /Fi$(PreProc) /P $(SrcDir)qstrdefs.h"/>
|
||||
<Exec Command="python $(SrcDir)makeqstrdata.py $(PreProc) $(QstrDefs) > $(DestFile).tmp"/>
|
||||
<Exec Command="fc /B $(DestFile).tmp $(DestFile) > NUL 2>&1" IgnoreExitCode="true">
|
||||
<Output TaskParameter="ExitCode" PropertyName="FilesDiffer" />
|
||||
|
@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PyBaseDir>$(MsbuildThisFileDirectory)..\..\</PyBaseDir>
|
||||
</PropertyGroup>
|
||||
<Import Project="env.props" Condition="$(PyEnvIncluded)!=True"/>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(PyBaseDir)py\*.c" />
|
||||
<ClCompile Include="$(PyBaseDir)extmod\*.c" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user