diff options
author | Jason Perkins <starkos@industriousone.com> | 2011-12-07 00:14:43 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2011-12-07 00:14:43 +0400 |
commit | a067c337ec1975a12ecd2b20148b7b679cb270c3 (patch) | |
tree | 0603690462beac91796bf0f8f2944a506423feba | |
parent | 89f3849a091493afb94d5aced5f381439d393389 (diff) |
Patch 3451928: VS2008 trying to build *.h files in C projects
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | src/actions/vstudio/vs200x_vcproj.lua | 8 | ||||
-rw-r--r-- | tests/actions/vstudio/vc200x/test_files.lua (renamed from tests/actions/vstudio/vc200x/files.lua) | 20 | ||||
-rw-r--r-- | tests/premake4.lua | 2 |
4 files changed, 25 insertions, 6 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 5e63234..c3a276d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -43,6 +43,7 @@ * Bug: Visual Studio 2010 forces x86 when platform is Native * Added new global _WORKING_DIR * Patch 3351583: _PREMAKE_COMMAND variable (Konstantin Tokarev) +* Patch 3451928: VS2008 trying to build *.h files in C projects ------- diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index d79c4bf..f90533a 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -136,9 +136,10 @@ local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) local usePCH = (not prj.flags.NoPCH and prj.pchsource == node.cfg.name) - local useCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj)) + local isSourceCode = path.iscppfile(fname) + local needsCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj)) - if usePCH or useCompileAs then + if usePCH or (isSourceCode and needsCompileAs) then _p(depth, '<FileConfiguration') _p(depth, '\tName="%s"', cfginfo.name) _p(depth, '\t>') @@ -146,8 +147,7 @@ _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360", "VCCLX360CompilerTool", "VCCLCompilerTool")) - - if useCompileAs then + if needsCompileAs then _p(depth, '\t\tCompileAs="%s"', iif(path.iscfile(fname), 1, 2)) end diff --git a/tests/actions/vstudio/vc200x/files.lua b/tests/actions/vstudio/vc200x/test_files.lua index 4633674..02b888e 100644 --- a/tests/actions/vstudio/vc200x/files.lua +++ b/tests/actions/vstudio/vc200x/test_files.lua @@ -1,5 +1,5 @@ -- --- tests/actions/vstudio/vc200x/files.lua +-- tests/actions/vstudio/vc200x/test_files.lua -- Validate generation of <files/> block in Visual Studio 200x projects. -- Copyright (c) 2009-2011 Jason Perkins and the Premake project -- @@ -81,6 +81,24 @@ -- +-- Non-source code files, such as header files and documentation, should +-- be marked as such, so the compiler won't attempt to build them. +-- + + function suite.file_markedAsNonBuildable_onSupportFiles() + language "c" + files { "hello.lua" } + prepare() + test.capture [[ + <File + RelativePath="hello.lua" + > + </File> + ]] + end + + +-- -- Mixed language support -- diff --git a/tests/premake4.lua b/tests/premake4.lua index acc358d..8524d66 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -97,7 +97,7 @@ -- Visual Studio 2002-2008 C/C++ projects dofile("actions/vstudio/vc200x/debugdir.lua") dofile("actions/vstudio/vc200x/header.lua") - dofile("actions/vstudio/vc200x/files.lua") + dofile("actions/vstudio/vc200x/test_files.lua") dofile("actions/vstudio/vc200x/test_filters.lua") -- Visual Studio 2010 C/C++ projects |