Skip to content

Commit b04580b

Browse files
committed
Add Pixi dev workflow
1 parent cadcd8f commit b04580b

File tree

2 files changed

+273
-0
lines changed

2 files changed

+273
-0
lines changed

CMakePresets.json

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"version": 5,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 23,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "xsimd-all",
11+
"cacheVariables": {
12+
"ENABLE_XTL_COMPLEX" :"ON",
13+
"BUILD_TESTS": "ON",
14+
"BUILD_BENCHMARK": "ON"
15+
}
16+
},
17+
18+
{
19+
"name": "debug-base",
20+
"hidden": true,
21+
"cacheVariables": {
22+
"CMAKE_BUILD_TYPE" :"Debug"
23+
}
24+
},
25+
{
26+
"name": "release-base",
27+
"hidden": true,
28+
"cacheVariables": {
29+
"CMAKE_BUILD_TYPE" :"Release"
30+
}
31+
},
32+
33+
{
34+
"name": "native-base",
35+
"hidden": true,
36+
"cacheVariables": { "TARGET_ARCH": "native" }
37+
},
38+
{
39+
"name": "sse2-base",
40+
"hidden": true,
41+
"cacheVariables": { "TARGET_ARCH": "x86-64 -mno-sse3" }
42+
},
43+
{
44+
"name": "sse3-base",
45+
"hidden": true,
46+
"cacheVariables": { "TARGET_ARCH": "core2" }
47+
},
48+
{
49+
"name": "ssse3-base",
50+
"hidden": true,
51+
"cacheVariables": { "TARGET_ARCH": "core2 -mssse3" }
52+
},
53+
{
54+
"name": "sse4.1-base",
55+
"hidden": true,
56+
"cacheVariables": { "TARGET_ARCH": "nehalem" }
57+
},
58+
{
59+
"name": "sse4.2-base",
60+
"hidden": true,
61+
"cacheVariables": { "TARGET_ARCH": "nehalem" }
62+
},
63+
{
64+
"name": "avx-base",
65+
"hidden": true,
66+
"cacheVariables": { "TARGET_ARCH": "nehalem -msse4.2" }
67+
},
68+
{
69+
"name": "avx2-base",
70+
"hidden": true,
71+
"cacheVariables": { "TARGET_ARCH": "haswell" }
72+
},
73+
{
74+
"name": "neon-base",
75+
"hidden": true,
76+
"cacheVariables": { "TARGET_ARCH": "armv8-a" }
77+
},
78+
79+
{
80+
"name": "dev-base",
81+
"hidden": true,
82+
"inherits": ["debug-base", "xsimd-all"]
83+
},
84+
{
85+
"name": "debug-native",
86+
"inherits": ["dev-base", "native-base"]
87+
},
88+
{
89+
"name": "debug-sse2",
90+
"inherits": ["dev-base", "sse2-base"]
91+
},
92+
{
93+
"name": "debug-sse3",
94+
"inherits": ["dev-base", "sse3-base"]
95+
},
96+
{
97+
"name": "debug-ssse3",
98+
"inherits": ["dev-base", "ssse3-base"]
99+
},
100+
{
101+
"name": "debug-sse4.1",
102+
"inherits": ["dev-base", "sse4.1-base"]
103+
},
104+
{
105+
"name": "debug-sse4.2",
106+
"inherits": ["dev-base", "sse4.2-base"]
107+
},
108+
{
109+
"name": "debug-avx",
110+
"inherits": ["dev-base", "avx-base"]
111+
},
112+
{
113+
"name": "debug-avx2",
114+
"inherits": ["dev-base", "avx2-base"]
115+
},
116+
{
117+
"name": "debug-neon",
118+
"inherits": ["dev-base", "neon-base"]
119+
}
120+
]
121+
}

