diff options
Diffstat (limited to 'qmake-features/config-output.prf')
-rw-r--r-- | qmake-features/config-output.prf | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/qmake-features/config-output.prf b/qmake-features/config-output.prf new file mode 100644 index 0000000..e52b4c9 --- /dev/null +++ b/qmake-features/config-output.prf @@ -0,0 +1,54 @@ +defineReplace(yesNo) { + if ($$1):return("yes") + else:return("no") +} + +defineTest(printConfigLine) { + !build_pass:return + + msg="$$1" + val=$$2 + color=$$3 + width=$$4 + + isEmpty(width):width = 30 + + unix:system("tty -s") { # check if we are on unix and stdout is a tty + equals(color, "auto") { + yesmatch = $$find(val, "^yes") + nomatch = $$find(val, "^no") + automatch = $$find(val, "^auto") + + !isEmpty(yesmatch):color = "green" + else:!isEmpty(nomatch):color = "red" + else:!isEmpty(automatch):color = "yellow" + } + equals(color, "red"): prolog=$$system(echo "\\\\033")[31;1m + else:equals(color, "green"): prolog=$$system(echo "\\\\033")[32;1m + else:equals(color, "yellow"): prolog=$$system(echo "\\\\033")[33;1m + else:equals(color, "orange"): prolog=$$system(echo "\\\\033")[33m + else:equals(color, "white"): prolog=$$system(echo "\\\\033")[37;1m + epilog = $$system(echo "\\\\033")[0m + } + + isEmpty(msg)|contains(msg, "^-- .*") { + log($$prolog$$section(msg, "-- ", 1, -1)$$epilog$$escape_expand(\\n)) + return() + } + + # The tricky part: there are no arithmetic functions in qmake! + # Start by createing an array of strings, where the string at [i] consists of i dots + # We need it the other way around though, hence the reverse at the end (sadly you + # cannot run a $$width..1 loop, although 30..1 does work). + for(i, 1..$$width) { + spacingEntry="" + for (j, 1..$$i) { spacingEntry += "." } + spacing += $$join(spacingEntry) + } + spacing = $$reverse(spacing) + + # convert a string into an array of characters, so we can get the length via size() + msgArray = $$split(msg,) + + log(" $$msg $$member(spacing, $$size(msgArray)) $$prolog$$val$$epilog$$escape_expand(\\n)") +} |