|
| 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