Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
109 lines (87 loc) · 4.55 KB
/
Copy pathMakefile
File metadata and controls
109 lines (87 loc) · 4.55 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
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
98
99
100
101
102
103
104
105
106
107
108
109
PYSRC = python
CPPSRC = src
COMPILE_MODE = Release
WHEELHOUSE = wheelhouse
CORE_WHEELHOUSE = ${WHEELHOUSE}/core
PY_EXT_WHEELHOUSE = ${WHEELHOUSE}/py_extensions
CPP_EXT_WHEELHOUSE = ${WHEELHOUSE}/cpp_extensions
PY_EXTENSIONS ?= rcs_realsense rcs_robotiq2f85 rcs_ur5e rcs_usb_cam rcs_xarm7 rcs_zed
CPP_EXTENSIONS ?= rcs_fr3 rcs_panda rcs_so101
# set to pypi to publish to the real index
PYPI_REPOSITORY ?= testpypi
LINT_EXCLUDE_RUFF = --exclude examples/teleop/SimPublisher
LINT_EXCLUDE_MYPY = 'build|examples/teleop/SimPublisher|examples/inference/franka.py'
# CPP
cppcheckformat:
clang-format --dry-run -Werror -i $(shell find ${CPPSRC} -name '*.cpp' -o -name '*.cc' -o -name '*.h')
cppformat:
clang-format -Werror -i $(shell find ${CPPSRC} -name '*.cpp' -o -name '*.cc' -o -name '*.h')
cpplint:
clang-tidy -p=build --warnings-as-errors='*' $(shell find ${CPPSRC} -name '*.cpp' -o -name '*.cc' -name '*.h')
# import errors
# clang-tidy -p=build --warnings-as-errors='*' $(shell find extensions/rcs_fr3/src -name '*.cpp' -o -name '*.cc' -name '*.h')
gcccompile:
cmake -DCMAKE_BUILD_TYPE=${COMPILE_MODE} -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -B build -G Ninja $(if ${PYTHON_EXECUTABLE},-DPython3_EXECUTABLE=${PYTHON_EXECUTABLE})
cmake --build build --target _core
clangcompile:
cmake -DCMAKE_BUILD_TYPE=${COMPILE_MODE} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -B build -G Ninja $(if ${PYTHON_EXECUTABLE},-DPython3_EXECUTABLE=${PYTHON_EXECUTABLE})
cmake --build build --target _core
# Auto generation of CPP binding stub files
stubgen:
pybind11-stubgen -o python --numpy-array-use-type-var --sort-by topological rcs
find ./python -name '*.pyi' -print | xargs sed -i '1s/^/# ATTENTION: auto generated from C++ code, use `make stubgen` to update!\n/'
find ./python -not -path "./python/rcs/_core/*" -name '*.pyi' -delete
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/tuple\[typing\.Literal\[\([0-9]\+\)\], typing\.Literal\[1\]\]/tuple\[typing\.Literal[\1]\]/g'
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/tuple\[\([M|N]\), typing\.Literal\[1\]\]/tuple\[\1\]/g'
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/class RobotConfig/class RobotConfig(typing.Generic[M])/g'
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/class SimRobotConfig(rcs._core.common.RobotConfig)/class SimRobotConfig(rcs._core.common.RobotConfig[M])/g'
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/class DynamicJointState/class DynamicJointState(typing.Generic[M])/g'
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/N = typing.TypeVar("N", bound=int)//g'
find ./python/rcs/_core -name '*.pyi' -print | xargs sed -i 's/, N/, M/g'
python ci_scripts/generate_common_typing.py
ruff check --fix python/rcs/_core python/rcs/common_typing.py
isort python/rcs/_core python/rcs/common_typing.py
black python/rcs/_core python/rcs/common_typing.py
# Python
pycheckformat:
isort --check-only ${PYSRC} extensions examples
black --check ${PYSRC} extensions examples
pyformat:
isort ${PYSRC} extensions examples
black ${PYSRC} extensions examples
pylint: ruff mypy
ruff:
ruff check ${PYSRC} extensions examples ${LINT_EXCLUDE_RUFF}
mypy:
mypy ${PYSRC} extensions examples --install-types --non-interactive --no-namespace-packages --exclude ${LINT_EXCLUDE_MYPY}
pytest:
pytest -vv
bump:
cz bump
commit:
cz commit
buildcorewheels:
rm -rf ${CORE_WHEELHOUSE}
cibuildwheel --platform auto --output-dir ${CORE_WHEELHOUSE} .
twine check ${CORE_WHEELHOUSE}/*.whl
uploadcorewheels:
twine upload --repository ${PYPI_REPOSITORY} ${CORE_WHEELHOUSE}/*.whl
buildpyextensionwheels:
rm -rf ${PY_EXT_WHEELHOUSE}
for ext in ${PY_EXTENSIONS}; do \
uv build --wheel --out-dir ${PY_EXT_WHEELHOUSE} extensions/$$ext || exit 1; \
done
twine check ${PY_EXT_WHEELHOUSE}/*.whl
uploadpyextensionwheels:
twine upload --repository ${PYPI_REPOSITORY} ${PY_EXT_WHEELHOUSE}/*.whl
buildcppextensionwheels:
rm -rf ${CPP_EXT_WHEELHOUSE}
rm -rf dist/core && mkdir -p dist/core
cp ${CORE_WHEELHOUSE}/*.whl dist/core/
for ext in ${CPP_EXTENSIONS}; do \
cibuildwheel --platform auto --output-dir ${CPP_EXT_WHEELHOUSE} extensions/$$ext || exit 1; \
done
twine check ${CPP_EXT_WHEELHOUSE}/*.whl
uploadcppextensionwheels:
twine upload --repository ${PYPI_REPOSITORY} ${CPP_EXT_WHEELHOUSE}/*.whl
.PHONY: cppcheckformat cppformat cpplint gcccompile clangcompile stubgen pycheckformat pyformat pylint ruff mypy pytest bump commit buildcorewheels uploadcorewheels buildpyextensionwheels uploadpyextensionwheels buildcppextensionwheels uploadcppextensionwheels