pixi.toml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# This is a Pixi configuration file optionally used for development.
2+
#
3+
# Pixi automatically manages Conda environment (in .pixi folder) and series
4+
# of tasks to run in these environment.
5+
# The most relevant task is `test`, that can be run directly.
6+
# Because we created multiple environments for different compilers, it is easier to specify
7+
# it as a command line argument.
8+
#
9+
# pixi run -e clang-21 test
10+
#
11+
# We can also combine it with CMake presets to target a particular architecture, which is
12+
# convenient to test less powerful architecture that one's computer.
13+
#
14+
# pixi run -e clang-21 test dev-sse2
15+
#
16+
# The file is also useful for running development scripts, such as formatting the codebase:
17+
#
18+
# pixi run fmt
19+
#
20+
# All documentation, including installation instructions can be found in at
21+
# https://pixi.sh
22+
23+
24+
[workspace]
25+
channels = ["conda-forge"]
26+
platforms = ["linux-64", "linux-aarch64", "osx-arm64", "osx-64"]
27+
28+
# Basic build tools to include in any compiler environment
29+
[feature.build-tools.dependencies]
30+
cmake = ">=3.16"
31+
ninja = "*"
32+
sccache = "*"
33+
[feature.build-tools.target.linux.dependencies]
34+
binutils = "*"
35+
[feature.build-tools.target.osx.dependencies]
36+
cctools = ">=949.0.1"
37+
ld64 = ">=530"
38+
llvm-openmp = "*"
39+
40+
# Libraries needed by the project
41+
[feature.lib.dependencies]
42+
xtl = "*"
43+
doctest = "*"
44+
45+
# A set of clang dependencies that include a set of unconstrained needed packages.
46+
# We combine it with another feature to pin an exact version.
47+
[feature.clang-base.dependencies]
48+
clang = "*"
49+
clangxx = "*"
50+
[feature.clang-base.activation.env]
51+
CC = "$CONDA_PREFIX/bin/clang"
52+
CFLAGS = "-isystem $CONDA_PREFIX/include"
53+
CXX = "$CONDA_PREFIX/bin/clang++"
54+
CXXFLAGS = "-isystem $CONDA_PREFIX/include"
55+
LDFLAGS = "-Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib"
56+
57+
# clang-18 compiler environment
58+
[feature.clang-18.dependencies]
59+
clang = "18.*"
60+
[environments.clang-18]
61+
features = ["cmd", "build-tools", "lib", "clang-base", "clang-18"]
62+
63+
# clang-21 compiler environment
64+
[feature.clang-21.dependencies]
65+
clang = "21.*"
66+
[environments.clang-21]
67+
features = ["cmd", "build-tools", "lib", "clang-base", "clang-21"]
68+
69+
# A set of gcc dependencies that include a set of unconstrained needed packages.
70+
# We combine it with another feature to pin an exact version.
71+
[feature.gcc-base.target.linux.dependencies]
72+
gcc = "*"
73+
gxx = "*"
74+
[feature.gcc-base.activation.env]
75+
CC = "$CONDA_PREFIX/bin/gcc"
76+
CFLAGS = "-isystem $CONDA_PREFIX/include"
77+
CXX = "$CONDA_PREFIX/bin/g++"
78+
CXXFLAGS = "-isystem $CONDA_PREFIX/include"
79+
LDFLAGS = "-Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib"
80+
81+
# gcc-15 compiler environment
82+
[feature.gcc-15.target.linux.dependencies]
83+
gcc = "15.*"
84+
[environments.gcc-15]
85+
features = ["cmd", "build-tools", "lib", "gcc-base", "gcc-15"]
86+
87+
# A feature to group a set of build and test tasks that can be included in multiple environment
88+
[feature.cmd.tasks.configure]
89+
args = ["preset"]
90+
cmd = """
91+
cmake -B build/$PIXI_ENVIRONMENT_NAME/{{ preset }} -G Ninja \
92+
--preset {{ preset }} \
93+
-D CMAKE_COLOR_DIAGNOSTICS=ON \
94+
-D CMAKE_C_COMPILER_LAUNCHER="sccache" \
95+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
96+
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON \
97+
"""
98+
inputs = ["**/CMakeLists.txt", "**/*.cmake.in", "cmake/"]
99+
outputs = ["build/$PIXI_ENVIRONMENT_NAME/{{ preset }}/CMakeCache.txt"]
100+
101+
[feature.cmd.tasks.build]
102+
args = ["preset"]
103+
cmd = "cmake --build build/$PIXI_ENVIRONMENT_NAME/{{ preset }} --parallel"
104+
depends-on = [{ task = "configure", args = ["{{ preset }}"] }]
105+
106+
[feature.cmd.tasks.test]
107+
args = [{ arg = "preset", default = "debug-native" }]
108+
cmd = "./build/$PIXI_ENVIRONMENT_NAME/{{ preset }}/test/test_xsimd"
109+
depends-on = [{ task = "build", args = ["{{ preset }}"] }]
110+
111+
# A dev feature and environment that contains LSP, formatters etc.
112+
[feature.dev.dependencies]
113+
taplo = "*"
114+
cmake-format = "*"
115+
clang = "17.*"
116+
clangxx = "17.*"
117+
clang-tools = "17.*" # matching clang-format version in CI
118+
lld = "*"
119+
typos-lsp = "*"
120+
neocmakelsp = "*"
121+
[feature.dev.target.linux.dependencies]
122+
gdb = "*"
123+
valgrind = "*"
124+
[feature.dev.target.osx.dependencies]
125+
lldb = "*"
126+
127+
[feature.dev.tasks.fmt-clang]
128+
cmd = "find . -name '*.[ch]pp' | xargs clang-format -i"
129+
inputs = ["**/*.*pp"]
130+
outputs = ["**/*.*pp"]
131+
132+
[feature.dev.tasks.init-lsp]
133+
cmd = "ln -sf build/dev/debug-native/compile_commands.json"
134+
depends-on = [
135+
{ task = "configure", args = [
136+
"debug-native",
137+
], environment = "dev" },
138+
]
139+
outputs = ["compile_commands.json"]
140+
141+
[feature.dev.tasks]
142+
fmt-taplo = "taplo fmt"
143+
fmt = { depends-on = ["fmt-clang", "fmt-taplo"] }
144+
145+
[environments]
146+
dev = { features = [
147+
"build-tools",
148+
"lib",
149+
"clang-base",
150+
"dev",
151+
"cmd",
152+
], solve-group = "default" }

0 commit comments

Comments
 (0)