Skip to content

Commit

Permalink
pixi: Add pixi.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisv committed Nov 25, 2024
1 parent 50221d8 commit 1d4481b
Show file tree
Hide file tree
Showing 8 changed files with 9,532 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ Xcode/*
*~
*.pyc


# pixi environments
.pixi
*.egg-info
13 changes: 13 additions & 0 deletions development/scripts/pixi/activation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:: Setup ccache
set CMAKE_CXX_COMPILER_LAUNCHER=ccache

:: Create compile_commands.json for language server
set CMAKE_EXPORT_COMPILE_COMMANDS=1

:: Activate color output with Ninja
set CMAKE_COLOR_DIAGNOSTICS=1

:: Set default build value only if not previously set
if not defined COAL_BUILD_TYPE (set COAL_BUILD_TYPE=Release)
if not defined COAL_PYTHON_STUBS (set COAL_PYTHON_STUBS=ON)
if not defined COAL_HAS_QHULL (set COAL_HAS_QHULL=OFF)
37 changes: 37 additions & 0 deletions development/scripts/pixi/activation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /bin/bash
# Activation script

# Remove flags setup from cxx-compiler
unset CFLAGS
unset CPPFLAGS
unset CXXFLAGS
unset DEBUG_CFLAGS
unset DEBUG_CPPFLAGS
unset DEBUG_CXXFLAGS
unset LDFLAGS

if [[ $host_alias == *"apple"* ]];
then
# On OSX setting the rpath and -L it's important to use the conda libc++ instead of the system one.
# If conda-forge use install_name_tool to package some libs, -headerpad_max_install_names is then mandatory
export LDFLAGS="-Wl,-headerpad_max_install_names -Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib"
elif [[ $host_alias == *"linux"* ]];
then
# On GNU/Linux, I don't know if these flags are mandatory with g++ but
# it allow to use clang++ as compiler
export LDFLAGS="-Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib"
fi

# Setup ccache
export CMAKE_CXX_COMPILER_LAUNCHER=ccache

# Create compile_commands.json for language server
export CMAKE_EXPORT_COMPILE_COMMANDS=1

# Activate color output with Ninja
export CMAKE_COLOR_DIAGNOSTICS=1

# Set default build value only if not previously set
export COAL_BUILD_TYPE=${COAL_BUILD_TYPE:=Release}
export COAL_PYTHON_STUBS=${COAL_PYTHON_STUBS:=ON}
export COAL_HAS_QHULL=${COAL_HAS_QHULL:=OFF}
5 changes: 5 additions & 0 deletions development/scripts/pixi/activation_clang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash
# Clang activation script

export CC="clang"
export CXX="clang++"
3 changes: 3 additions & 0 deletions development/scripts/pixi/activation_clang_cl.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:: Setup clang-cl compiler
set CC=clang-cl
set CXX=clang-cl
9,328 changes: 9,328 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

140 changes: 140 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
[project]
name = "coal"
version = "3.0.0"
description = "An extension of the Flexible Collision Library"
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
channels = ["conda-forge"]
license = "BSD-3-Clause"
license-file = "LICENSE"

[build-dependencies]
ccache = ">=4.9.1"
cmake = ">=3.10"
cxx-compiler = ">=1.7.0"
ninja = ">=1.11"
pkg-config = ">=0.29.2"
git = ">=2.47.0"

[dependencies]
libboost-devel = ">=1.80.0"
libboost-python-devel = ">=1.80.0"
eigen = ">=3.4.0"
assimp = ">=5.4"
numpy = ">=1.22.0"
python = ">=3.9.0"
eigenpy = ">=3.7.0"
doxygen = "<1.9.8|>=1.11"
lxml = ">=5.3"
pylatexenc = ">=2.10"

[activation]
scripts = ["development/scripts/pixi/activation.sh"]

[target.win-64.activation]
scripts = ["development/scripts/pixi/activation.bat"]

[tasks]
# We must avoid to set CMAKE_CXX_FLAGS because of WIN32
# https://discourse.cmake.org/t/strictly-appending-to-cmake-lang-flags/6478
configure = { cmd = [
"CXXFLAGS=$COAL_CXX_FLAGS",
"cmake",
"-G",
"Ninja",
"-B",
"build",
"-S",
".",
"-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX",
"-DCMAKE_BUILD_TYPE=$COAL_BUILD_TYPE",
"-DGENERATE_PYTHON_STUBS=$COAL_PYTHON_STUBS",
"-DCOAL_HAS_QHULL=$COAL_HAS_QHULL",
] }
build = { cmd = "cmake --build build --target all", depends_on = ["configure"] }
clean = { cmd = "rm -rf build" }
test = { cmd = "ctest --test-dir build --output-on-failure", depends_on = [
"build",
] }

[feature.lint]
dependencies = { pre-commit = ">=3.6.2" }
tasks = { lint = { cmd = "pre-commit run --all" } }

# Increment the version number with COAL_VERSION variable
[feature.new-version.dependencies]
tomlkit = ">=0.13.2"

[feature.new-version.tasks]
configure_new_version = { cmd = [
"CXXFLAGS=$COAL_CXX_FLAGS",
"cmake",
"-G",
"Ninja",
"-B",
"build_new_version",
"-S",
".",
"-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX",
"-DCMAKE_BUILD_TYPE=$COAL_BUILD_TYPE",
"-DGENERATE_PYTHON_STUBS=ON",
"-DCOAL_HAS_QHULL=ON",
] }
release_new_version = { cmd = "VERSION=$COAL_VERSION cmake --build build_new_version --target release", depends-on = [
"configure_new_version",
] }

# QHull support
[feature.qhull.target.win]
dependencies = { qhull = ">=2020.2" }
activation = { env = { COAL_HAS_QHULL = "ON" } }
[feature.qhull.target.unix]
dependencies = { qhull = ">=2020.2", qhull-static = ">=2020.2" }
activation = { env = { COAL_HAS_QHULL = "ON" } }

# Octomap support
[feature.octomap]
dependencies = { octomap = ">=1.10" }

[feature.py312.dependencies]
python = "3.12.*"

[feature.py39.dependencies]
python = "3.9.*"

# Use clang-cl on Windows.
# We must use scripts instead of env to setup CC and CXX
# to avoid cxx-compiler to overwrite them.
[feature.clang-cl]
platforms = ["win-64"]
activation = { scripts = ["development/scripts/pixi/activation_clang_cl.bat"] }

# Use clang on GNU/Linux.
# We must use scripts instead of env to setup CC and CXX
# to avoid cxx-compiler to overwrite them.
[feature.clang]
platforms = ["linux-64"]
activation = { scripts = ["development/scripts/pixi/activation_clang.sh"] }
dependencies = { clangxx = "*" }

[environments]
default = { features = ["py312"], solve-group = "py312" }
clang = { features = ["clang", "py312"] }
lint = { features = ["lint"], solve-group = "py312" }
qhull = { features = ["qhull", "py312"], solve-group = "py312" }
octomap = { features = ["octomap", "py312"], solve-group = "py312" }
py39 = { features = ["py39"], solve-group = "py39" }
all = { features = ["qhull", "octomap", "py312"], solve-group = "py312" }
all-py39 = { features = ["qhull", "octomap", "py39"], solve-group = "py39" }
all-clang-cl = { features = [
"qhull",
"octomap",
"clang-cl",
"py312",
], solve-group = "py312" }
# Release a new software version
new-version = { features = [
"new-version",
"qhull",
"octomap",
"py312",
], solve-group = "py312" }

0 comments on commit 1d4481b

Please sign in to comment.