Skip to content

Commit 01b45d2

Browse files
committed
pixi: Refactor pixi.toml
1 parent 274a1c3 commit 01b45d2

File tree

7 files changed

+128
-81
lines changed

7 files changed

+128
-81
lines changed

development/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
To create a release with Pixi run the following commands on the **devel** branch:
44

55
```bash
6-
EIGENPY_VERSION=X.Y.Z pixi run release_new_version
6+
EIGENPY_VERSION=X.Y.Z pixi run release-new-version
77
git push origin
88
git push origin vX.Y.Z
99
```

development/scripts/pixi/activation.bat

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
:: Setup ccache
2-
set CMAKE_CXX_COMPILER_LAUNCHER=ccache
3-
4-
:: Create compile_commands.json for language server
5-
set CMAKE_EXPORT_COMPILE_COMMANDS=1
6-
7-
:: Activate color output with Ninja
8-
set CMAKE_COLOR_DIAGNOSTICS=1
9-
101
:: Set default build value only if not previously set
112
if not defined EIGENPY_BUILD_TYPE (set EIGENPY_BUILD_TYPE=Release)
123
if not defined EIGENPY_PYTHON_STUBS (set EIGENPY_PYTHON_STUBS=ON)

development/scripts/pixi/activation.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,8 @@ then
2121
# it allow to use clang++ as compiler
2222
export LDFLAGS="-Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib"
2323
fi
24-
25-
# Setup ccache
26-
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
27-
28-
# Create compile_commands.json for language server
29-
export CMAKE_EXPORT_COMPILE_COMMANDS=1
30-
31-
# Activate color output with Ninja
32-
export CMAKE_COLOR_DIAGNOSTICS=1
24+
# Without -isystem, some LSP can't find headers
25+
export EIGENPY_CXX_FLAGS="$CXXFLAGS -isystem $CONDA_PREFIX/include"
3326

3427
# Set default build value only if not previously set
3528
export EIGENPY_BUILD_TYPE=${EIGENPY_BUILD_TYPE:=Release}

development/scripts/pixi/activation_clang.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

development/scripts/pixi/activation_clang_cl.bat

Lines changed: 0 additions & 3 deletions
This file was deleted.

pixi.lock

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

pixi.toml

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,43 @@ numpy = ">=1.22.0"
2121
python = ">=3.9.0"
2222
scipy = ">=1.10.0"
2323

24-
[activation]
25-
scripts = ["development/scripts//pixi/activation.sh"]
24+
[target.unix.activation]
25+
scripts = ["development/scripts/pixi/activation.sh"]
2626

2727
[target.win-64.activation]
28-
scripts = ["development/scripts//pixi/activation.bat"]
28+
scripts = ["development/scripts/pixi/activation.bat"]
29+
30+
[activation.env]
31+
# Setup ccache
32+
CMAKE_CXX_COMPILER_LAUNCHER = "ccache"
33+
# Create compile_commands.json for language server
34+
CMAKE_EXPORT_COMPILE_COMMANDS = "ON"
35+
# Activate color output with Ninja
36+
CMAKE_COLOR_DIAGNOSTICS = "ON"
2937

