mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-30 03:39:59 +00:00
197 lines
5.4 KiB
Nix
197 lines
5.4 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
cudaSupport ? opencv.cudaSupport or false,
|
|
|
|
# build
|
|
scons,
|
|
addDriverRunpath,
|
|
autoPatchelfHook,
|
|
cmake,
|
|
git,
|
|
libarchive,
|
|
patchelf,
|
|
pkg-config,
|
|
python3Packages,
|
|
|
|
# runtime
|
|
flatbuffers,
|
|
gflags,
|
|
level-zero,
|
|
libusb1,
|
|
libxml2,
|
|
ocl-icd,
|
|
opencv,
|
|
protobuf,
|
|
pugixml,
|
|
snappy,
|
|
onetbb,
|
|
cudaPackages,
|
|
}:
|
|
|
|
let
|
|
inherit (lib)
|
|
cmakeBool
|
|
cmakeFeature
|
|
getLib
|
|
;
|
|
|
|
# prevent scons from leaking in the default python version
|
|
scons' = scons.override { inherit python3Packages; };
|
|
|
|
python = python3Packages.python.withPackages (
|
|
ps: with ps; [
|
|
cython
|
|
distutils
|
|
pybind11
|
|
setuptools
|
|
sphinx
|
|
wheel
|
|
]
|
|
);
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "openvino";
|
|
version = "2026.3.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "openvinotoolkit";
|
|
repo = "openvino";
|
|
tag = finalAttrs.version;
|
|
fetchSubmodules = true;
|
|
hash = "sha256-iZ2Z3yWJxzDqffdq8/grpbk3qXmSy/6i8ptMGBGBA0c=";
|
|
};
|
|
|
|
outputs = [
|
|
"out"
|
|
"dev"
|
|
"lib"
|
|
"python"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
# order matters here: autoAddDriverRunpath must run after autoPatchelfHook, otherwise the RUNPATH will end up being wrong
|
|
autoPatchelfHook
|
|
addDriverRunpath
|
|
|
|
cmake
|
|
git
|
|
libarchive
|
|
patchelf
|
|
pkg-config
|
|
python
|
|
scons'
|
|
]
|
|
++ lib.optionals cudaSupport [
|
|
cudaPackages.cuda_nvcc
|
|
];
|
|
|
|
patches = [
|
|
# https://aur.archlinux.org/cgit/aur.git/tree/010-openvino-change-install-paths.patch?h=openvino
|
|
./cmake-install-paths.patch
|
|
];
|
|
|
|
dontUseSconsCheck = true;
|
|
dontUseSconsBuild = true;
|
|
dontUseSconsInstall = true;
|
|
|
|
cmakeFlags = [
|
|
"-Wno-dev"
|
|
"-DCMAKE_MODULE_PATH:PATH=${placeholder "out"}/lib/cmake"
|
|
"-DCMAKE_PREFIX_PATH:PATH=${placeholder "out"}"
|
|
"-DOpenCV_DIR=${getLib opencv}/lib/cmake/opencv4/"
|
|
"-DProtobuf_LIBRARIES=${getLib protobuf}/lib/libprotobuf${stdenv.hostPlatform.extensions.sharedLibrary}"
|
|
"-DPython_EXECUTABLE=${python.interpreter}"
|
|
|
|
# OV_CPACK_* variables are normally set by packaging macros that only run
|
|
# when CPACK_GENERATOR matches a known type to upstream.
|
|
# Without one, all vars remain undefined and install() destinations are empty,
|
|
# putting files in $out/ root or producing absolute paths. Set them directly
|
|
# here so the build produces a standard layout.
|
|
(cmakeFeature "OV_CPACK_LIBRARYDIR" "lib")
|
|
(cmakeFeature "OV_CPACK_RUNTIMEDIR" "lib")
|
|
(cmakeFeature "OV_CPACK_ARCHIVEDIR" "lib")
|
|
(cmakeFeature "OV_CPACK_INCLUDEDIR" "include")
|
|
(cmakeFeature "OV_CPACK_OPENVINO_CMAKEDIR" "lib/cmake/OpenVINO")
|
|
(cmakeFeature "OV_CPACK_PYTHONDIR" "python")
|
|
(cmakeFeature "OV_CPACK_PLUGINSDIR" "lib")
|
|
|
|
(cmakeBool "CMAKE_VERBOSE_MAKEFILE" true)
|
|
(cmakeBool "NCC_SYLE" false)
|
|
(cmakeBool "BUILD_TESTING" false)
|
|
(cmakeBool "ENABLE_CPPLINT" false)
|
|
(cmakeBool "ENABLE_TESTING" false)
|
|
(cmakeBool "ENABLE_SAMPLES" false)
|
|
|
|
# features
|
|
(cmakeBool "ENABLE_INTEL_CPU" stdenv.hostPlatform.isx86_64)
|
|
(cmakeBool "ENABLE_INTEL_GPU" true)
|
|
(cmakeBool "ENABLE_INTEL_NPU" stdenv.hostPlatform.isx86_64)
|
|
(cmakeBool "ENABLE_JS" false)
|
|
(cmakeBool "ENABLE_LTO" true)
|
|
(cmakeBool "ENABLE_ONEDNN_FOR_GPU" false)
|
|
(cmakeBool "ENABLE_OPENCV" true)
|
|
(cmakeBool "ENABLE_OV_JAX_FRONTEND" false) # auto-patchelf could not satisfy dependency libopenvino_jax_frontend.so.2450
|
|
(cmakeBool "ENABLE_PYTHON" true)
|
|
|
|
# system libs
|
|
(cmakeBool "ENABLE_SYSTEM_FLATBUFFERS" true)
|
|
(cmakeBool "ENABLE_SYSTEM_OPENCL" true)
|
|
(cmakeBool "ENABLE_SYSTEM_PROTOBUF" false)
|
|
(cmakeBool "ENABLE_SYSTEM_PUGIXML" true)
|
|
(cmakeBool "ENABLE_SYSTEM_SNAPPY" true)
|
|
(cmakeBool "ENABLE_SYSTEM_TBB" true)
|
|
];
|
|
|
|
# src/graph/src/plugins/intel_gpu/src/graph/include/reorder_inst.h:24:8: error: type 'struct typed_program_node' violates the C++ One Definition Rule [-Werror=odr]
|
|
env.NIX_CFLAGS_COMPILE = "-Wno-odr";
|
|
|
|
buildInputs = [
|
|
flatbuffers
|
|
gflags
|
|
level-zero
|
|
libusb1
|
|
libxml2
|
|
ocl-icd
|
|
opencv
|
|
pugixml
|
|
snappy
|
|
onetbb
|
|
]
|
|
++ lib.optionals cudaSupport [
|
|
cudaPackages.cuda_cudart
|
|
];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
postInstall = ''
|
|
mkdir -p $python/lib
|
|
mv $lib/lib/python* $python/lib/
|
|
'';
|
|
|
|
postFixup = ''
|
|
substituteInPlace $dev/lib/pkgconfig/openvino.pc \
|
|
--replace-fail "include_prefix=\''${prefix}/" "include_prefix=" \
|
|
--replace-fail "exec_prefix=\''${prefix}/" "exec_prefix="
|
|
'';
|
|
|
|
meta = {
|
|
changelog = "https://github.com/openvinotoolkit/openvino/releases/tag/${finalAttrs.src.tag}";
|
|
description = "Open-source toolkit for optimizing and deploying AI inference";
|
|
longDescription = ''
|
|
This toolkit allows developers to deploy pre-trained deep learning models through a high-level C++ Inference Engine API integrated with application logic.
|
|
|
|
This open source version includes several components: namely Model Optimizer, nGraph and Inference Engine, as well as CPU, GPU, MYRIAD,
|
|
multi device and heterogeneous plugins to accelerate deep learning inferencing on Intel® CPUs and Intel® Processor Graphics.
|
|
It supports pre-trained models from the Open Model Zoo, along with 100+ open source and public models in popular formats such as Caffe*, TensorFlow*, MXNet* and ONNX*.
|
|
'';
|
|
homepage = "https://docs.openvinotoolkit.org/";
|
|
license = lib.licenses.asl20;
|
|
platforms = lib.platforms.all;
|
|
broken = stdenv.hostPlatform.isDarwin; # Cannot find macos sdk
|
|
};
|
|
})
|