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