3038
[tasks]
3139
# We must avoid to set CMAKE_CXX_FLAGS because of WIN32
3240
# https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478
33-
configure = { cmd = [
41+
configure = { args = [
42+
{ arg = "build_dir", default = "build" },
43+
{ arg = "build_type", default = "$EIGENPY_BUILD_TYPE" },
44+
{ arg = "python_stubs", default = "$EIGENPY_PYTHON_STUBS" },
45+
{ arg = "cholmod_support", default = "$EIGENPY_CHOLMOD_SUPPORT" },
46+
{ arg = "accelerate_support", default = "$EIGENPY_ACCELERATE_SUPPORT" },
47+
], cmd = [
3448
"CXXFLAGS=$EIGENPY_CXX_FLAGS",
3549
"cmake",
3650
"-G",
3751
"Ninja",
3852
"-B",
39-
"build",
53+
"{{ build_dir }}",
4054
"-S",
4155
".",
4256
"-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX",
43-
"-DCMAKE_BUILD_TYPE=$EIGENPY_BUILD_TYPE",
44-
"-DGENERATE_PYTHON_STUBS=$EIGENPY_PYTHON_STUBS",
45-
"-DBUILD_WITH_CHOLMOD_SUPPORT=$EIGENPY_CHOLMOD_SUPPORT",
46-
"-DBUILD_WITH_ACCELERATE_SUPPORT=$EIGENPY_ACCELERATE_SUPPORT",
57+
"-DCMAKE_BUILD_TYPE={{ build_type }}",
58+
"-DGENERATE_PYTHON_STUBS={{ python_stubs }}",
59+
"-DBUILD_WITH_CHOLMOD_SUPPORT={{ cholmod_support }}",
60+
"-DBUILD_WITH_ACCELERATE_SUPPORT={{ accelerate_support }}",
4761
] }
4862
build = { cmd = "cmake --build build --target all", depends-on = ["configure"] }
4963
clean = { cmd = "rm -rf build" }
@@ -60,23 +74,14 @@ tasks = { lint = { cmd = "pre-commit run --all" } }
6074
tomlkit = ">=0.13.2"
6175

6276
[feature.new-version.tasks]
63-
configure_new_version = { cmd = [
64-
"CXXFLAGS=$EIGENPY_CXX_FLAGS",
65-
"cmake",
66-
"-G",
67-
"Ninja",
68-
"-B",
69-
"build_new_version",
70-
"-S",
71-
".",
72-
"-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX",
73-
"-DCMAKE_BUILD_TYPE=$EIGENPY_BUILD_TYPE",
74-
"-DGENERATE_PYTHON_STUBS=ON",
75-
"-DBUILD_WITH_CHOLMOD_SUPPORT=ON",
76-
"-DBUILD_WITH_ACCELERATE_SUPPORT=OFF",
77-
] }
78-
release_new_version = { cmd = "VERSION=$EIGENPY_VERSION cmake --build build_new_version --target release", depends-on = [
79-
"configure_new_version",
77+
release-new-version = { cmd = "VERSION=$EIGENPY_VERSION cmake --build build_new_version --target release", depends-on = [
78+
{ task = "configure", args = [
79+
{ build_type = "Release" },
80+
{ build_directory = "build_new_version" },
81+
{ python_stubs = "ON" },
82+
{ accelerate_support = "OFF" },
83+
{ cholmod_support = "ON" },
84+
] },
8085
] }
8186

8287
# Cholmod support
@@ -95,19 +100,16 @@ python = "3.14.*"
95100
[feature.python-oldest.dependencies]
96101
python = "3.10.*"
97102

98-
# Use clang-cl on Windows.
99-
# We must use scripts instead of env to setup CC and CXX
100-
# to avoid cxx-compiler to overwrite them.
103+
# Use clang-cl on Windows
101104
[feature.clang-cl]
102105
platforms = ["win-64"]
103-
activation = { scripts = ["development/scripts//pixi/activation_clang_cl.bat"] }
106+
activation = { env = { CC = "clang-cl", CXX = "clang-cl" } }
107+
dependencies = { clangxx = "*" }
104108

105-
# Use clang on GNU/Linux.
106-
# We must use scripts instead of env to setup CC and CXX
107-
# to avoid cxx-compiler to overwrite them.
109+
# Use clang on GNU/Linux
108110
[feature.clang]
109111
platforms = ["linux-64"]
110-
activation = { scripts = ["development/scripts//pixi/activation_clang.sh"] }
112+
activation = { env = { CC = "clang", CXX = "clang++" } }
111113
dependencies = { clangxx = "*" }
112114

113115
[environments]

0 commit comments

Comments
 (0)