New API in premake-dev: removes

New in premake-dev today is the ability to remove values previously specified in a configuration list. As an example, say you've specified a list of flags at the solution level, so they will be used by all of your projects.

solution "MySolution"
    flags { "ExtraWarnings", "NoExceptions", "NoRTTI" }

But you have one project that needs exceptions and RTTI. You can now remove those flags for that one project using the new remove...() functions.

project "MyProject"
    removeflags { "NoExceptions", "NoRTTI" }

All list APIs get a corresponding remove: removedefines(), removeincludedirs(), even removefiles(). The remove functions support wildcards; this example removes the WIN32 and WIN64 defines.

defines { "WIN32", "WIN64", "LINUX" }
removedefines "WIN*"

I've started a documentation page on the premake-dev wiki. Feedback appreciated as always,

Great news! Next step could be replacing "No" flags with positive values to improve consistency (i.e., have "Exceptions" and "RTTI" predefined, and use

removeflags { "Exceptions", "RTTI" }

when they are not needed.

I'm a bit worried about possibility of presence of "*" character inside defined macro names though.

It seems that remove\excludes were not working, so in project.lua in the function project.getsourcetree(prj)
I've modified the following code:

		-- find *all* files referenced by the project, regardless of configuration
		local files = {}
		for _, block in ipairs(prj.blocks) do
			for _, file in ipairs(block.files) do
				local excluded = false
				for _, exclude in ipairs(block.excludes) do
					excluded = (file == exclude)
					if (excluded) then break end
				end
 
				if (not excluded) then
					files[file] = file
				end
			end
		end

Regards,

GENTS

Sorry... previous post is mine...
The code above was edited starting from premake-dev branch ;)

>The code was added to premake-dev branch

Which one?