1#!/bin/bash 2 3set -e # Fail on any error. 4set -x # Display commands being run. 5 6BUILD_ROOT=$PWD 7 8cd github/marl 9 10git submodule update --init 11 12if [ "$BUILD_SYSTEM" == "cmake" ]; then 13 mkdir build 14 cd build 15 16 cmake .. -DMARL_BUILD_EXAMPLES=1 -DMARL_BUILD_TESTS=1 -DMARL_BUILD_BENCHMARKS=1 -DMARL_WARNINGS_AS_ERRORS=1 17 make -j$(sysctl -n hw.logicalcpu) 18 19 ./marl-unittests 20 21 ./fractal 22 ./primes > /dev/null 23elif [ "$BUILD_SYSTEM" == "bazel" ]; then 24 # Get bazel 25 curl -L -k -O -s https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-darwin-x86_64.sh 26 mkdir $BUILD_ROOT/bazel 27 sh bazel-0.29.1-installer-darwin-x86_64.sh --prefix=$BUILD_ROOT/bazel 28 rm bazel-0.29.1-installer-darwin-x86_64.sh 29 # Build and run 30 $BUILD_ROOT/bazel/bin/bazel test //:tests --test_output=all 31 $BUILD_ROOT/bazel/bin/bazel run //examples:fractal 32 $BUILD_ROOT/bazel/bin/bazel run //examples:primes > /dev/null 33else 34 echo "Unknown build system: $BUILD_SYSTEM" 35 exit 1 36fi