10000 msvc: Use different output directories depending on build type by stinos · Pull Request #1615 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

msvc: Use different output directories depending on build type #1615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions windows/msvc/common.props
< 10000 tr data-hunk="98c13932a96f7e8d3eac894bb9be7b77629cd7c829221d85be086ce67286b478" class="show-top-border">
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="env.props" />
<Import Project="paths.props" Condition="'$(PyPathsIncluded)' != 'True'"/>
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>$(PyOutDir)</OutDir>
<IntDir>$(PyBuildDir)$(Configuration)$(Platform)\</IntDir>
<PyIncDirs>$(PyBaseDir);$(PyBaseDir)windows;$(PyBaseDir)windows\msvc;$(PyBuildDir)</PyIncDirs>
<IntDir>$(PyIntDir)</IntDir>
<PyFileCopyCookie>$(PyBuildDir)copycookie$(Configuration)$(Platform)</PyFileCopyCookie>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
Expand All @@ -22,5 +22,24 @@
<GenerateMapFile>true</GenerateMapFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
<ItemGroup>
<PyOutputFiles Include="$(TargetPath)">
<Destination>$(PyWinDir)%(FileName)%(Extension)</Destination>
</PyOutputFiles>
<PyCookieFiles Include="$(PyBuildDir)copycookie*" Exclude="$(PyFileCopyCookie)"/>
</ItemGroup>

<!-- Copy PyOutputFiles to their target destination.
To force this when switching between platforms/configurations which are already up-to-date (and as such,
for which a build wouldn't even start because all outputs are effectively newer than the inputs)
an empty file $(PyFileCopyCookie) is created serving as a record to indicate what was last copied,
and any previous records are deleted. So when switching between builds which are otherwise up-to-date
the tracker will notice a missing file and a build is started anyway (and it will just copy our files). -->
<Target Name="CopyFilesToWinDir" AfterTargets="Build"
Inputs="$(TargetPath)" Outputs="$(PyFileCopyCookie);@(PyOutputFiles->'%(Destination)')">
<Delete Files="@(PyCookieFiles)"/>
<Touch Files="$(PyFileCopyCookie)" AlwaysCreate="true"/>
<Copy SourceFiles="%(PyOutputFiles.Identity)" DestinationFiles="%(PyOutputFiles.Destination)"/>
<WriteLinesToFile File="$(TLogLocation)$(ProjectName).write.u.tlog" Lines="$(PyFileCopyCookie);@(PyOutputFiles->'%(Destination)')" Overwrite="True"/>
</Target>
</Project>
9 changes: 0 additions & 9 deletions windows/msvc/env.props

This file was deleted.

2 changes: 1 addition & 1 deletion windows/msvc/genhdr.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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"/>
<Import Project="paths.props" Condition="'$(PyPathsIncluded)' != 'True'"/>

<!--Generate qstrdefs.h and mpversion.h similar to what is done in py/py.mk-->
<Target Name="GenerateHeaders" DependsOnTargets="MakeQstrData;MakeVersionHdr">
Expand Down
45 changes: 45 additions & 0 deletions windows/msvc/paths.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PyPathsIncluded>True</PyPathsIncluded>

<!-- The properties below specify the output directory structure.
This defaults to, for example for Configuration = Debug and Platform = x64:

micropython [PyBaseDir]
|- ...
CD1F |- windows [PyWinDir]
|- ...
|- micropython.exe
|- build [PyBuildDir]
|- Debugx64 [PyOutDir]
| |- ...
| |- micropython.exe
| |- micropython.map
| |- obj [PyIntDir]
|- genhdr

Note that the micropython executable will be copied from PyOutDir
to PyWinDir after each build. -->

<!-- Start from project root -->
<PyBaseDir>$([System.IO.Path]::GetFullPath(`$(MSBuildThisFileDirectory)..\..`))\</PyBaseDir>
<PyWinDir>$(PyBaseDir)windows\</PyWinDir>
<PyBuildDir Condition="'$(PyBuildDir)' == ''">$(PyWinDir)build\</PyBuildDir>

<!-- All include directories needed for uPy -->
<PyIncDirs>$(PyBaseDir);$(PyWinDir);$(PyBuildDir);$(PyWinDir)msvc</PyIncDirs>

<!-- Within PyBuildDir different subdirectories are used based on configuration and platform.
By default these are chosen based on the Configuration and Platform properties, but
this file might be imported by other projects (to figure out where the artifacts go
or what the include files are) and those projects might already contain conflicting
Configuration/Platform properties, so allow to override these -->
<PyPlatform Condition="'$(PyPlatform)' == ''">$(Platform)</PyPlatform>
<PyConfiguration Condition="'$(PyConfiguration)' == ''">$(Configuration)</PyConfiguration>

<!-- The final destination directories -->
<PyOutDir>$(PyBuildDir)$(PyConfiguration)$(PyPlatform)\</PyOutDir>
<PyIntDir>$(PyOutDir)obj\</PyIntDir>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion windows/msvc/sources.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="env.props" Condition="$(PyEnvIncluded)!=True"/>
<Import Project="paths.props" Condition="'$(PyPathsIncluded)' != 'True'"/>
<ItemGroup>
<ClCompile Include="$(PyBaseDir)py\*.c" />
<ClCompile Include="$(PyBaseDir)windows\*.c" />
Expand Down
0