-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (76 loc) · 3.05 KB
/
Makefile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
SHELL := /bin/bash
VENV = lpastar_venv
PYTHON = $(VENV)/bin/python3
PIP = $(VENV)/bin/pip3
VERSION=0.0.1
PACKAGE=lpastar_pf
ARTIFACT="$(PACKAGE)/dist/$(PACKAGE)-$(VERSION)-py3-none-any.whl"
ROS_DISTRO=foxy
ROS_PATH_TO_CONFIG=ros/ros2_ws/src/config/pf_default_config.yaml
ROS=ros2
ROS_BUILD=colcon
ROSDEP=rosdep
CUR=$(PWD)
.PHONY: init test build install clean ros_interfaces ros_node \
ros_node_docker ros_run ros_run_docker ros_node_only ros_run_only \
help
help:
@echo "========================================================================="
@echo ""
@echo "Use [init] target to initialize venv and install requirements"
@echo ""
@echo "Use [test] target to initialize venv and run path-finder tests"
@echo ""
@echo "Use [build] target to run tests and build path-finder package"
@echo ""
@echo "Use [install] target to build and install path-finder package"
@echo ""
@echo "Use [clean] target to clean"
@echo ""
@echo "Use [ros_interfaces] target to build ROS2 interfaces"
@echo ""
@echo "Use [ros_node | ros_node_docker] target to build ROS2 interfaces and path-finder node with path-finder package installation"
@echo ""
@echo "Use [ros_node_only] target to build ROS2 interfaces and path-finder node without path-finder package installation"
@echo ""
@echo "Use [ros_run | ros_run_docker] target to build ROS2 interfaces and path-finder node with path-finder package installation and run it"
@echo ""
@echo "=========================================================================="
# lpastar_pf package targets
$(VENV)/bin/activate: requirements.txt
if [ ! -d "./lpastar_venv" ]; then python3 -m venv lpastar_venv; fi
$(PIP) install -r requirements.txt
init: requirements.txt
if [ ! -d "./lpastar_venv" ]; then python3 -m venv lpastar_venv; fi
$(PIP) install -r requirements.txt
test: $(VENV)/bin/activate
pytest lpastar_pf
$(ARTIFACT): $(VENV)/bin/activate test
$(PYTHON) -m build $(PACKAGE)
build: $(VENV)/bin/activate test
$(PYTHON) -m build $(PACKAGE)
install: $(ARTIFACT)
$(PIP) uninstall $(PACKAGE)
$(PIP) install $(ARTIFACT)
clean:
rm -rf $(PACKAGE)/dist
rm -rf .pytest_cache
rm -rf __pycache__
# ros targets
ros_interfaces:
cd ros/ros2_ws; $(ROSDEP) install -i --from-path src --rosdistro $(ROS_DISTRO) -y; \
$(ROS_BUILD) build --packages-select pf_interfaces; source install/setup.bash; cd $(CUR)
ros_node: install ros_interfaces
cd ros/ros2_ws; echo $(PWD); $(ROSDEP) install -i --from-path src --rosdistro $(ROS_DISTRO) -y; \
$(ROS_BUILD) build --packages-select ros_lpastar_pf; source install/setup.bash; cd $(CUR)
ros_node_only: ros_interfaces
cd ros/ros2_ws; echo $(PWD); $(ROSDEP) install -i --from-path src --rosdistro $(ROS_DISTRO) -y; \
$(ROS_BUILD) build --packages-select ros_lpastar_pf; source install/setup.bash; cd $(CUR)
ros_node_docker:
echo "docker TODO"
ros_run: ros_node
export PYTHONPATH=$(PWD)/lpastar_venv/lib/python3.8/site-packages:$(PYTHONPATH); \
source ros/ros2_ws/install/setup.bash; \
$(ROS) run ros_lpastar_pf ros_lpastar_pf $(ROS_PATH_TO_CONFIG)
ros_run_docker: ros_docker
echo "ros run docker TODO"