2 # Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved
4 # Build script utilities
6 # 1) in your build script, define the function
12 # it should handle $1 as the switch for different commands
13 # if you want to run an existing command, use run_command <x> to do it.
16 # 2) at the end of the build script, include:
18 # source vg/vg_build.sh
20 # this runs the triggers that are passed in from the invoker
23 # 3) targets with standard tool support should run the command:
27 # make sure _compiler _options, and _ext are setup for that target
28 # these will only invoke the tooling compilers if tools is passed to the
32 # ==============================================================================
35 echo -e "\033[1;31mError:\e[0m $@"
40 echo -e "\033[1;33mWarning:\e[0m $@"
44 echo -e "\033[1;32mSuccess:\e[0m $@"
48 echo -e "\033[0;37m$@\e[0m"
53 echo -e "\033[1;35m$@\e[0m"
54 echo "================================================================"
58 titleit
" vg_build.sh ver: 2.0\n"
61 # ==============================================================================
63 compiler_cache
="ccache"
65 # Autodetect ccache unavailible
66 if ! [ -x "$( command -v $compiler_cache )" ]; then
71 cmd
="$compiler_cache $_compiler
77 -o $_folder/$_dst$_ext
85 error
"compiler failed"
88 success
"Compiled item\n"
92 # ==============================================================================
96 if [ $enable_tools = true
]; then source vg
/src
/tools.sh
; fi