premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.12k stars 612 forks source link

`fileextension` is insufficient #1135

Open TurkeyMan opened 5 years ago

TurkeyMan commented 5 years ago

When defining rules, I've encountered multiple cases where fileextension is insufficient.

Today's occurrence has popped up many times before; I want to write a rule for configure files, which have no file extension.

I think we need to add filepattern and deprecate fileextension, and use filepattern "*.cpp" instead of fileextension ".cpp"

How do we feel about this?

I have also encountered cases where I want to hook a mid-extension like *.mid_ext.*, so I think patterns generalise more nicely than extensions.

starkos commented 5 years ago

Off the top of my head and with no research, I don’t think Visual Studio can support arbitrary patterns.

TurkeyMan commented 5 years ago

:/ ... so you think VS can't make a rule for 'configure' scripts?

TurkeyMan commented 5 years ago

In this case, it only needs to support gmake anyway... but keeping this stuff general is desirable.

starkos commented 5 years ago

Actually, also unconfirmed but I think Xcode also uses file extensions for its rules. Not saying you shouldn't implement the feature, just that it might not be generally useful. You might want to go so far as keeping the fileextension name, and document the cases (just Makefiles at first, I assume) that support more general patterns. That way new users don't get confused, while more advanced users who know what they're doing can still get the feature.

TurkeyMan commented 5 years ago

VS prepends a '*'... https://github.com/premake/premake-core/blob/master/modules/vstudio/vs2010_rules_xml.lua#L358