---
title: build.sh
description: "```"
url: "https://www.hiascend.com/document/detail/zh/canncommercial/900/API/ascendtb/ascendtb_0075.html"
---

# build.sh

```
function compile_model() {
    mkdir -p build; 
    cd build;

    cmake ..;
    if [ $? -ne 0 ]; then
        echo "ERROR: generate makefile failed!"
        exit 1
    fi

    cmake --build . -j;
    if [ $? -ne 0 ]; then
        echo "ERROR: compile test failed!"
        exit 1
    else
        echo "INFO: compile test succeed!"
    fi
    cd -;

}

compile_model
```
