circuitpython/windows/msvc/common.props
stijn 967ceba5b7 msvc: Use different output directories depending on build type
This allows multiple versions (e.g. Debug/Release, x86/x64) of micropython.exe
to co-exist instead and also solves potential problems where msbuild does not
completely rebuild the output and/or pdb files when switching between builds,
which in turn can cause linker errors in dependent projects.

By default exe/map/... files go in windows/build/$(Configuration)$(Platform)

After each build micropython.exe is still copied from the above directory to
the windows directory though, as that is consistent with the other ports and
the test runner by default uses that location as well.

Also rename env.props -> path.props which is a clearer name,
and add ample documentation in the affected build files.

(also see discussion in #1538)
2015-12-11 23:42:30 +02:00

46 lines
2.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="paths.props" Condition="'$(PyPathsIncluded)' != 'True'"/>
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>$(PyOutDir)</OutDir>
<IntDir>$(PyIntDir)</IntDir>
<PyFileCopyCookie>$(PyBuildDir)copycookie$(Configuration)$(Platform)</PyFileCopyCookie>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(PyIncDirs);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<WarningLevel>Level1</WarningLevel>
<ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
</Link>
</ItemDefinitionGroup>
<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>