diff options
Diffstat (limited to 'fuzzylite/build.sh')
-rwxr-xr-x | fuzzylite/build.sh | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/fuzzylite/build.sh b/fuzzylite/build.sh index 78343c4..da39905 100755 --- a/fuzzylite/build.sh +++ b/fuzzylite/build.sh @@ -1,19 +1,46 @@ #!/bin/bash +if [ -z "$FL_USE_FLOAT" ]; then + FL_USE_FLOAT="OFF" +fi + +if [ -z "$FL_CPP98" ]; then + FL_CPP98="OFF" +fi + +if [ -z "$FL_BUILD_TESTS" ]; then + FL_BUILD_TESTS="OFF" +fi + debug(){ + set -e mkdir -p debug cd debug - cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DFL_BACKTRACE=ON -DFL_USE_FLOAT=OFF -DFL_CPP11=OFF - make + cmake .. -G"Unix Makefiles" -DFL_USE_FLOAT=${FL_USE_FLOAT} -DFL_CPP98=${FL_CPP98} -DCMAKE_BUILD_TYPE=Debug -DFL_BACKTRACE=ON -DFL_BUILD_TESTS=${FL_BUILD_TESTS} + make all + if [ "${FL_BUILD_TESTS}" == "ON" ]; then + (export CTEST_OUTPUT_ON_FAILURE=TRUE; make test) + fi cd .. } release(){ + set -e mkdir -p release cd release - cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFL_BACKTRACE=ON -DFL_USE_FLOAT=OFF -DFL_CPP11=OFF - make + cmake .. -G"Unix Makefiles" -DFL_USE_FLOAT=${FL_USE_FLOAT} -DFL_CPP98=${FL_CPP98} -DCMAKE_BUILD_TYPE=Release -DFL_BACKTRACE=ON -DFL_BUILD_TESTS=${FL_BUILD_TESTS} + make all + if [ "${FL_BUILD_TESTS}" == "ON" ]; then + (export CTEST_OUTPUT_ON_FAILURE=TRUE; make test) + fi + cd .. +} + +documentation(){ + set -e cd .. + doxygen Doxyfile + cd - } all(){ @@ -37,20 +64,21 @@ usage(){ } ############################# +echo "Parameters: $@" -OPTIONS=( "all" "debug" "release" "clean" "help") +OPTIONS=( "all" "release" "debug" "clean" "documentation" "help") BUILD=( ) for arg in "$@" do if [[ "$arg" == "help" ]]; then usage && exit 0; fi - if [[ "$arg" == "all" || "$arg" == "debug" || "$arg" == "release" || "$arg" == "clean" ]]; + if [[ "$arg" == "all" || "$arg" == "debug" || "$arg" == "release" || "$arg" == "clean" || "$arg" == "documentation" ]]; then BUILD+=( $arg ); else echo "Invalid option: $arg" && usage && exit 2; fi done -if [ ${#BUILD[@]} -eq 0 ]; then BUILD+=( "all" ); fi +if [ ${#BUILD[@]} -eq 0 ]; then BUILD+=( "release" "debug" ); fi echo "Building schedule: ${BUILD[@]}" echo "Starting in 3 seconds..." |