Skip to content

Commit

Permalink
22.10.24 add: update build menu
Browse files Browse the repository at this point in the history
  • Loading branch information
xuarehere committed Oct 23, 2022
1 parent d42014d commit cbffe23
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 25 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
* @Author: xuarehere
* @Date: 2022-09-18 04:14:53
* @LastEditTime: 2022-10-23 13:50:12
* @LastEditTime: 2022-10-23 17:00:17
* @LastEditors: xuarehere
* @Description:
* @FilePath: /yolov7_deepsort_tensorrt/README.md
Expand Down Expand Up @@ -128,12 +128,29 @@ python3 tools/deploy/onnx_export.py --config-file configs/Market1501/mgn_R50-ibn
We provide a default video for inference(`001.avi`). You could change it with yours.

**5. Buid project**

5.1 Use `build.sh`
```
cd scripts
bash build.sh
```

If the directory `./build` exists, you want to remove it and build it again, please use the command:

```
mkdir build
cd scripts
bash build_new.sh
bash build.sh rm
```

5.2 Build it manually

```
mkdir build
cd scripts
cd ../build/ && cmake .. && make -j$(nproc) && cd -
```


**6. Run demo**
```
cd scripts
Expand Down
86 changes: 86 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash

###
# @Author: xuarehere
# @Date: 2022-10-23 14:45:29
# @LastEditTime: 2022-10-23 16:55:46
# @LastEditors: xuarehere
# @Description:
# @FilePath: /yolov7_deepsort_tensorrt/scripts/build.sh
#
###
dir_path="../build"
file_name="$0"
dir_status=-1
input_example="
\t 1) bash $file_name \n
\t It is to build the directory \"../build\". \n
\n
\t 2) bash $file_name rm \n
\t The directory \"../build\" exists. And it will remove the directory \"../build\" and build it again.
"

function build_again() {
cd $1 && make -j$(nproc) && cd -
}


function build_new () {
cd $1 && cmake .. && make -j$(nproc) && cd -
}

function build(){
if [ $1 == "0" ]
then
build_new $2
elif [ $1 == "1" ]
then
build_again $2
else
echo 'no build options'
fi
}

function check_dir_exist () {
# echo "$1" # arguments are accessible through $1, $2,...
if [ -d $1 ];then
echo "$1 exists"
echo "1"
return $?
else
echo "$1 does not exist"
mkdir $1
echo "0"
return $?
fi
}

function main(){
args_nums=($#)
args="$@"
echo "num of args: $args_nums"

dir_status=$(check_dir_exist $dir_path)
dir_status=$(echo ${dir_status: -1}) # get the last one str

if [ $args_nums -ge "2" ] # greater or equal
then
echo -e "\033[31m Input args error! Please input again! \033[0m"
echo -e $input_example
elif [[ $args_nums -eq "1" && $args = "rm" ]] # rm dir and rebuild
then
rm -r $dir_path
dir_status=$(check_dir_exist $dir_path)
dir_status=$(echo ${dir_status: -1}) # get the last one str
build $dir_status $dir_path
elif [ $args_nums == "0" ] # build
then
build $dir_status $dir_path
else
echo -e "\033[31m Input args error! Please input again! \033[0m"
echo -e $input_example
fi
}


main $@
11 changes: 0 additions & 11 deletions scripts/build_again.sh

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/build_new.sh

This file was deleted.

0 comments on commit cbffe23

Please sign in to comment.