2 ###| Builder Script |###
4 # Builds all permutations of modules
5 # This script is an attempt to maintain module sanity as new ones are added
7 # Fortunately, sweeping API changes don't happen much anymore...but just in case...
9 # Written by Jacob Alexander 2013 for the Kiibohd Controller
10 # Released into the Public Domain
15 # - Complete non-Scan module permutations (will take extra work)
16 # - Add command line arguments
17 # - Add help flag for usage
18 # - Make sure the script is being run from the correct directory
22 ERROR="\e[5;1;31mERROR\e[0m:"
25 # Scan for list of Scan Modules
26 scanModules=$(ls Scan)
28 # Prune out "invalid" modules (parent modules)
29 scanModules=${scanModules[@]//matrix/}
31 # Create permutation directories
32 # Then run cmake, and run each build permutation
33 # Keeping track of how many builds failed/passed
34 for module in $scanModules; do
35 # Create directory, but do not error if it exists already
36 mkdir -p build/$module
39 # Make sure CMake has been run, and attempt to build
40 cmake -DScanModuleOverride=$module ../.. && make || let failCount++
42 # Cleanup, for the next build
46 totalModules=$(echo $scanModules | wc -w)
47 if (( failCount > 0 )); then
48 echo -e "$ERROR $failCount/$totalModules failed"
50 echo -e "Build Success!"