Skip to content

Msvc build fix #1034

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

Merged
merged 3 commits into from
Jan 2, 2015
Merged
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
2 changes: 1 addition & 1 deletion py/argcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void mp_arg_parse_all_kw_array(mp_uint_t n_pos, mp_uint_t n_kw, const mp_obj_t *
mp_arg_parse_all(n_pos, args, &kw_args, n_allowed, allowed, out_vals);
}

#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE || _MSC_VER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange that it needs this... even with no optimisation and debugging enabled, unix version doesn't complain about mp_arg_error_terse_mismatch not existing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be a gcc optimization. In debug mode cl compiles if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) into xor eax,eax followed by a jump which is always skipped of course. In release mode it gets rid of everything, yet still wants the function definition to be available. Might be a bug or 'feature'

NORETURN void mp_arg_error_terse_mismatch(void) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "argument num/types mismatch"));
}
Expand Down
11 changes: 7 additions & 4 deletions windows/msvc/common.props
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
9 changes: 9 additions & 0 deletions windows/msvc/env.props
Original file line number Diff line number Diff line change
@@ -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>
36 changes: 24 additions & 12 deletions windows/msvc/genhdr.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?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>
<DestDir>$(PyBuildDir)genhdr\</DestDir>
</PropertyGroup>

<Target Name="MakeDestDir">
Expand All @@ -16,16 +17,18 @@
<!--see py/py.mk under #qstr data-->
<Target Name="MakeQstrData" DependsOnTargets="MakeDestDir">
<PropertyGroup>
<PySrcDir>$(PyBaseDir)py\</PySrcDir>
<PreProc>$(DestDir)qstrdefs.preprocessed.h</PreProc>
<QstrDefs>$(MsBuildThisFileDirectory)..\..\unix\qstrdefsport.h</QstrDefs>
<QstrDefs>$(PyBaseDir)unix\qstrdefsport.h</QstrDefs>
<DestFile>$(DestDir)qstrdefs.generated.h</DestFile>
<TmpFile>$(DestFile).tmp</TmpFile>
</PropertyGroup>
<Exec Command="cl /nologo /I$(SrcDir) /I$(MsBuildThisFileDirectory).. /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>&amp;1" IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="FilesDiffer" />
</Exec>
<Copy SourceFiles="$(DestFile).tmp" DestinationFiles="$(DestFile)" Condition="'$(FilesDiffer)'!='0'"/>
<ItemGroup>
<PyIncDirs Include="$(PyIncDirs)"/>
</ItemGroup>
<Exec Command="cl /nologo /I@(PyIncDirs, ' /I') /Fi$(PreProc) /P $(PySrcDir)qstrdefs.h"/>
<Exec Command="python $(PySrcDir)makeqstrdata.py $(PreProc) $(QstrDefs) > $(TmpFile)"/>
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(DestFile)"/>
</Target>

<!--see py/py-version.sh-->
Expand All @@ -50,18 +53,27 @@
</PropertyGroup>
<PropertyGroup>
<DestFile>$(DestDir)py-version.h</DestFile>
<TmpFile>$(DestFile).tmp</TmpFile>
</PropertyGroup>
<ItemGroup>
<Lines Include="// This file was generated by $([System.IO.Path]::GetFileName(`$(MsBuildThisFile)`))"/>
<Lines Include="#define MICROPY_GIT_TAG &quot;$(GitTag)&quot;"/>
<Lines Include="#define MICROPY_GIT_HASH &quot;$(GitHash)&quot;"/>
<Lines Include="#define MICROPY_BUILD_DATE &quot;$([System.DateTime]::Now.ToString(`yyyy-MM-dd`))&quot;"/>
</ItemGroup>
<WriteLinesToFile Lines="@(Lines)" File="$(DestFile).tmp" Overwrite="true"/>
<Exec Command="fc /B $(DestFile).tmp $(DestFile) > NUL 2>&amp;1" IgnoreExitCode="true">
<WriteLinesToFile Lines="@(Lines)" File="$(TmpFile)" Overwrite="true"/>
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="CopyFileIfDifferent" Properties="SourceFile=$(TmpFile);DestFile=$(DestFile)"/>
</Target>

<!--Copies SourceFile to DestFile only if SourceFile's content differs from DestFile's.
We use this to 'touch' the generated files only when they are really newer
so a build is only triggered if the generated content actually changed,
and not just because the file date changed since the last build-->
<Target Name="CopyFileIfDifferent">
<Exec Command="fc /B $(SourceFile) $(DestFile) > NUL 2>&amp;1" IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="FilesDiffer" />
</Exec>
<Copy SourceFiles="$(DestFile).tmp" DestinationFiles="$(DestFile)" Condition="'$(FilesDiffer)'!='0'"/>
<Copy SourceFiles="$(SourceFile)" DestinationFiles="$(DestFile)" Condition="'$(FilesDiffer)'!='0'"/>
</Target>

</Project>
4 changes: 1 addition & 3 deletions windows/msvc/sources.props
Original file line number Diff line number Diff line change
@@ -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" />
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy