Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2017-04-11 23:05:29 +0300
committerOliver Schneider <oliver@assarbad.net>2017-04-11 23:05:29 +0300
commit199dfb07ada3f9ff3b99d768c62eb11e70fed78a (patch)
treedfa43111e784b5fc59d808c5df1ed5fd15c272a7 /src/actions/vstudio/vs2010_vcxproj.lua
parent1f182f0e5d98809aec9146af76838db91b539bc4 (diff)
This should fix an issue where VS2008 and earlier got the proper CompileAs property
on individual files, but VS2010 and newer did not. This introduces the two new overridable functions 1. premake.vstudio.vc2010.individualSourceFile 2. premake.vstudio.vc200x.individualSourceFile These can also be used as sentinel for this particular patch to decide if you need to patch via your premake4.lua or not. The patch to premake4.lua shows how older premake4 versions can be taught to behave like this patched version without having the patched version ... just by modifying the premake4.lua. Beautiful demo of the power of Lua inside Premake4. --HG-- branch : WDS-build
Diffstat (limited to 'src/actions/vstudio/vs2010_vcxproj.lua')
-rw-r--r--src/actions/vstudio/vs2010_vcxproj.lua25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index d77ad21..5b9958c 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -526,6 +526,21 @@
end
end
+ function vc2010.individualSourceFile(prj, config_mappings, file)
+ local configs = prj.solution.vstudio_configs
+ local translatedpath = path.translate(file.name, "\\")
+ _p(2,'<ClCompile Include=\"%s\">', translatedpath)
+ for _, cfginfo in ipairs(configs) do
+ if config_mappings[cfginfo] and translatedpath == config_mappings[cfginfo] then
+ _p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>', premake.esc(cfginfo.name))
+ config_mappings[cfginfo] = nil --only one source file per pch
+ end
+ end
+ if path.iscfile(file.name) ~= premake.project.iscproject(prj) then
+ _p(3,'<CompileAs>%s</CompileAs>', iif(path.iscfile(file.name), 'CompileAsC', 'CompileAsCpp'))
+ end
+ _p(2,'</ClCompile>')
+ end
function vc2010.compilerfilesgroup(prj)
local configs = prj.solution.vstudio_configs
@@ -541,15 +556,7 @@
_p(1,'<ItemGroup>')
for _, file in ipairs(files) do
- local translatedpath = path.translate(file.name, "\\")
- _p(2,'<ClCompile Include=\"%s\">', translatedpath)
- for _, cfginfo in ipairs(configs) do
- if config_mappings[cfginfo] and translatedpath == config_mappings[cfginfo] then
- _p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>', premake.esc(cfginfo.name))
- config_mappings[cfginfo] = nil --only one source file per pch
- end
- end
- _p(2,'</ClCompile>')
+ vc2010.individualSourceFile(prj, config_mappings, file)
end
_p(1,'</ItemGroup>')
end