diff options
author | Oliver Schneider <oliver@assarbad.net> | 2017-04-12 00:39:19 +0300 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2017-04-12 00:39:19 +0300 |
commit | 88db6a2ab92f882b4ba13d73868bdaa2d4687aae (patch) | |
tree | 847fb7702105237ff45634e585b4fee8c8875db0 /premake4.lua | |
parent | 199dfb07ada3f9ff3b99d768c62eb11e70fed78a (diff) |
Fixed a glitch ... node should have passed to the newly introduced function as well
--HG--
branch : WDS-build
Diffstat (limited to 'premake4.lua')
-rw-r--r-- | premake4.lua | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/premake4.lua b/premake4.lua index 62c9a3d..c45cb11 100644 --- a/premake4.lua +++ b/premake4.lua @@ -46,7 +46,7 @@ do local tree = premake.tree print "Magic happens for old premake4 versions faulty CompileAs handling for VS2010 and newer ..." -- A boilerplate implementation - vc200x.individualSourceFile = function(prj, depth, fname) + vc200x.individualSourceFile = function(prj, depth, fname, node) -- handle file configuration stuff. This needs to be cleaned up and simplified. -- configurations are cached, so this isn't as bad as it looks for _, cfginfo in ipairs(prj.solution.vstudio_configs) do @@ -159,6 +159,48 @@ do end end end + -- Make UUID generation for filters deterministic + if os.str2uuid ~= nil then + local vc2010 = premake.vstudio.vc2010 + vc2010.filteridgroup = function(prj) + local filters = { } + local filterfound = false + + for file in project.eachfile(prj) do + -- split the path into its component parts + local folders = string.explode(file.vpath, "/", true) + local path = "" + for i = 1, #folders - 1 do + -- element is only written if there *are* filters + if not filterfound then + filterfound = true + _p(1,'<ItemGroup>') + end + + path = path .. folders[i] + + -- have I seen this path before? + if not filters[path] then + print(prj.uuid or "nothing") + local seed = path .. (prj.uuid or "") + local deterministic_uuid = os.str2uuid(seed) + print("UUID = " .. deterministic_uuid) + filters[path] = true + _p(2, '<Filter Include="%s">', path) + _p(3, '<UniqueIdentifier>{%s}</UniqueIdentifier>', deterministic_uuid) + _p(2, '</Filter>') + end + + -- prepare for the next subfolder + path = path .. "\\" + end + end + + if filterfound then + _p(1,'</ItemGroup>') + end + end + end -- Name the project files after their VS version local orig_getbasename = premake.project.getbasename premake.project.getbasename = function(prjname, pattern) @@ -363,10 +405,10 @@ solution "Premake4" value = "path", description = "Set the output location for the generated files" } - newoption { - trigger = "xp", - description = "Enable XP-compatible build for newer Visual Studio versions." - } + newoption { + trigger = "xp", + description = "Enable XP-compatible build for newer Visual Studio versions." + } |