[workspace]
channels = [
    # conda-forge omniorb package for osx-arm64 doesn't contain omniidl
    # due to cross-compilation
    { channel = "tango-controls/label/omniorb_osx_arm64", priority = 1 },
    "conda-forge",
]
name = "cpptango"
platforms = ["linux-64", "osx-64", "osx-arm64"]
requires-pixi = ">=0.55"

[dependencies]
cmake = ">=3.18"
ninja = "*"
cxx-compiler = "*"
omniorb = ">=4.3.0"
cppzmq = ">4.7.1"
zeromq = ">=4.0.5"
libjpeg-turbo = ">=1.5.2"
tango-idl = ">=6.0.2,<7"
libopentelemetry-cpp = ">=1.16.0"
catch2 = ">=3.1.1"

[target.unix.dependencies]
pkg-config = "*"

[tasks]
_configure = { "cmd" = [
    "cmake",
    "$CMAKE_ARGS",
    "-GNinja",
    "-DCMAKE_BUILD_TYPE=Debug",
    "-DBUILD_TESTING=ON",
    "-DTANGO_USE_TELEMETRY=ON",
    "-DTANGO_WARNINGS_AS_ERRORS=ON",
    "-DCMAKE_INSTALL_PREFIX=\"$CONDA_PREFIX\"",
    # Sometimes the PollThread on the macOS CI seems to stall for up to ~600 ms
    # which can cause some tests to fail sporadically. Increasing the
    # TANGO_TEST_CATCH2_DEFAULT_POLL_PERIOD from 100 ms seems to make the tests
    # more reliable.
    "-DTANGO_TEST_CATCH2_DEFAULT_POLL_PERIOD=1000",
    "-S.",
    "-Bbuild",
] }
clean = "rm -rf build"
build = { "cmd" = "cmake --build build", "depends-on" = ["_configure"] }
test = "ctest --output-on-failure --test-dir build -R \"^catch2.*$\" || (echo \"Rerunning failed tests\"; ctest --output-on-failure --test-dir build --rerun-failed)"
