forked from ekberndt/TensorRT-ROS-YOLOv8
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (51 loc) · 2.16 KB
/
Makefile
File metadata and controls
60 lines (51 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Convenience targets for the TensorRT-ROS-YOLOv8 workspace.
# Usage: make <target>
.ONESHELL:
SHELL := /bin/bash
.DEFAULT_GOAL := help
.PHONY: help
help:
@echo "Available targets:"
@echo " build Build with colcon (release)"
@echo " build-debug Build with colcon (debug symbols)"
@echo " clean Remove build/, install/, and log/"
@echo " install-opencv-cuda Build & install OpenCV with CUDA system-wide"
@echo " (OPENCV_VERSION=<x.y.z> CUDA_BIN_ARCH=<x.y>)"
@echo " uninstall-opencv-cuda Uninstall the OpenCV build produced above"
@echo " (OPENCV_VERSION=<x.y.z>)"
@echo " copy-engine Copy built engines out of install/ to ./"
@echo " return-engine Restore an engine into install/ (ENGINE=<file>)"
.PHONY: clean
clean:
rm -rf build/ install/ log/
.PHONY: build
build:
colcon build
.PHONY: build-debug
build-debug:
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug
# Build and install OpenCV with CUDA support system-wide.
# Inputs: OPENCV_VERSION (e.g. 4.8.0), CUDA_BIN_ARCH (your GPU's compute capability, e.g. 8.9)
.PHONY: install-opencv-cuda
install-opencv-cuda:
@if [ -z "$(OPENCV_VERSION)" ] || [ -z "$(CUDA_BIN_ARCH)" ]; then \
echo "OPENCV_VERSION and CUDA_BIN_ARCH must be set."; exit 1; \
fi
source ./src/yolov8/scripts/install_opencv.sh $(OPENCV_VERSION) $(CUDA_BIN_ARCH)
.PHONY: uninstall-opencv-cuda
uninstall-opencv-cuda:
@if [ -z "$(OPENCV_VERSION)" ]; then \
echo "OPENCV_VERSION must be set (the version originally installed)."; exit 1; \
fi
source ./src/yolov8/scripts/uninstall_opencv.sh $(OPENCV_VERSION)
# Copy generated engine files out of install/ so they survive a `make clean`.
# Fails (intentionally, via cp's exit code) if there are no engines to copy.
.PHONY: copy-engine
copy-engine:
cp install/yolov8/share/yolov8/models/engines/* .
# Restore a previously saved engine into install/. Inputs: ENGINE=<path>
.PHONY: return-engine
return-engine:
@if [ -z "$(ENGINE)" ]; then echo "ENGINE parameter not set."; exit 1; fi
mkdir -p install/yolov8/share/yolov8/models/engines/
cp $(ENGINE) install/yolov8/share/yolov8/models/engines/