]> git.donarmstrong.com Git - kiibohd-controller.git/blob - buildall.bash
Fixing CMake dependency checking for kll_defs.h
[kiibohd-controller.git] / buildall.bash
1 #!/bin/bash
2 ###| Builder Script |###
3 #
4 # Builds all permutations of modules
5 # This script is an attempt to maintain module sanity as new ones are added
6 #
7 # Fortunately, sweeping API changes don't happen much anymore...but just in case...
8 #
9 # Written by Jacob Alexander 2013 for the Kiibohd Controller
10 # Released into the Public Domain
11 #
12 ###
13
14 ## TODO List ##
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
19
20
21 main() {
22         ERROR="\e[5;1;31mERROR\e[0m:"
23         failCount=0
24
25         # Scan for list of Scan Modules
26         scanModules=$(ls Scan)
27
28         # Prune out "invalid" modules (parent modules)
29         scanModules=${scanModules[@]//matrix/}
30
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
37                 cd build/$module
38
39                 # Make sure CMake has been run, and attempt to build
40                 cmake -DScanModuleOverride=$module ../.. && make || let failCount++
41
42                 # Cleanup, for the next build
43                 cd - > /dev/null
44         done
45
46         totalModules=$(echo $scanModules | wc -w)
47         if (( failCount > 0 )); then
48                 echo -e "$ERROR $failCount/$totalModules failed"
49         else
50                 echo -e "Build Success!"
51         fi
52 }
53
54
55 #| Main Script Entry
56 main "$@"
57
58
59 exit 0
60