diff options
author | Jason Perkins <starkos@industriousone.com> | 2011-10-21 23:32:18 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2011-10-21 23:32:18 +0400 |
commit | a9d58a40dcf7e41e4e1594cb4b93ea0459e8750d (patch) | |
tree | 04062134fb298220b4a220eae5ee9e01b16d365b /src | |
parent | 6ddd47a765805af55a9a5fd91d8b840241b5e52c (diff) |
Patch 3317329: Support vstudio CompileAs for mixed-language projects (xpol)
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/vstudio/vs200x_vcproj.lua | 38 | ||||
-rw-r--r-- | src/base/project.lua | 9 |
2 files changed, 35 insertions, 12 deletions
diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index 430652f..d79c4bf 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -122,8 +122,10 @@ -- source files are handled at the leaves onleaf = function(node, depth) + local fname = node.cfg.name + _p(depth, '<File') - _p(depth, '\tRelativePath="%s"', path.translate(node.cfg.name, "\\")) + _p(depth, '\tRelativePath="%s"', path.translate(fname, "\\")) _p(depth, '\t>') depth = depth + 1 @@ -134,21 +136,33 @@ local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) local usePCH = (not prj.flags.NoPCH and prj.pchsource == node.cfg.name) - if (usePCH) then + local useCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj)) + + if usePCH or useCompileAs then _p(depth, '<FileConfiguration') _p(depth, '\tName="%s"', cfginfo.name) _p(depth, '\t>') _p(depth, '\t<Tool') - _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360", "VCCLX360CompilerTool", "VCCLCompilerTool")) - - if cfg.system == "PS3" then - local options = table.join(premake.snc.getcflags(cfg), premake.snc.getcxxflags(cfg), cfg.buildoptions) - options = table.concat(options, " "); - options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"' - _p(depth, '\t\tAdditionalOptions="%s"', premake.esc(options)) - else - _p(depth, '\t\tUsePrecompiledHeader="1"') - end + _p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360", + "VCCLX360CompilerTool", + "VCCLCompilerTool")) + + if useCompileAs then + _p(depth, '\t\tCompileAs="%s"', iif(path.iscfile(fname), 1, 2)) + end + + if usePCH then + if cfg.system == "PS3" then + local options = table.join(premake.snc.getcflags(cfg), + premake.snc.getcxxflags(cfg), + cfg.buildoptions) + options = table.concat(options, " "); + options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"' + _p(depth, '\t\tAdditionalOptions="%s"', premake.esc(options)) + else + _p(depth, '\t\tUsePrecompiledHeader="1"') + end + end _p(depth, '\t/>') _p(depth, '</FileConfiguration>') diff --git a/src/base/project.lua b/src/base/project.lua index 4534412..2fcb0fa 100644 --- a/src/base/project.lua +++ b/src/base/project.lua @@ -622,6 +622,15 @@ -- +-- Returns true if the project use the C language. +-- + + function premake.project.iscproject(prj) + return prj.language == "C" + end + + +-- -- Returns true if the project uses a C/C++ language. -- |