Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pixi support #1589

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
49 changes: 49 additions & 0 deletions .github/workflows/macos-linux-windows-pixi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI - MacOS/Linux/Windows via Pixi

on:
push:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
visp-pixi:
name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-13]
environment: [all]
build_type: [Release]
include:
- os: windows-latest
environment: all
build_type: Release
- os: windows-latest
environment: all-clang-cl
build_type: Release

steps:
- uses: actions/checkout@v4

- uses: prefix-dev/[email protected]
with:
cache: true
environments: ${{ matrix.environment }}

- name: Build Visp [MacOS/Linux/Windows]
shell: bash -el {0}
env:
VISP_BUILD_TYPE: ${{ matrix.build_type }}
run: |
pixi run -e ${{ matrix.environment }} build
- name: Run tests [MacOS/Linux/Windows]
shell: bash -el {0}
run: |
pixi run -e ${{ matrix.environment }} test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ modules/java/\.idea/
build
*.blend1
**/results/**

# pixi environments
.pixi
*.egg-info
11 changes: 11 additions & 0 deletions development/scripts/pixi/activation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:: Activation script

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

:: Activate color output with Ninja
set CMAKE_COLOR_DIAGNOSTICS=1

:: Set OS specific extra command CMake options
:: We neeed to force installation of Visp to standard paths instead of <arch>/<vc_version>/ ones done by default
set VISP_EXTRA_CMAKE_ARGS="-DVISP_LIB_INSTALL_PATH:PATH=lib -DVISP_BIN_INSTALL_PATH:PATH=bin -DVISP_CONFIG_INSTALL_PATH:PATH=cmake"
11 changes: 11 additions & 0 deletions development/scripts/pixi/activation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /bin/bash
# Activation script

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

# Activate color output with Ninja
export CMAKE_COLOR_DIAGNOSTICS=1

# Set OS specific extra command CMake options, if any
export VISP_EXTRA_CMAKE_ARGS=""
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,194 changes: 9,194 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[project]
authors = ["Olivier Roussel <[email protected]>"]
channels = ["conda-forge"]
name = "visp"
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
version = "3.6.0"
license = "GPL-2.0-only"
license-file = "LICENSE.txt"

# TODO: add ccache support
[build-dependencies]
cxx-compiler = ">=1.7.0"
cmake = ">=3.22"
ninja = ">=1.11"
pkg-config = ">=0.29.2"
git = ">=2.47.0"

[dependencies]
libopencv = "*"
eigen = "*"
libjpeg-turbo = "*"
libpng = "*"
libblas = "*"
libcblas = "*"
liblapack = "*"
liblapacke = "*"
libiconv = "<=1.17"

[target.unix.dependencies]
xorg-libx11 = "*"
xorg-libxfixes = "*"
xorg-xorgproto = "*"
# TODO: activate on windows as well
libxml2 = "*"
libdc1394 = ">=2.2.6"
librealsense = "*"

[target.linux-64.dependencies]
mesa-libegl-cos7-x86_64 = "*"

[target.osx.dependencies]
llvm-openmp = "*"

[target.win-64.dependencies]
pthreads-win32 = "*"

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

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

# 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"]
dependencies = { clang = "*", llvm-openmp = "*" }
activation = { scripts = ["development/scripts/pixi/activation_clang_cl.bat"] }

[feature.python-bindings]
dependencies = { python = ">=3.8", pybind11 = "*", pip = "*" }
[feature.python-bindings.tasks]
build = { cmd = "cmake --build build --parallel $CPU_COUNT --target visp_python_bindings", depends-on = ["install"] }
python-test = { cmd = "cmake --build build --config Release --target visp_python_bindings_test", depends-on = ["build"] }

[tasks]
configure = { cmd = [
"cmake",
"-G",
"Ninja",
"-B",
"build",
"-S",
".",
"-DCMAKE_BUILD_TYPE=$VISP_BUILD_TYPE",
"-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX",
"-DBUILD_TESTS=ON",
"$VISP_EXTRA_CMAKE_ARGS"
] }
build-base = { cmd = "cmake --build build --parallel $CPU_COUNT", depends-on = ["configure"] }
build = { depends-on = ["build-base"]}
install = { cmd = "cmake --build build --target install", depends-on = ["build-base"] }
clean = { cmd = "rm -rf build" }
test = { cmd = "ctest --test-dir build --output-on-failure", depends-on = ["install"] }

[environments]
default = { solve-group = "base" }
with-python = { features = ["python-bindings"], solve-group = "base"}
all = { features = ["python-bindings"], solve-group = "base"}
all-clang-cl = { features = ["python-bindings", "clang-cl"], solve-group = "base" }
Loading