TODO: - Add Windows Cygwin supportbringup
Keyboard Compiler Scripts | |||||
========================= | |||||
Scripts for major keyboards designed using the Kiibohd firmware. | |||||
Please refer to `<script> --help` for specific details. | |||||
Refer to the [wiki](https://github.com/kiibohd/controller/wiki) on setting up your system for compiling. | |||||
Build Steps | |||||
----------- | |||||
* Try to build once to make sure your system is setup correctly | |||||
* Add any .kll files in the build directory you want | |||||
* Edit `<script>` to include the new .kll files | |||||
* Rebuild | |||||
Example | |||||
------- | |||||
```bash | |||||
./infinity.bash | |||||
``` | |||||
Projects | |||||
-------- | |||||
* infinity.bash (Infinity Keyboard 2014/10/15) | |||||
* template.bash (Example template for new keyboards) | |||||
#!/bin/bash | |||||
# This is bash lib file for the convenience build scripts | |||||
# Don't call this script directly | |||||
# Jacob Alexander 2015 | |||||
# Make sure all of the relevant variables have been set | |||||
# NOTE: PartialMaps and DefaultMap do not have to be set | |||||
VariablesList=(BuildPath BaseMap ScanModule MacroModule OutputModule DebugModule Chip Compiler) | |||||
ExitEarly=false | |||||
for var in ${VariablesList[@]}; do | |||||
if [ -z ${!var+x} ]; then | |||||
echo "ERROR: Unset variable => '${var}'" | |||||
ExitEarly=true | |||||
fi | |||||
done | |||||
# Error was detected, exit immediately | |||||
if $ExitEarly; then | |||||
exit 1 | |||||
fi | |||||
# Prepare PartialMaps | |||||
PartialMapsExpanded="${PartialMaps[1]}" | |||||
count=2 # Start the loop at index 2 | |||||
while [ "$count" -le "${#PartialMaps[@]}" ]; do | |||||
PartialMapsExpanded="${PartialMapsExpanded};${PartialMaps[count]}" | |||||
count=$(($count+1)) | |||||
done | |||||
# Internal Variables | |||||
CMakeListsPath="../.." | |||||
PROG_NAME=$(basename $0) | |||||
# Process the command line arguments (if any) | |||||
while (( "$#" >= "1" )); do | |||||
# Scan each argument | |||||
key="$1" | |||||
case $key in | |||||
-c|--cmakelists-path) | |||||
CMakeListsPath="$2" | |||||
shift | |||||
;; | |||||
-f|--force-rebuild) | |||||
# Remove the old directory first | |||||
rm -rf "${BuildPath}" | |||||
;; | |||||
-o|--output-path) | |||||
BuildPath="$2" | |||||
shift | |||||
;; | |||||
-h|--help) | |||||
echo "Usage: $PROG_NAME [options...]" | |||||
echo "" | |||||
echo "Convenience script to build the source of a given keyboard." | |||||
echo "Edit '$PROG_NAME' to configure the keyboard options such as KLL layouts." | |||||
echo "" | |||||
echo "Arguments:" | |||||
echo " -c, --cmakelists-path PATH Set the path of CMakeLists.txt" | |||||
echo " Default: ${CMakeListsPath}" | |||||
echo " -f, --force-rebuild Deletes the old build directory and rebuilds from scratch." | |||||
echo " -o, --output-path PATH Set the path of the build files." | |||||
echo " Default: ${BuildPath}" | |||||
echo " -h, --help This message." | |||||
exit 1 | |||||
;; | |||||
*) | |||||
echo "INVALID ARG: '$1'" | |||||
exit 2 | |||||
;; | |||||
esac | |||||
# Shift to the next argument | |||||
shift | |||||
done | |||||
# Run CMake commands | |||||
## TODO Check for windows and do windows specific things ## | |||||
mkdir -p "${BuildPath}" | |||||
cd "${BuildPath}" | |||||
cmake -DCHIP="${Chip}" -DCOMPILER="${Compiler}" -DScanModule="${ScanModule}" -DMacroModule="${MacroModule}" -DOutputModule="${OutputModule}" -DDebugModule="${DebugModule}" -DBaseMap="${BaseMap}" -DDefaultMap="${DefaultMap}" -DPartialMaps="${PartialMapsExpanded}" "${CMakeListsPath}" | |||||
make | |||||
echo "Firmware has been compiled into: '${BuildPath}'" | |||||
#!/bin/bash | |||||
# This is a build script template | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
# Feel free to change the variables in this section to configure your keyboard | |||||
BuildPath="template" | |||||
## KLL Configuration ## | |||||
# Generally shouldn't be changed, this will affect every layer | |||||
BaseMap="defaultMap" | |||||
# This is the default layer of the keyboard | |||||
# NOTE: To combine kll files into a single layout, separate them by spaces | |||||
# e.g. DefaultMap="mylayout mylayoutmod" | |||||
DefaultMap="md1Overlay stdFuncMap" | |||||
# This is where you set the additional layers | |||||
# NOTE: Indexing starts at 1 | |||||
# NOTE: Each new layer is another array entry | |||||
# e.g. PartialMaps[1]="layer1 layer1mod" | |||||
# PartialMaps[2]="layer2" | |||||
# PartialMaps[3]="layer3" | |||||
PartialMaps[1]="hhkbpro2" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Keyboard Module Configuration | |||||
ScanModule="MD1" | |||||
MacroModule="PartialMap" | |||||
OutputModule="pjrcUSB" | |||||
DebugModule="full" | |||||
# Microcontroller | |||||
Chip="mk20dx128vlf5" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Load the library | |||||
source cmake.bash | |||||
#!/bin/bash | |||||
# This is a build script template | |||||
# These build scripts are just a convenience for configuring your keyboard (less daunting than CMake) | |||||
# Jacob Alexander 2015 | |||||
################# | |||||
# Configuration # | |||||
################# | |||||
# Feel free to change the variables in this section to configure your keyboard | |||||
BuildPath="template" | |||||
## KLL Configuration ## | |||||
# Generally shouldn't be changed, this will affect every layer | |||||
BaseMap="defaultMap" | |||||
# This is the default layer of the keyboard | |||||
# NOTE: To combine kll files into a single layout, separate them by spaces | |||||
# e.g. DefaultMap="mylayout mylayoutmod" | |||||
DefaultMap="md1Overlay stdFuncMap" | |||||
# This is where you set the additional layers | |||||
# NOTE: Indexing starts at 1 | |||||
# NOTE: Each new layer is another array entry | |||||
# e.g. PartialMaps[1]="layer1 layer1mod" | |||||
# PartialMaps[2]="layer2" | |||||
# PartialMaps[3]="layer3" | |||||
PartialMaps[1]="hhkbpro2" | |||||
PartialMaps[2]="colemak" | |||||
########################## | |||||
# Advanced Configuration # | |||||
########################## | |||||
# Don't change the variables in this section unless you know what you're doing | |||||
# These are useful for completely custom keyboards | |||||
# NOTE: Changing any of these variables will require a force build to compile correctly | |||||
# Keyboard Module Configuration | |||||
ScanModule="MD1" | |||||
MacroModule="PartialMap" | |||||
OutputModule="pjrcUSB" | |||||
DebugModule="full" | |||||
# Microcontroller | |||||
Chip="mk20dx128vlf5" | |||||
# Compiler Selection | |||||
Compiler="gcc" | |||||
######################## | |||||
# Bash Library Include # | |||||
######################## | |||||
# Shouldn't need to touch this section | |||||
# Check if the library can be found | |||||
if [ ! -f cmake.bash ]; then | |||||
echo "ERROR: Cannot find 'cmake.bash'" | |||||
exit 1 | |||||
fi | |||||
# Load the library | |||||
source cmake.bash | |||||