Skip to content

Commit cfc7267

Browse files
authored
Initial pixi support (#32)
1 parent 5d6d23a commit cfc7267

7 files changed

Lines changed: 10136 additions & 0 deletions

File tree

.clangd

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
CompileFlags:
2+
CompilationDatabase: build/roboplan/
3+
If:
4+
PathMatch:
5+
- roboplan/.*
6+
---
7+
CompileFlags:
8+
CompilationDatabase: build/roboplan_rrt/
9+
If:
10+
PathMatch:
11+
- roboplan_rrt/.*
12+
---
13+
CompileFlags:
14+
CompilationDatabase: build/roboplan_simple_ik/
15+
If:
16+
PathMatch:
17+
- roboplan_simple_ik/.*
18+
---
19+
CompileFlags:
20+
CompilationDatabase: build/roboplan_examples/
21+
If:
22+
PathMatch:
23+
- roboplan_examples/.*
24+
---
25+
CompileFlags:
26+
CompilationDatabase: build/roboplan_example_models/
27+
If:
28+
PathMatch:
29+
- roboplan_example_models/.*
30+
---
31+
CompileFlags:
32+
CompilationDatabase: build/bindings/
33+
If:
34+
PathMatch:
35+
- bindings/.*
36+
---

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/build_and_test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,37 @@ jobs:
7777
docker run \
7878
roboplan_ros:${{ github.head_ref || github.ref_name }} \
7979
/bin/bash -c './src/roboplan/scripts/run_tests.bash'
80+
81+
pixi_build_and_test:
82+
env:
83+
SCCACHE_DIR: ${{ github.workspace }}/.sccache
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
ubuntu_version: [22.04, 24.04]
88+
89+
runs-on: ubuntu-${{ matrix.ubuntu_version }}
90+
steps:
91+
- name: Check out repository
92+
uses: actions/checkout@v4
93+
# Cache build directories and sccache
94+
- name: Cache build directories and sccache
95+
uses: actions/cache@v4
96+
with:
97+
path: |
98+
${{ env.SCCACHE_DIR }}
99+
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
100+
restore-keys: |
101+
${{ runner.os }}-build-${{ github.sha }}
102+
${{ runner.os }}-build
103+
- uses: prefix-dev/setup-pixi@v0.8.3
104+
with:
105+
cache: true
106+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
107+
frozen: true
108+
manifest-path: pixi.toml
109+
- name: Build and test
110+
run: |
111+
pixi run install_all
112+
pixi run build_tests
113+
pixi run test_all

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
**/install/
44

55
.vscode
6+
7+
# pixi environments
8+
.pixi
9+
*.egg-info

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,49 @@ ros2 run roboplan_examples example_scene
6666
```
6767

6868
See the [bindings README](bindings/README.md) for instructions on building the Python bindings.
69+
70+
## Development using pixi
71+
72+
### Build instructions
73+
74+
Make sure to install pixi from [here](https://pixi.sh/latest/#installation).
75+
76+
```bash
77+
git clone https://github.com/sea-bass/roboplan.git
78+
cd roboplan
79+
# Build all packages
80+
pixi run build_all
81+
# Install all packages
82+
pixi run install_all
83+
# This will only build the package (You must have built the dependencies first)
84+
pixi run build PACKAGE_NAME
85+
# This will only install the package
86+
pixi run install PACKAGE_NAME
87+
```
88+
89+
90+
### Run tests
91+
92+
```bash
93+
pixi run test_all
94+
# Test a specific package
95+
pixi run test PACKAGE_NAME
96+
```
97+
98+
### Linting
99+
100+
```bash
101+
pixi run lint
102+
```
103+
104+
### Build with AddressSanitizer (ASan)
105+
106+
```bash
107+
pixi run build_asan PACKAGE_NAME
108+
```
109+
110+
### Build with compilation time report
111+
112+
```bash
113+
pixi run build_timetrace PACKAGE_NAME
114+
```

pixi.lock

Lines changed: 9799 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
[workspace]
2+
authors = ["JafarAbdi <jafar.uruc@gmail.com>"]
3+
channels = ["conda-forge"]
4+
name = "roboplan"
5+
platforms = ["linux-64", "linux-aarch64"]
6+
version = "0.0.0"
7+
8+
[activation.env]
9+
CMAKE_INSTALL_MODE = "SYMLINK"
10+
CMAKE_INSTALL_PREFIX = "$CONDA_PREFIX"
11+
LD_LIBRARY_PATH = "$CONDA_PREFIX/lib"
12+
ASAN_OPTIONS = "symbolize=1:print_stacktrace=1"
13+
ASAN_SYMBOLIZER_PATH = "$CONDA_PREFIX/bin/llvm-symbolizer"
14+
15+
[tasks]
16+
configure = { cmd = [
17+
"cmake",
18+
"-GNinja",
19+
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
20+
"-DCMAKE_BUILD_TYPE=RelWithDebInfo",
21+
"-DBUILD_TESTING=ON",
22+
# Use clang as the compiler
23+
"-DCMAKE_C_COMPILER=clang",
24+
"-DCMAKE_CXX_COMPILER=clang++",
25+
# Use mold as the linker
26+
"-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=mold",
27+
"-DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=mold",
28+
"-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=mold",
29+
# Use sccache to speed up compilation
30+
"-DCMAKE_C_COMPILER_LAUNCHER=sccache",
31+
"-DCMAKE_CXX_COMPILER_LAUNCHER=sccache",
32+
# Activate color output with Ninja
33+
"-DCMAKE_COLOR_DIAGNOSTICS=ON",
34+
# Compiler flags
35+
"{{ '-DCMAKE_CXX_FLAGS=' + cxx_flags if cxx_flags }}",
36+
"{{ '-DCMAKE_C_FLAGS=' + cxx_flags if cxx_flags }}",
37+
# Disable warnings about unused command line arguments
38+
"--no-warn-unused-cli",
39+
"-S",
40+
"{{ package_name }}",
41+
"-B",
42+
"build//{{ package_name }}",
43+
], args = [{ arg = "package_name" }, { arg = "cxx_flags", default = "" }] }
44+
build = { cmd = [
45+
"cmake",
46+
"--build",
47+
"build/{{ package_name }}",
48+
], depends-on = [
49+
{ task = "configure", args = [
50+
"{{ package_name }}",
51+
"{{ cxx_flags }}",
52+
] },
53+
], args = [
54+
{ arg = "package_name" },
55+
{ arg = "cxx_flags", default = "" },
56+
] }
57+
install = { cmd = [
58+
"cmake",
59+
"--install",
60+
"build/{{ package_name }}",
61+
"--prefix",
62+
"$CONDA_PREFIX",
63+
], depends-on = [
64+
{ task = "build", args = [
65+
"{{ package_name }}",
66+
"{{ cxx_flags }}",
67+
] },
68+
], args = [
69+
{ "arg" = "package_name" },
70+
{ arg = "cxx_flags", default = "" },
71+
] }
72+
build_bindings = "pip install -e bindings --no-build-isolation"
73+
build_all = { depends-on = [
74+
{ task = "install", args = [
75+
"roboplan_example_models",
76+
] },
77+
{ task = "install", args = [
78+
"roboplan",
79+
] },
80+
{ task = "install", args = [
81+
"roboplan_simple_ik",
82+
] },
83+
{ task = "install", args = [
84+
"roboplan_rrt",
85+
] },
86+
{ task = "build", args = [
87+
"roboplan_examples",
88+
] },
89+
"build_bindings"
90+
] }
91+
install_all = { depends-on = [
92+
{ task = "build_all" },
93+
{ task = "install", args = [
94+
"roboplan_examples",
95+
] },
96+
] }
97+
98+
build_asan = { cmd = [
99+
"cmake",
100+
"--build",
101+
"build/{{ package_name }}",
102+
], depends-on = [
103+
{ task = "configure", args = [
104+
"{{ package_name }}",
105+
"-fsanitize=address",
106+
] },
107+
], args = [
108+
{ arg = "package_name" },
109+
] }
110+
# https://clang.llvm.org/docs/analyzer/developer-docs/PerformanceInvestigation.html#performance-analysis-using-ftime-trace
111+
build_timetrace = { depends-on = [
112+
{ task = "configure", args = [
113+
"{{ package_name }}",
114+
"-ftime-trace",
115+
] },
116+
{ task = "build", args = [
117+
"{{ package_name }}",
118+
] },
119+
], args = [
120+
{ arg = "package_name" },
121+
] }
122+
build_tests = { depends-on = [
123+
{ task = "install", args = [
124+
"roboplan_example_models",
125+
"{{ cxx_flags }}",
126+
"ON",
127+
] },
128+
{ task = "install", args = [
129+
"roboplan",
130+
"{{ cxx_flags }}",
131+
"ON",
132+
] },
133+
{ task = "install", args = [
134+
"roboplan_simple_ik",
135+
"{{ cxx_flags }}",
136+
"ON",
137+
] },
138+
{ task = "install", args = [
139+
"roboplan_rrt",
140+
"{{ cxx_flags }}",
141+
"ON",
142+
] },
143+
{ task = "build", args = [
144+
"roboplan_examples",
145+
"{{ cxx_flags }}",
146+
"ON",
147+
] },
148+
], args = [
149+
{ arg = "cxx_flags", "default" = "" },
150+
] }
151+
152+
# Test related tasks
153+
test = { cmd = "ctest -V --test-dir build/{{ package_name }}", args = [
154+
{ arg = "package_name" },
155+
], env = { GTEST_COLOR = "YES" } }
156+
157+
test_py = { cmd = "python3 -m pytest --capture=no", cwd = "bindings" }
158+
test_cpp = { depends-on = [{ task = "test", args = ["roboplan"] }, { task = "test", args = ["roboplan_rrt"] }] }
159+
test_all = { depends-on = ["test_py", "test_cpp"] }
160+
161+
162+
[dependencies]
163+
164+
# Build dependencies
165+
cmake = ">=3.30.5,<4"
166+
ninja = ">=1.12.1,<2"
167+
clangxx = ">=19.1.7,<20"
168+
gxx = ">=11,<12"
169+
gcc = ">=11,<12"
170+
lld = ">=19.1.2,<20"
171+
libstdcxx = ">=15.1.0,<16"
172+
llvm-openmp = ">=19.1.7,<20"
173+
mold = ">=2.40.2,<3"
174+
sccache = ">=0.10.0,<0.11"
175+
176+
# Core dependencies
177+
eigen = ">=3.4.0,<4"
178+
pinocchio = ">=3.7.0,<4"
179+
180+
# Python binding dependencies
181+
python = ">=3.11,<3.12"
182+
nanobind = ">=2.8.0,<3"
183+
scikit-build-core = ">=0.11.5,<0.12"
184+
numpy = "*"
185+
viser = ">=1.0.0,<2"
186+
187+
# We use pip as a workaround for pixi building the bindings before we build the core packages
188+
# In theory, it should be like this:
189+
# [pypi-dependencies]
190+
# roboplan = { path = "bindings", editable = true }
191+
#
192+
# [pypi-options]
193+
# no-build-isolation = ["roboplan"]
194+
195+
pip = ">=25.1.1,<26"
196+
197+
# Test dependencies
198+
gtest = ">=1.17.0,<2"
199+
# Sanitizer dependencies
200+
llvm-tools = ">=19.1.7,<20"
201+
compiler-rt = ">=19.1.7,<20"
202+
# Python test dependencies
203+
pytest = ">=6"
204+
205+
[pypi-dependencies]
206+
pycollada = ">=0.9.2, <0.10"
207+
208+
[feature.lint.dependencies]
209+
pre-commit = ">=4.1.0,<5"
210+
211+
[feature.lint.tasks]
212+
lint = "pre-commit run --all-files"
213+
214+
[environments]
215+
lint = { features = ["lint"], no-default-feature = true }

0 commit comments

Comments
 (0)