---
title: build.sh
description: "```"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendtb/ascendtb_0075.html
sourcePath: /source/zh/canncommercial/900/API/ascendtb/ascendtb_0075.html
indexId: 146dfd7bb1cae77a719ef38511d319f40bcbd7748dd70cf9194f7dc0b5857ac761
---
# 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
```
