Created
July 17, 2012 10:36
-
-
Save dln/3128643 to your computer and use it in GitHub Desktop.
Continuous build on the cheap, using inotify, cmake and a terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Watch paths (given as arguments), automatically build when something changes. | |
# The script does a couple opinionated things to make my life easier: | |
# | |
# * Terminal scrollbuffer is reset before each iteration, simplifying scrolling. | |
# * I use a filter script to colorize gcc output (clang errors would be nicer). | |
# * Output is copied to a log file (/tmp/build.log). | |
# - I open this file in Sublime or vim, which reloads the file on change (each build). | |
# | |
# Usage: | |
# | |
# devbox:myproject$ mkdir -p build && cd build | |
# devbox:build$ cmake .. | |
# devbox:build$ inotify-cmake ../src ../test ../CMakeLists.txt | |
# ... Profit! | |
# | |
# Note: highlight-gcc.py comes from https://gist.github.com/2189147 | |
inotifywait -q -r -e create,modify,move,delete $@ && \ | |
echo -ne "\033c" && \ | |
(cmake --build . && echo done.) 2>&1 | tee /tmp/build.log \ | |
| highlight-gcc.py -o | |
exec $0 $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment