1#!/bin/bash 2 3set -e # Fail on any error. 4set -x # Display commands being run. 5 6pushd `dirname $0` 7 8if ! [ -x "$(command -v cmake)" ]; then 9 echo 'cmake is not found. Please install it (e.g. sudo apt install cmake)' >&2 10 exit 1 11fi 12 13if ! [ -x "$(command -v dot)" ]; then 14 echo 'graphviz (dot) is not found. Please install it (e.g. sudo apt install graphviz)' >&2 15 exit 1 16fi 17 18cmake_binary_dir=$1 19 20if [[ -z "${cmake_binary_dir}" ]]; then 21 cmake_binary_dir="../../build" 22fi 23 24cp ./CMakeGraphVizOptions.cmake ${cmake_binary_dir}/ 25 26pushd ${cmake_binary_dir} 27 28cmake --graphviz=SwiftShader.dot .. 29dot -Tpng -o SwiftShader.png SwiftShader.dot 30 31if [ "$(uname)" == "Darwin" ]; then 32 open SwiftShader.png 33else 34 xdg-open SwiftShader.png &>/dev/null & 35fi 36 37popd 38popd 39