From 6e48241eb14dab573bf0290e3a4ab9709195b0e9 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Wed, 11 Sep 2024 09:36:53 -0500 Subject: [PATCH 01/14] NEW: Add recipe for libnvimgcodec --- recipes/libnvimgcodec/build.sh | 49 ++++ recipes/libnvimgcodec/meta.yaml | 144 +++++++++++ ...issing-headers-from-standard-library.patch | 87 +++++++ ...ack-only-needed-when-building-for-py.patch | 49 ++++ ...ror-if-extensions-are-built-without-.patch | 31 +++ ...ser-set-libdir-using-CMake-variables.patch | 240 ++++++++++++++++++ ...libraries-to-python-directory-option.patch | 132 ++++++++++ ...nt-install-directory-for-cmake-confi.patch | 43 ++++ ...t-python-versions-be-user-selectable.patch | 114 +++++++++ ...uple-nvimgcodec-and-dynlink_-targets.patch | 68 +++++ ...k-system-nvimgcodec-to-python-module.patch | 27 ++ recipes/libnvimgcodec/test/CMakeLists.txt | 34 +++ recipes/libnvimgcodec/test/all_headers.c | 5 + recipes/libnvimgcodec/test/all_headers.cxx | 6 + recipes/nvimgcodec/build.sh | 51 ++++ recipes/nvimgcodec/meta.yaml | 81 ++++++ ...issing-headers-from-standard-library.patch | 87 +++++++ ...ack-only-needed-when-building-for-py.patch | 49 ++++ ...ror-if-extensions-are-built-without-.patch | 31 +++ ...ser-set-libdir-using-CMake-variables.patch | 240 ++++++++++++++++++ ...libraries-to-python-directory-option.patch | 132 ++++++++++ ...nt-install-directory-for-cmake-confi.patch | 43 ++++ ...t-python-versions-be-user-selectable.patch | 114 +++++++++ ...uple-nvimgcodec-and-dynlink_-targets.patch | 68 +++++ ...k-system-nvimgcodec-to-python-module.patch | 27 ++ 25 files changed, 1952 insertions(+) create mode 100644 recipes/libnvimgcodec/build.sh create mode 100644 recipes/libnvimgcodec/meta.yaml create mode 100644 recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch create mode 100644 recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch create mode 100644 recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch create mode 100644 recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch create mode 100644 recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch create mode 100644 recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch create mode 100644 recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch create mode 100644 recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch create mode 100644 recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch create mode 100644 recipes/libnvimgcodec/test/CMakeLists.txt create mode 100644 recipes/libnvimgcodec/test/all_headers.c create mode 100644 recipes/libnvimgcodec/test/all_headers.cxx create mode 100644 recipes/nvimgcodec/build.sh create mode 100644 recipes/nvimgcodec/meta.yaml create mode 100644 recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch create mode 100644 recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch create mode 100644 recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch create mode 100644 recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch create mode 100644 recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch create mode 100644 recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch create mode 100644 recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch create mode 100644 recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch create mode 100644 recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch diff --git a/recipes/libnvimgcodec/build.sh b/recipes/libnvimgcodec/build.sh new file mode 100644 index 0000000000000..c14783d598612 --- /dev/null +++ b/recipes/libnvimgcodec/build.sh @@ -0,0 +1,49 @@ +#! bash +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +mkdir build +cd build + +nvimg_build_args=( + -DBUILD_DOCS:BOOL=OFF + -DBUILD_SAMPLES:BOOL=OFF + -DBUILD_TEST:BOOL=OFF +# Library args + -DBUILD_LIBRARY:BOOL=ON + -DBUILD_SHARED_LIBS:BOOL=ON + -DBUILD_STATIC_LIBS:BOOL=OFF + -DWITH_DYNAMIC_NVJPEG:BOOL=ON + -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF +# Extension args + -DBUILD_EXTENSIONS:BOOL=ON + -DBUILD_NVJPEG_EXT:BOOL=ON + # nvjpek2k is not yet on conda-forge + -DBUILD_NVJPEG2K_EXT:BOOL=OFF + -DBUILD_NVBMP_EXT:BOOL=ON + -DBUILD_NVPNM_EXT:BOOL=ON + -DBUILD_LIBJPEG_TURBO_EXT:BOOL=ON + -DBUILD_LIBTIFF_EXT:BOOL=ON + -DBUILD_OPENCV_EXT:BOOL=ON +# Python args + -DBUILD_PYTHON:BOOL=OFF +) + +cmake ${CMAKE_ARGS} -GNinja "${nvimg_build_args[@]}" ${SRC_DIR} + +cmake --build . + +cmake --install . --strip diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml new file mode 100644 index 0000000000000..7487eb84eb42a --- /dev/null +++ b/recipes/libnvimgcodec/meta.yaml @@ -0,0 +1,144 @@ +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +{% set version = '0.3.0' %} + +package: + name: libnvimgcodec-split + version: {{ version }} + +source: + url: https://github.com/NVIDIA/nvImageCodec/archive/refs/tags/v{{ version }}.tar.gz + sha256: 4bba949d6cf4e88fcd6b2d86bff960c9ed68eb25b6c4dde3b7772615480ab9fb + patches: + - patches/0001-BUG-Add-missing-headers-from-standard-library.patch + - patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch + - patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch + - patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch + - patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch + - patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch + - patches/0007-BLD-Let-python-versions-be-user-selectable.patch + - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch + - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch + +build: + skip: true # [not linux] + skip: true # [cuda_compiler_version in (None, 'None')] + # Debug skips below + # skip: true # [py != 312] + # skip: true # [cuda_compiler_version != '12.0'] +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cuda') }} + - {{ compiler('cxx')}} + - {{ stdlib('c') }} + - cmake >=3.18 + - ninja + - pkg-config + - python-clang + host: + - cuda-version {{ cuda_compiler_version }} + - libboost-headers + - libjpeg-turbo + - libnvjpeg-dev + - libopencv + - libtiff + - nvtx-c + - setuptools + - zlib + - zstd + +outputs: + + - name: libnvimgcodec-dev + build: + run_exports: + - {{ pin_subpackage('libnvimgcodec') }} + files: + # This recipe requires conda-build 24.7 or later + include: + - include/** + - lib/libnvimgcodec.so + - lib/cmake/nvimgcodec + - etc/** + - extensions/*.so + # FIXME: Drop static libraries once CMake config supports it + - extensions/*.a + - lib/libnvimgcodec_static.a + exclude: + - lib/python* + - lib/libnvimgcodec.so.* + - extensions/*.so.* + requirements: + host: + - {{ pin_subpackage('libnvimgcodec', exact=True) }} + run: + - {{ pin_subpackage('libnvimgcodec', exact=True) }} + test: + files: + - test + requires: # [build_platform == target_platform] + - {{ compiler('c') }} # [build_platform == target_platform] + - {{ compiler('cxx') }} # [build_platform == target_platform] + - {{ compiler('cuda') }} # [build_platform == target_platform] + - {{ stdlib('c') }} # [build_platform == target_platform] + - cmake # [build_platform == target_platform] + - ninja # [build_platform == target_platform] + - cuda-cudart-dev # [build_platform == target_platform] + commands: + - cmake ${CMAKE_ARGS} -GNinja test # [build_platform == target_platform] + - cmake --build . # [build_platform == target_platform] + - test -f ${PREFIX}/include/nvimgcodec.h # [unix] + - test -f ${PREFIX}/lib/libnvimgcodec.so.0 # [linux] + - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }}.0 # [linux] + - test -f ${PREFIX}/etc/ld.so.conf.d/nvimgcodec.conf # [unix] + - test -f ${PREFIX}/lib/cmake/nvimgcodec/nvimgcodecConfig.cmake # [unix] + # - test ! -f ${PREFIX}/lib/libnvimgcodec_static.a # [unix] + + - name: libnvimgcodec + build: + run_exports: + - {{ pin_subpackage('libnvimgcodec') }} + files: + - lib/libnvimgcodec.so.* + - extensions/*.so.* + requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cuda') }} + - {{ compiler('cxx')}} + - {{ stdlib('c') }} + host: + - cuda-version {{ cuda_compiler_version }} + - libjpeg-turbo + - libnvjpeg-dev + - libopencv + - libtiff + test: + commands: + - test -f ${PREFIX}/lib/libnvimgcodec.so.0 # [linux] + - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }}.0 # [linux] + +about: + home: https://github.com/NVIDIA/nvImageCodec + description: > + The nvImageCodec is an open-source library of accelerated codecs with + unified interface. This package is the C-API only. See nvimgcodec for the + Python-API. + license: Apache-2.0 license + license_family: APACHE + license_file: + - LICENSE.txt + - Acknowledgements.txt + feedstock_name: libnvimgcodec diff --git a/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch b/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch new file mode 100644 index 0000000000000..51ad9d47a45f5 --- /dev/null +++ b/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch @@ -0,0 +1,87 @@ +From db52313b58080519bb3be0422599564fd01d8db2 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 10 Sep 2024 17:46:15 -0500 +Subject: [PATCH 1/9] BUG: Add missing headers from standard library + +--- + extensions/libjpeg_turbo/jpeg_handle.h | 9 +++++---- + src/logger.h | 5 +++-- + src/parsers/exif.h | 1 + + 3 files changed, 9 insertions(+), 6 deletions(-) + +diff --git a/extensions/libjpeg_turbo/jpeg_handle.h b/extensions/libjpeg_turbo/jpeg_handle.h +index bc24173..6da1652 100644 +--- a/extensions/libjpeg_turbo/jpeg_handle.h ++++ b/extensions/libjpeg_turbo/jpeg_handle.h +@@ -1,16 +1,16 @@ +-/* ++/* + * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2015 The TensorFlow Authors. All Rights Reserved. + * Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +- * ++ * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at +- * ++ * + * http://www.apache.org/licenses/LICENSE-2.0 +- * ++ * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@@ -23,6 +23,7 @@ + + #pragma once + ++#include + #include + #include "jpeg_utils.h" + +diff --git a/src/logger.h b/src/logger.h +index 4b75869..3264a95 100644 +--- a/src/logger.h ++++ b/src/logger.h +@@ -17,6 +17,7 @@ + + #pragma once + ++#include + #include + #include + #include +@@ -46,7 +47,7 @@ class Logger : public ILogger + } + + void log(const nvimgcodecDebugMessageSeverity_t message_severity, +- const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override ++ const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override + { + nvimgcodecDebugMessageData_t data{NVIMGCODEC_STRUCTURE_TYPE_DEBUG_MESSAGE_DATA, sizeof(nvimgcodecDebugMessageData_t), nullptr, + message.c_str(), 0, nullptr, name_.c_str(), 0}; +@@ -85,4 +86,4 @@ class Logger : public ILogger + std::string name_; + }; + +-} //namespace nvimgcodec +\ No newline at end of file ++} //namespace nvimgcodec +diff --git a/src/parsers/exif.h b/src/parsers/exif.h +index aff554c..d996317 100644 +--- a/src/parsers/exif.h ++++ b/src/parsers/exif.h +@@ -42,6 +42,7 @@ + + #pragma once + ++#include + #include + #include + #include +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch b/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch new file mode 100644 index 0000000000000..e4552d516e1fe --- /dev/null +++ b/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch @@ -0,0 +1,49 @@ +From 04c6631102716182a5df671a57bd0a944dfc195e Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 10 Sep 2024 18:12:59 -0500 +Subject: [PATCH 2/9] BLD: pybind11 dlpack only needed when building for python + +Also allow system libraries for these deps +--- + CMakeLists.txt | 3 +++ + external/CMakeLists.txt | 15 +++++++++++++-- + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f9f1ae..7e19bdf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -95,6 +95,9 @@ option(BUILD_LIBTIFF_EXT "Build libtiff extensions module" ON) + option(BUILD_OPENCV_EXT "Build opencv extensions module" ON) + option(BUILD_PYTHON "Build Python binding" ON) + option(BUILD_WHEEL "Build python wheel package" ON) ++option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) ++option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) ++ + + cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON + "BUILD_NVJPEG_EXT" OFF) +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index 50685ce..88ff95d 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -1,2 +1,13 @@ +-add_subdirectory(pybind11 EXCLUDE_FROM_ALL) +-add_subdirectory(dlpack EXCLUDE_FROM_ALL) +\ No newline at end of file ++if(BUILD_PYTHON) ++ if(NVIMG_CODEC_USE_SYSTEM_PYBIND) ++ find_package(pybind11 REQUIRED) ++ else() ++ add_subdirectory(pybind11 EXCLUDE_FROM_ALL) ++ endif(NVIMG_CODEC_USE_SYSTEM_PYBIND) ++ if(NVIMG_CODEC_USE_SYSTEM_DLPACK) ++ find_package(dlpack REQUIRED) ++ else() ++ add_subdirectory(dlpack EXCLUDE_FROM_ALL) ++ endif(NVIMG_CODEC_USE_SYSTEM_DLPACK) ++endif(BUILD_PYTHON) ++ +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch b/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch new file mode 100644 index 0000000000000..01173f262a065 --- /dev/null +++ b/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch @@ -0,0 +1,31 @@ +From a3327de7c8b08ac2224efa6193f2918f411152f8 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 17 Sep 2024 11:09:47 -0500 +Subject: [PATCH 3/9] DOC: Add Fatal Error if extensions are built without + library + +--- + CMakeLists.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7e19bdf..5e4162b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -87,7 +87,13 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) + option(BUILD_DOCS "Build documentation" OFF) + option(BUILD_EXTENSIONS "Build extensions modules" ON) + option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) ++if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) ++ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") ++endif() + option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) ++if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) ++ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") ++endif() + option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) + option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) + option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch b/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch new file mode 100644 index 0000000000000..bfad729a4adca --- /dev/null +++ b/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch @@ -0,0 +1,240 @@ +From d062794e03a8e167718b7ecd05776216cd338a75 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 13:09:10 -0500 +Subject: [PATCH 4/9] BLD: Let end user set libdir using CMake variables + +--- + CMakeLists.txt | 13 +++++++++++++ + cpack/ld.so.conf.in | 6 +----- + extensions/libjpeg_turbo/CMakeLists.txt | 5 ++--- + extensions/libtiff/CMakeLists.txt | 5 ++--- + extensions/nvbmp/CMakeLists.txt | 5 ++--- + extensions/nvjpeg/CMakeLists.txt | 5 ++--- + extensions/nvjpeg2k/CMakeLists.txt | 5 ++--- + extensions/nvpnm/CMakeLists.txt | 5 ++--- + extensions/opencv/CMakeLists.txt | 5 ++--- + src/CMakeLists.txt | 14 +------------- + 10 files changed, 29 insertions(+), 39 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5e4162b..941a033 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -114,6 +114,19 @@ propagate_option(WITH_DYNAMIC_NVJPEG2K) + + string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) + ++# Introduce variables: ++# * CMAKE_INSTALL_LIBDIR ++# * CMAKE_INSTALL_BINDIR ++# * CMAKE_INSTALL_INCLUDEDIR ++if(NOT DEFINED CMAKE_INSTALL_LIBDIR) ++ if(UNIX) ++ set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib ++ else() ++ set(CMAKE_INSTALL_LIBDIR "lib") ++ endif() ++endif() ++include(GNUInstallDirs) ++ + if(WIN32) + set(CPACK_GENERATOR "ZIP") + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +diff --git a/cpack/ld.so.conf.in b/cpack/ld.so.conf.in +index def1924..389dc26 100644 +--- a/cpack/ld.so.conf.in ++++ b/cpack/ld.so.conf.in +@@ -13,8 +13,4 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-if(UNIX) +- @CMAKE_INSTALL_PREFIX@/lib64 +-else() +- @CMAKE_INSTALL_PREFIX@/lib +-endif() +\ No newline at end of file ++@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ +diff --git a/extensions/libjpeg_turbo/CMakeLists.txt b/extensions/libjpeg_turbo/CMakeLists.txt +index 6b75f9f..b157f66 100644 +--- a/extensions/libjpeg_turbo/CMakeLists.txt ++++ b/extensions/libjpeg_turbo/CMakeLists.txt +@@ -48,15 +48,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/libtiff/CMakeLists.txt b/extensions/libtiff/CMakeLists.txt +index 25ecae0..092fdba 100644 +--- a/extensions/libtiff/CMakeLists.txt ++++ b/extensions/libtiff/CMakeLists.txt +@@ -47,14 +47,13 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + else() + install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/nvbmp/CMakeLists.txt b/extensions/nvbmp/CMakeLists.txt +index 4cf1b97..a408ce6 100644 +--- a/extensions/nvbmp/CMakeLists.txt ++++ b/extensions/nvbmp/CMakeLists.txt +@@ -44,12 +44,11 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib) + else() + install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib) + endif() +diff --git a/extensions/nvjpeg/CMakeLists.txt b/extensions/nvjpeg/CMakeLists.txt +index dc302de..f888288 100644 +--- a/extensions/nvjpeg/CMakeLists.txt ++++ b/extensions/nvjpeg/CMakeLists.txt +@@ -91,15 +91,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/nvjpeg2k/CMakeLists.txt b/extensions/nvjpeg2k/CMakeLists.txt +index 18c99c9..8e569e0 100644 +--- a/extensions/nvjpeg2k/CMakeLists.txt ++++ b/extensions/nvjpeg2k/CMakeLists.txt +@@ -60,15 +60,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/nvpnm/CMakeLists.txt b/extensions/nvpnm/CMakeLists.txt +index 4ed5134..66b1093 100644 +--- a/extensions/nvpnm/CMakeLists.txt ++++ b/extensions/nvpnm/CMakeLists.txt +@@ -43,15 +43,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/opencv/CMakeLists.txt b/extensions/opencv/CMakeLists.txt +index 36ec99f..ba956a9 100644 +--- a/extensions/opencv/CMakeLists.txt ++++ b/extensions/opencv/CMakeLists.txt +@@ -49,15 +49,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 5d8aeb0..940e2a6 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -109,18 +109,6 @@ endif() + + # Installation (https://github.com/forexample/package-example) { + +-# Introduce variables: +-# * CMAKE_INSTALL_LIBDIR +-# * CMAKE_INSTALL_BINDIR +-# * CMAKE_INSTALL_INCLUDEDIR +-include(GNUInstallDirs) +-if(UNIX) +- set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib +-else() +- set(CMAKE_INSTALL_LIBDIR "lib") +-endif() +-set(CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") # adjust accordingly +- + # Layout. This works for all platforms: + # * /cmake/ + # * /lib*/ +@@ -190,4 +178,4 @@ install( + COMPONENT lib + ) + +-# } +\ No newline at end of file ++# } +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch b/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch new file mode 100644 index 0000000000000..ab352457154b3 --- /dev/null +++ b/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch @@ -0,0 +1,132 @@ +From 561f4ca740edc3ba4605b12202edea4e0c7d023d Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 13:37:13 -0500 +Subject: [PATCH 5/9] BLD: Make moving libraries to python directory optional + +--- + CMakeLists.txt | 2 +- + python/CMakeLists.txt | 82 +++++++++++++++++++++++-------------------- + 2 files changed, 44 insertions(+), 40 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 941a033..f15b7c1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,7 +103,7 @@ option(BUILD_PYTHON "Build Python binding" ON) + option(BUILD_WHEEL "Build python wheel package" ON) + option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) + option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) +- ++option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) + + cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON + "BUILD_NVJPEG_EXT" OFF) +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 0837211..39f54c7 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -43,7 +43,7 @@ set(PY_NVIMGCODEC_SRCS + image_buffer_kind.cpp + code_stream.cpp + region.cpp) +- ++ + if(UNIX) + set(PY_NVIMGCODEC_IMPL_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec) + else() +@@ -66,50 +66,54 @@ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.in" DESTINATION "${CMAKE_CURRENT + file(COPY "${PROJECT_SOURCE_DIR}/Acknowledgements.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + file(COPY "${PROJECT_SOURCE_DIR}/LICENSE.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + +-add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) +-add_dependencies(copy_libs_to_python_dir +- nvimgcodec +- nvbmp_ext +- nvpnm_ext) ++if(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) + +-if (BUILD_NVJPEG_EXT) +- add_dependencies(copy_libs_to_python_dir nvjpeg_ext) +-endif() ++ add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) ++ add_dependencies(copy_libs_to_python_dir ++ nvimgcodec ++ nvbmp_ext ++ nvpnm_ext) + +-if (BUILD_NVJPEG2K_EXT) +- add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) +-endif() ++ if (BUILD_NVJPEG_EXT) ++ add_dependencies(copy_libs_to_python_dir nvjpeg_ext) ++ endif() + +-if(BUILD_LIBJPEG_TURBO_EXT) +- add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) +-endif() ++ if (BUILD_NVJPEG2K_EXT) ++ add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) ++ endif() + +-if(BUILD_LIBTIFF_EXT) +- add_dependencies(copy_libs_to_python_dir libtiff_ext) +-endif() ++ if(BUILD_LIBJPEG_TURBO_EXT) ++ add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) ++ endif() + +-if(BUILD_OPENCV_EXT) +- add_dependencies(copy_libs_to_python_dir opencv_ext) +-endif() ++ if(BUILD_LIBTIFF_EXT) ++ add_dependencies(copy_libs_to_python_dir libtiff_ext) ++ endif() + +-if(UNIX) +- add_custom_command( +- TARGET copy_libs_to_python_dir +- COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && +- cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && +- cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" +- ) +-else() +- string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) +- string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) +- string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +- add_custom_command( +- TARGET copy_libs_to_python_dir +- COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && +- copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && +- for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && +- xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) +-endif() ++ if(BUILD_OPENCV_EXT) ++ add_dependencies(copy_libs_to_python_dir opencv_ext) ++ endif() ++ ++ if(UNIX) ++ add_custom_command( ++ TARGET copy_libs_to_python_dir ++ COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && ++ cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && ++ cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" ++ ) ++ else() ++ string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) ++ string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) ++ string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) ++ add_custom_command( ++ TARGET copy_libs_to_python_dir ++ COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && ++ copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && ++ for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && ++ xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) ++ endif() ++ ++endif(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) + + if(BUILD_WHEEL) + string(REGEX REPLACE "-" "_" NVIMGCODEC_FLAVOR_UNDERSCORE "${NVIMGCODEC_FLAVOR_MINUS}") +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch b/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch new file mode 100644 index 0000000000000..f6691431e37f7 --- /dev/null +++ b/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch @@ -0,0 +1,43 @@ +From 6732446c6b8bdd8d631d96b4f6a7d1763e284097 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 14:50:32 -0500 +Subject: [PATCH 6/9] BLD: Use consistent install directory for cmake configs + +--- + src/CMakeLists.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 940e2a6..83fdfe6 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -113,7 +113,7 @@ endif() + # * /cmake/ + # * /lib*/ + # * /include/ +-set(config_install_dir "${CMAKE_INSTALL_PREFIX}/cmake") ++set(config_install_dir "${CMAKE_INSTALL_PREFIX}/lib/cmake/nvimgcodec") + + set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") + +@@ -165,7 +165,7 @@ install( + # * /cmake/nvimgcodec/nvimgcodecConfigVersion.cmake + install( + FILES "${project_config}" "${version_config}" +- DESTINATION "cmake/nvimgcodec" ++ DESTINATION "${config_install_dir}" + COMPONENT lib + ) + +@@ -174,7 +174,7 @@ install( + install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" +- DESTINATION "cmake/nvimgcodec" ++ DESTINATION "${config_install_dir}" + COMPONENT lib + ) + +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch b/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch new file mode 100644 index 0000000000000..0285ba9a9b6ed --- /dev/null +++ b/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch @@ -0,0 +1,114 @@ +From e93ff96907aa40b1441f6b79689415eb45f5e478 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 17:48:31 -0500 +Subject: [PATCH 7/9] BLD: Let python versions be user-selectable + +--- + cmake/Utils.cmake | 34 ++++++++++++++++++---------------- + 1 file changed, 18 insertions(+), 16 deletions(-) + +diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake +index fb8110d..f247794 100644 +--- a/cmake/Utils.cmake ++++ b/cmake/Utils.cmake +@@ -11,9 +11,9 @@ + # its affiliates is strictly prohibited. + + # this is needed because cmake caching behavior was +-# preventing finding multiple packages of python ++# preventing finding multiple packages of python + # using find_package. So everytime a new python version +-# needs to be found, UnsetPython needs to be called. ++# needs to be found, UnsetPython needs to be called. + function(UnsetPython) + get_cmake_property(all_variables VARIABLES) + foreach(var ${all_variables}) +@@ -65,7 +65,7 @@ function(FindPython PYVER) + message("Python version ${PYVER} not found.") + set(PYTHON_EXISTS 1 PARENT_SCOPE) + endif() +-endfunction() ++endfunction() + + # Build a .so (or .pyd on windows) library variant for each python version provided in PYTHON_VERSIONS variable + # if it is accesible during the build time. The library sufix is provided and specific for each python version +@@ -87,7 +87,7 @@ endfunction() + function(build_per_python_lib) + set(oneValueArgs TARGET_NAME OUTPUT_NAME OUTPUT_DIR PREFIX) + set(multiValueArgs PRIV_LIBS PUBLIC_LIBS SRC EXCLUDE_LIBS) +- ++ + cmake_parse_arguments(PARSE_ARGV 1 PYTHON_LIB_ARG "${options}" "${oneValueArgs}" "${multiValueArgs}") + + set(PYTHON_LIB_ARG_TARGET_NAME ${ARGV0}) +@@ -106,10 +106,12 @@ function(build_per_python_lib) + target_include_directories(${PYTHON_LIB_ARG_TARGET_NAME}_private + INTERFACE "${PYBIND11_INCLUDE_DIR}" + INTERFACE "${pybind11_INCLUDE_DIR}") +- + +- set (PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") +- foreach(PYVER ${PYTHON_VERSIONS}) ++ if(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) ++ set(NVIMG_CODEC_PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") ++ endif(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) ++ ++ foreach(PYVER ${NVIMG_CODEC_PYTHON_VERSIONS}) + + set(PYTHON_LIB_TARGET_FOR_PYVER "${PYTHON_LIB_ARG_TARGET_NAME}_${PYVER}") + # check if listed python versions are accesible +@@ -136,12 +138,12 @@ function(build_per_python_lib) + else() + string(REPLACE "." "" PYVER_WIN "${PYVER}") + set(PYTHON_SUFFIX ".cp${PYVER_WIN}-win_amd64") +- ++ + set(PYTHON_INCLUDES ${Python_INCLUDE_DIRS}) +- ++ + set(PYTHON_LIBRARY ${Python_LIBRARIES}) + endif() +- ++ + # split and make it a list + string(REPLACE "-I" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") + string(REPLACE "\n" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") +@@ -170,23 +172,23 @@ function(build_per_python_lib) + # add interface dummy lib as a dependnecy to easilly propagate options we could set from the above + target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC ${PYTHON_LIB_ARG_TARGET_NAME}_public) + target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PRIVATE ${PYTHON_LIB_ARG_TARGET_NAME}_private) +- ++ + if (WIN32) + target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC "${PYTHON_LIBRARY}") + endif() +- ++ + add_dependencies(${PYTHON_LIB_ARG_TARGET_NAME} ${PYTHON_LIB_TARGET_FOR_PYVER}) + endif() + + endforeach(PYVER) +- if (WIN32) +- # Need to set back the python version which was found at ++ if (WIN32) ++ # Need to set back the python version which was found at + # the beginning of this CMakeLists + UnsetPython() + find_package(Python COMPONENTS Interpreter) + endif() + +-endfunction() ++endfunction() + + + function(parse_cuda_version CUDA_VERSION CUDA_VERSION_MAJOR_VAR CUDA_VERSION_MINOR_VAR CUDA_VERSION_PATCH_VAR CUDA_VERSION_SHORT_VAR CUDA_VERSION_SHORT_DIGIT_ONLY_VAR) +@@ -284,4 +286,4 @@ function(propagate_option BUILD_OPTION_NAME) + message(STATUS "${BUILD_OPTION_NAME} -- OFF") + add_definitions(-D${DEFINE_NAME}=0) + endif() +-endfunction(propagate_option) +\ No newline at end of file ++endfunction(propagate_option) +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch b/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch new file mode 100644 index 0000000000000..71fba57b473de --- /dev/null +++ b/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch @@ -0,0 +1,68 @@ +From 1914106b92eb9c71dcc0d7b7e2e52cb4abc12cfb Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 23:22:31 -0500 +Subject: [PATCH 8/9] BLD: Decouple nvimgcodec and dynlink_* targets + +--- + CMakeLists.txt | 17 ++++------------- + src/CMakeLists.txt | 1 - + 2 files changed, 4 insertions(+), 14 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f15b7c1..dae85f6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -87,13 +87,7 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) + option(BUILD_DOCS "Build documentation" OFF) + option(BUILD_EXTENSIONS "Build extensions modules" ON) + option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) +-if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) +- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") +-endif() + option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) +-if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) +- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") +-endif() + option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) + option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) + option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) +@@ -105,13 +99,6 @@ option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) + option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) + option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) + +-cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON +- "BUILD_NVJPEG_EXT" OFF) +-propagate_option(WITH_DYNAMIC_NVJPEG) +-cmake_dependent_option(WITH_DYNAMIC_NVJPEG2K "Dynamically loads nvjpeg2k at runtime" ON +- "BUILD_NVJPEG2K_EXT" OFF) +-propagate_option(WITH_DYNAMIC_NVJPEG2K) +- + string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) + + # Introduce variables: +@@ -256,6 +243,10 @@ include(Dependencies) + + add_subdirectory(external) + ++if(BUILD_LIBRARY OR BUILD_PYTHON OR BUILD_EXTENSIONS OR BUILD_TEST) ++ add_subdirectory(src/dynlink) ++endif() ++ + if(BUILD_LIBRARY) + add_subdirectory(src) + endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 83fdfe6..306ad46 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -69,7 +69,6 @@ add_library(${NVIMGCODEC_LIBRARY_NAME}_static STATIC ${NVIMGCODEC_SRCS} ${Produc + set(LIBTOPACK ${NVIMGCODEC_LIBRARY_NAME} ${NVIMGCODEC_LIBRARY_NAME}_static) + + find_package(CUDAToolkit REQUIRED) +-add_subdirectory(dynlink) + + target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static dynlink_cuda) + +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch b/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch new file mode 100644 index 0000000000000..e67a27c951ebe --- /dev/null +++ b/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch @@ -0,0 +1,27 @@ +From 7fd9348235602b98ca7738053df1af0a8b0e843a Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 23:23:20 -0500 +Subject: [PATCH 9/9] BLD: Link system nvimgcodec to python module + +--- + python/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 39f54c7..10c2f7e 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -16,6 +16,10 @@ + include(Utils) + include(GNUInstallDirs) + ++if(NOT TARGET nvimgcodec) ++ find_package(nvimgcodec REQUIRED) ++endif() ++ + if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden") + endif() +-- +2.34.1 + diff --git a/recipes/libnvimgcodec/test/CMakeLists.txt b/recipes/libnvimgcodec/test/CMakeLists.txt new file mode 100644 index 0000000000000..72bb426911c8d --- /dev/null +++ b/recipes/libnvimgcodec/test/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.12) + +project(all_headers VERSION 0.1 LANGUAGES C CXX CUDA) + +find_package(nvimgcodec REQUIRED) +find_package(CUDAToolkit REQUIRED COMPONENT cudart) + +set(ALL_TARGETS + nvimgcodec::nvimgcodec + CUDA::cudart +) + +add_executable(c_all_headers all_headers.c) +target_link_libraries(c_all_headers PUBLIC ${ALL_TARGETS}) + +add_executable(cxx_all_headers all_headers.cxx) +target_link_libraries(cxx_all_headers PUBLIC ${ALL_TARGETS}) + +include(GNUInstallDirs) +install(TARGETS c_all_headers cxx_all_headers RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/recipes/libnvimgcodec/test/all_headers.c b/recipes/libnvimgcodec/test/all_headers.c new file mode 100644 index 0000000000000..a2d256f032a3d --- /dev/null +++ b/recipes/libnvimgcodec/test/all_headers.c @@ -0,0 +1,5 @@ +#include + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/recipes/libnvimgcodec/test/all_headers.cxx b/recipes/libnvimgcodec/test/all_headers.cxx new file mode 100644 index 0000000000000..23ad7340822f6 --- /dev/null +++ b/recipes/libnvimgcodec/test/all_headers.cxx @@ -0,0 +1,6 @@ +#include +// #include + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/recipes/nvimgcodec/build.sh b/recipes/nvimgcodec/build.sh new file mode 100644 index 0000000000000..53b9285a1a1a8 --- /dev/null +++ b/recipes/nvimgcodec/build.sh @@ -0,0 +1,51 @@ +#! bash +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +mkdir build +cd build + +nvimg_build_args=( + -DBUILD_DOCS:BOOL=OFF + -DBUILD_SAMPLES:BOOL=OFF + -DBUILD_TEST:BOOL=OFF +# Library args + -DBUILD_LIBRARY:BOOL=OFF + -DWITH_DYNAMIC_NVJPEG:BOOL=ON + -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF +# Extension args + -DBUILD_EXTENSIONS:BOOL=OFF + -DBUILD_NVJPEG_EXT:BOOL=OFF + # nvjpek2k is not yet on conda-forge + -DBUILD_NVJPEG2K_EXT:BOOL=OFF +# Python args + -DBUILD_PYTHON:BOOL=ON + -DBUILD_WHEEL:BOOL=OFF + -DNVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF + -DNVIMG_CODEC_PYTHON_VERSIONS=${PY_VER} + -DNVIMG_CODEC_USE_SYSTEM_DLPACK:BOOL=ON + -DNVIMG_CODEC_USE_SYSTEM_PYBIND:BOOL=ON +) + +cmake ${CMAKE_ARGS} -GNinja "${nvimg_build_args[@]}" ${SRC_DIR} + +cmake --build . + +cmake --install . --strip + +$PYTHON -m pip install --no-deps --no-build-isolation -v $SRC_DIR/build/python + +ln -s $PREFIX/extensions $SP_DIR/nvidia/nvimgcodec/extensions diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml new file mode 100644 index 0000000000000..3044e2ee3e0f7 --- /dev/null +++ b/recipes/nvimgcodec/meta.yaml @@ -0,0 +1,81 @@ +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +{% set version = '0.3.0' %} + +package: + name: nvimgcodec + version: {{ version }} + +source: + url: https://github.com/NVIDIA/nvImageCodec/archive/refs/tags/v{{ version }}.tar.gz + sha256: 4bba949d6cf4e88fcd6b2d86bff960c9ed68eb25b6c4dde3b7772615480ab9fb + patches: + - patches/0001-BUG-Add-missing-headers-from-standard-library.patch + - patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch + - patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch + - patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch + - patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch + - patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch + - patches/0007-BLD-Let-python-versions-be-user-selectable.patch + - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch + - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch + +build: + skip: true # [not linux] + skip: true # [cuda_compiler_version in (None, 'None')] + # Debug skips below + # skip: true # [py != 312] + # skip: true # [cuda_compiler_version != '12.0'] + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cuda') }} + - {{ compiler('cxx')}} + - {{ stdlib('c') }} + - cmake >=3.18 + - ninja + - pkg-config + - python-clang + host: + - cuda-version {{ cuda_compiler_version }} + - dlpack + - libnvimgcodec-dev {{ version }} + - libnvjpeg-dev + - pybind11 + - python + - setuptools + run: + - python + +test: + imports: + - nvidia.nvimgcodec + requires: + - pip + commands: + - pip check + +about: + home: https://github.com/NVIDIA/nvImageCodec + description: > + The nvImageCodec is an open-source library of accelerated codecs with + unified interface. This package is the Python-API only. See libnvimgcodec for the + C-API. + license: Apache-2.0 license + license_family: APACHE + license_file: + - LICENSE.txt + - Acknowledgements.txt + feedstock_name: nvimgcodec diff --git a/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch b/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch new file mode 100644 index 0000000000000..51ad9d47a45f5 --- /dev/null +++ b/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch @@ -0,0 +1,87 @@ +From db52313b58080519bb3be0422599564fd01d8db2 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 10 Sep 2024 17:46:15 -0500 +Subject: [PATCH 1/9] BUG: Add missing headers from standard library + +--- + extensions/libjpeg_turbo/jpeg_handle.h | 9 +++++---- + src/logger.h | 5 +++-- + src/parsers/exif.h | 1 + + 3 files changed, 9 insertions(+), 6 deletions(-) + +diff --git a/extensions/libjpeg_turbo/jpeg_handle.h b/extensions/libjpeg_turbo/jpeg_handle.h +index bc24173..6da1652 100644 +--- a/extensions/libjpeg_turbo/jpeg_handle.h ++++ b/extensions/libjpeg_turbo/jpeg_handle.h +@@ -1,16 +1,16 @@ +-/* ++/* + * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2015 The TensorFlow Authors. All Rights Reserved. + * Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +- * ++ * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at +- * ++ * + * http://www.apache.org/licenses/LICENSE-2.0 +- * ++ * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@@ -23,6 +23,7 @@ + + #pragma once + ++#include + #include + #include "jpeg_utils.h" + +diff --git a/src/logger.h b/src/logger.h +index 4b75869..3264a95 100644 +--- a/src/logger.h ++++ b/src/logger.h +@@ -17,6 +17,7 @@ + + #pragma once + ++#include + #include + #include + #include +@@ -46,7 +47,7 @@ class Logger : public ILogger + } + + void log(const nvimgcodecDebugMessageSeverity_t message_severity, +- const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override ++ const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override + { + nvimgcodecDebugMessageData_t data{NVIMGCODEC_STRUCTURE_TYPE_DEBUG_MESSAGE_DATA, sizeof(nvimgcodecDebugMessageData_t), nullptr, + message.c_str(), 0, nullptr, name_.c_str(), 0}; +@@ -85,4 +86,4 @@ class Logger : public ILogger + std::string name_; + }; + +-} //namespace nvimgcodec +\ No newline at end of file ++} //namespace nvimgcodec +diff --git a/src/parsers/exif.h b/src/parsers/exif.h +index aff554c..d996317 100644 +--- a/src/parsers/exif.h ++++ b/src/parsers/exif.h +@@ -42,6 +42,7 @@ + + #pragma once + ++#include + #include + #include + #include +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch b/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch new file mode 100644 index 0000000000000..e4552d516e1fe --- /dev/null +++ b/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch @@ -0,0 +1,49 @@ +From 04c6631102716182a5df671a57bd0a944dfc195e Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 10 Sep 2024 18:12:59 -0500 +Subject: [PATCH 2/9] BLD: pybind11 dlpack only needed when building for python + +Also allow system libraries for these deps +--- + CMakeLists.txt | 3 +++ + external/CMakeLists.txt | 15 +++++++++++++-- + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f9f1ae..7e19bdf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -95,6 +95,9 @@ option(BUILD_LIBTIFF_EXT "Build libtiff extensions module" ON) + option(BUILD_OPENCV_EXT "Build opencv extensions module" ON) + option(BUILD_PYTHON "Build Python binding" ON) + option(BUILD_WHEEL "Build python wheel package" ON) ++option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) ++option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) ++ + + cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON + "BUILD_NVJPEG_EXT" OFF) +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index 50685ce..88ff95d 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -1,2 +1,13 @@ +-add_subdirectory(pybind11 EXCLUDE_FROM_ALL) +-add_subdirectory(dlpack EXCLUDE_FROM_ALL) +\ No newline at end of file ++if(BUILD_PYTHON) ++ if(NVIMG_CODEC_USE_SYSTEM_PYBIND) ++ find_package(pybind11 REQUIRED) ++ else() ++ add_subdirectory(pybind11 EXCLUDE_FROM_ALL) ++ endif(NVIMG_CODEC_USE_SYSTEM_PYBIND) ++ if(NVIMG_CODEC_USE_SYSTEM_DLPACK) ++ find_package(dlpack REQUIRED) ++ else() ++ add_subdirectory(dlpack EXCLUDE_FROM_ALL) ++ endif(NVIMG_CODEC_USE_SYSTEM_DLPACK) ++endif(BUILD_PYTHON) ++ +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch b/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch new file mode 100644 index 0000000000000..01173f262a065 --- /dev/null +++ b/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch @@ -0,0 +1,31 @@ +From a3327de7c8b08ac2224efa6193f2918f411152f8 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 17 Sep 2024 11:09:47 -0500 +Subject: [PATCH 3/9] DOC: Add Fatal Error if extensions are built without + library + +--- + CMakeLists.txt | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7e19bdf..5e4162b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -87,7 +87,13 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) + option(BUILD_DOCS "Build documentation" OFF) + option(BUILD_EXTENSIONS "Build extensions modules" ON) + option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) ++if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) ++ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") ++endif() + option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) ++if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) ++ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") ++endif() + option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) + option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) + option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch b/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch new file mode 100644 index 0000000000000..bfad729a4adca --- /dev/null +++ b/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch @@ -0,0 +1,240 @@ +From d062794e03a8e167718b7ecd05776216cd338a75 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 13:09:10 -0500 +Subject: [PATCH 4/9] BLD: Let end user set libdir using CMake variables + +--- + CMakeLists.txt | 13 +++++++++++++ + cpack/ld.so.conf.in | 6 +----- + extensions/libjpeg_turbo/CMakeLists.txt | 5 ++--- + extensions/libtiff/CMakeLists.txt | 5 ++--- + extensions/nvbmp/CMakeLists.txt | 5 ++--- + extensions/nvjpeg/CMakeLists.txt | 5 ++--- + extensions/nvjpeg2k/CMakeLists.txt | 5 ++--- + extensions/nvpnm/CMakeLists.txt | 5 ++--- + extensions/opencv/CMakeLists.txt | 5 ++--- + src/CMakeLists.txt | 14 +------------- + 10 files changed, 29 insertions(+), 39 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5e4162b..941a033 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -114,6 +114,19 @@ propagate_option(WITH_DYNAMIC_NVJPEG2K) + + string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) + ++# Introduce variables: ++# * CMAKE_INSTALL_LIBDIR ++# * CMAKE_INSTALL_BINDIR ++# * CMAKE_INSTALL_INCLUDEDIR ++if(NOT DEFINED CMAKE_INSTALL_LIBDIR) ++ if(UNIX) ++ set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib ++ else() ++ set(CMAKE_INSTALL_LIBDIR "lib") ++ endif() ++endif() ++include(GNUInstallDirs) ++ + if(WIN32) + set(CPACK_GENERATOR "ZIP") + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +diff --git a/cpack/ld.so.conf.in b/cpack/ld.so.conf.in +index def1924..389dc26 100644 +--- a/cpack/ld.so.conf.in ++++ b/cpack/ld.so.conf.in +@@ -13,8 +13,4 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-if(UNIX) +- @CMAKE_INSTALL_PREFIX@/lib64 +-else() +- @CMAKE_INSTALL_PREFIX@/lib +-endif() +\ No newline at end of file ++@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ +diff --git a/extensions/libjpeg_turbo/CMakeLists.txt b/extensions/libjpeg_turbo/CMakeLists.txt +index 6b75f9f..b157f66 100644 +--- a/extensions/libjpeg_turbo/CMakeLists.txt ++++ b/extensions/libjpeg_turbo/CMakeLists.txt +@@ -48,15 +48,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/libtiff/CMakeLists.txt b/extensions/libtiff/CMakeLists.txt +index 25ecae0..092fdba 100644 +--- a/extensions/libtiff/CMakeLists.txt ++++ b/extensions/libtiff/CMakeLists.txt +@@ -47,14 +47,13 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + else() + install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/nvbmp/CMakeLists.txt b/extensions/nvbmp/CMakeLists.txt +index 4cf1b97..a408ce6 100644 +--- a/extensions/nvbmp/CMakeLists.txt ++++ b/extensions/nvbmp/CMakeLists.txt +@@ -44,12 +44,11 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib) + else() + install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib) + endif() +diff --git a/extensions/nvjpeg/CMakeLists.txt b/extensions/nvjpeg/CMakeLists.txt +index dc302de..f888288 100644 +--- a/extensions/nvjpeg/CMakeLists.txt ++++ b/extensions/nvjpeg/CMakeLists.txt +@@ -91,15 +91,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/nvjpeg2k/CMakeLists.txt b/extensions/nvjpeg2k/CMakeLists.txt +index 18c99c9..8e569e0 100644 +--- a/extensions/nvjpeg2k/CMakeLists.txt ++++ b/extensions/nvjpeg2k/CMakeLists.txt +@@ -60,15 +60,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/nvpnm/CMakeLists.txt b/extensions/nvpnm/CMakeLists.txt +index 4ed5134..66b1093 100644 +--- a/extensions/nvpnm/CMakeLists.txt ++++ b/extensions/nvpnm/CMakeLists.txt +@@ -43,15 +43,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/extensions/opencv/CMakeLists.txt b/extensions/opencv/CMakeLists.txt +index 36ec99f..ba956a9 100644 +--- a/extensions/opencv/CMakeLists.txt ++++ b/extensions/opencv/CMakeLists.txt +@@ -49,15 +49,14 @@ endif() + if(UNIX) + install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME}_static + LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib +- ARCHIVE DESTINATION lib64 COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + + else() + install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} + RUNTIME DESTINATION extensions COMPONENT lib +- LIBRARY DESTINATION lib COMPONENT lib +- ARCHIVE DESTINATION lib COMPONENT lib ++ LIBRARY COMPONENT lib ++ ARCHIVE COMPONENT lib + PUBLIC_HEADER DESTINATION include COMPONENT lib + ) + endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 5d8aeb0..940e2a6 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -109,18 +109,6 @@ endif() + + # Installation (https://github.com/forexample/package-example) { + +-# Introduce variables: +-# * CMAKE_INSTALL_LIBDIR +-# * CMAKE_INSTALL_BINDIR +-# * CMAKE_INSTALL_INCLUDEDIR +-include(GNUInstallDirs) +-if(UNIX) +- set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib +-else() +- set(CMAKE_INSTALL_LIBDIR "lib") +-endif() +-set(CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") # adjust accordingly +- + # Layout. This works for all platforms: + # * /cmake/ + # * /lib*/ +@@ -190,4 +178,4 @@ install( + COMPONENT lib + ) + +-# } +\ No newline at end of file ++# } +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch b/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch new file mode 100644 index 0000000000000..ab352457154b3 --- /dev/null +++ b/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch @@ -0,0 +1,132 @@ +From 561f4ca740edc3ba4605b12202edea4e0c7d023d Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 13:37:13 -0500 +Subject: [PATCH 5/9] BLD: Make moving libraries to python directory optional + +--- + CMakeLists.txt | 2 +- + python/CMakeLists.txt | 82 +++++++++++++++++++++++-------------------- + 2 files changed, 44 insertions(+), 40 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 941a033..f15b7c1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,7 +103,7 @@ option(BUILD_PYTHON "Build Python binding" ON) + option(BUILD_WHEEL "Build python wheel package" ON) + option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) + option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) +- ++option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) + + cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON + "BUILD_NVJPEG_EXT" OFF) +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 0837211..39f54c7 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -43,7 +43,7 @@ set(PY_NVIMGCODEC_SRCS + image_buffer_kind.cpp + code_stream.cpp + region.cpp) +- ++ + if(UNIX) + set(PY_NVIMGCODEC_IMPL_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec) + else() +@@ -66,50 +66,54 @@ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.in" DESTINATION "${CMAKE_CURRENT + file(COPY "${PROJECT_SOURCE_DIR}/Acknowledgements.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + file(COPY "${PROJECT_SOURCE_DIR}/LICENSE.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + +-add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) +-add_dependencies(copy_libs_to_python_dir +- nvimgcodec +- nvbmp_ext +- nvpnm_ext) ++if(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) + +-if (BUILD_NVJPEG_EXT) +- add_dependencies(copy_libs_to_python_dir nvjpeg_ext) +-endif() ++ add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) ++ add_dependencies(copy_libs_to_python_dir ++ nvimgcodec ++ nvbmp_ext ++ nvpnm_ext) + +-if (BUILD_NVJPEG2K_EXT) +- add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) +-endif() ++ if (BUILD_NVJPEG_EXT) ++ add_dependencies(copy_libs_to_python_dir nvjpeg_ext) ++ endif() + +-if(BUILD_LIBJPEG_TURBO_EXT) +- add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) +-endif() ++ if (BUILD_NVJPEG2K_EXT) ++ add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) ++ endif() + +-if(BUILD_LIBTIFF_EXT) +- add_dependencies(copy_libs_to_python_dir libtiff_ext) +-endif() ++ if(BUILD_LIBJPEG_TURBO_EXT) ++ add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) ++ endif() + +-if(BUILD_OPENCV_EXT) +- add_dependencies(copy_libs_to_python_dir opencv_ext) +-endif() ++ if(BUILD_LIBTIFF_EXT) ++ add_dependencies(copy_libs_to_python_dir libtiff_ext) ++ endif() + +-if(UNIX) +- add_custom_command( +- TARGET copy_libs_to_python_dir +- COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && +- cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && +- cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" +- ) +-else() +- string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) +- string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) +- string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +- add_custom_command( +- TARGET copy_libs_to_python_dir +- COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && +- copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && +- for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && +- xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) +-endif() ++ if(BUILD_OPENCV_EXT) ++ add_dependencies(copy_libs_to_python_dir opencv_ext) ++ endif() ++ ++ if(UNIX) ++ add_custom_command( ++ TARGET copy_libs_to_python_dir ++ COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && ++ cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && ++ cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" ++ ) ++ else() ++ string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) ++ string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) ++ string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) ++ add_custom_command( ++ TARGET copy_libs_to_python_dir ++ COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && ++ copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && ++ for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && ++ xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) ++ endif() ++ ++endif(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) + + if(BUILD_WHEEL) + string(REGEX REPLACE "-" "_" NVIMGCODEC_FLAVOR_UNDERSCORE "${NVIMGCODEC_FLAVOR_MINUS}") +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch b/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch new file mode 100644 index 0000000000000..f6691431e37f7 --- /dev/null +++ b/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch @@ -0,0 +1,43 @@ +From 6732446c6b8bdd8d631d96b4f6a7d1763e284097 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 14:50:32 -0500 +Subject: [PATCH 6/9] BLD: Use consistent install directory for cmake configs + +--- + src/CMakeLists.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 940e2a6..83fdfe6 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -113,7 +113,7 @@ endif() + # * /cmake/ + # * /lib*/ + # * /include/ +-set(config_install_dir "${CMAKE_INSTALL_PREFIX}/cmake") ++set(config_install_dir "${CMAKE_INSTALL_PREFIX}/lib/cmake/nvimgcodec") + + set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") + +@@ -165,7 +165,7 @@ install( + # * /cmake/nvimgcodec/nvimgcodecConfigVersion.cmake + install( + FILES "${project_config}" "${version_config}" +- DESTINATION "cmake/nvimgcodec" ++ DESTINATION "${config_install_dir}" + COMPONENT lib + ) + +@@ -174,7 +174,7 @@ install( + install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" +- DESTINATION "cmake/nvimgcodec" ++ DESTINATION "${config_install_dir}" + COMPONENT lib + ) + +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch b/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch new file mode 100644 index 0000000000000..0285ba9a9b6ed --- /dev/null +++ b/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch @@ -0,0 +1,114 @@ +From e93ff96907aa40b1441f6b79689415eb45f5e478 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 17:48:31 -0500 +Subject: [PATCH 7/9] BLD: Let python versions be user-selectable + +--- + cmake/Utils.cmake | 34 ++++++++++++++++++---------------- + 1 file changed, 18 insertions(+), 16 deletions(-) + +diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake +index fb8110d..f247794 100644 +--- a/cmake/Utils.cmake ++++ b/cmake/Utils.cmake +@@ -11,9 +11,9 @@ + # its affiliates is strictly prohibited. + + # this is needed because cmake caching behavior was +-# preventing finding multiple packages of python ++# preventing finding multiple packages of python + # using find_package. So everytime a new python version +-# needs to be found, UnsetPython needs to be called. ++# needs to be found, UnsetPython needs to be called. + function(UnsetPython) + get_cmake_property(all_variables VARIABLES) + foreach(var ${all_variables}) +@@ -65,7 +65,7 @@ function(FindPython PYVER) + message("Python version ${PYVER} not found.") + set(PYTHON_EXISTS 1 PARENT_SCOPE) + endif() +-endfunction() ++endfunction() + + # Build a .so (or .pyd on windows) library variant for each python version provided in PYTHON_VERSIONS variable + # if it is accesible during the build time. The library sufix is provided and specific for each python version +@@ -87,7 +87,7 @@ endfunction() + function(build_per_python_lib) + set(oneValueArgs TARGET_NAME OUTPUT_NAME OUTPUT_DIR PREFIX) + set(multiValueArgs PRIV_LIBS PUBLIC_LIBS SRC EXCLUDE_LIBS) +- ++ + cmake_parse_arguments(PARSE_ARGV 1 PYTHON_LIB_ARG "${options}" "${oneValueArgs}" "${multiValueArgs}") + + set(PYTHON_LIB_ARG_TARGET_NAME ${ARGV0}) +@@ -106,10 +106,12 @@ function(build_per_python_lib) + target_include_directories(${PYTHON_LIB_ARG_TARGET_NAME}_private + INTERFACE "${PYBIND11_INCLUDE_DIR}" + INTERFACE "${pybind11_INCLUDE_DIR}") +- + +- set (PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") +- foreach(PYVER ${PYTHON_VERSIONS}) ++ if(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) ++ set(NVIMG_CODEC_PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") ++ endif(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) ++ ++ foreach(PYVER ${NVIMG_CODEC_PYTHON_VERSIONS}) + + set(PYTHON_LIB_TARGET_FOR_PYVER "${PYTHON_LIB_ARG_TARGET_NAME}_${PYVER}") + # check if listed python versions are accesible +@@ -136,12 +138,12 @@ function(build_per_python_lib) + else() + string(REPLACE "." "" PYVER_WIN "${PYVER}") + set(PYTHON_SUFFIX ".cp${PYVER_WIN}-win_amd64") +- ++ + set(PYTHON_INCLUDES ${Python_INCLUDE_DIRS}) +- ++ + set(PYTHON_LIBRARY ${Python_LIBRARIES}) + endif() +- ++ + # split and make it a list + string(REPLACE "-I" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") + string(REPLACE "\n" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") +@@ -170,23 +172,23 @@ function(build_per_python_lib) + # add interface dummy lib as a dependnecy to easilly propagate options we could set from the above + target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC ${PYTHON_LIB_ARG_TARGET_NAME}_public) + target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PRIVATE ${PYTHON_LIB_ARG_TARGET_NAME}_private) +- ++ + if (WIN32) + target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC "${PYTHON_LIBRARY}") + endif() +- ++ + add_dependencies(${PYTHON_LIB_ARG_TARGET_NAME} ${PYTHON_LIB_TARGET_FOR_PYVER}) + endif() + + endforeach(PYVER) +- if (WIN32) +- # Need to set back the python version which was found at ++ if (WIN32) ++ # Need to set back the python version which was found at + # the beginning of this CMakeLists + UnsetPython() + find_package(Python COMPONENTS Interpreter) + endif() + +-endfunction() ++endfunction() + + + function(parse_cuda_version CUDA_VERSION CUDA_VERSION_MAJOR_VAR CUDA_VERSION_MINOR_VAR CUDA_VERSION_PATCH_VAR CUDA_VERSION_SHORT_VAR CUDA_VERSION_SHORT_DIGIT_ONLY_VAR) +@@ -284,4 +286,4 @@ function(propagate_option BUILD_OPTION_NAME) + message(STATUS "${BUILD_OPTION_NAME} -- OFF") + add_definitions(-D${DEFINE_NAME}=0) + endif() +-endfunction(propagate_option) +\ No newline at end of file ++endfunction(propagate_option) +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch b/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch new file mode 100644 index 0000000000000..71fba57b473de --- /dev/null +++ b/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch @@ -0,0 +1,68 @@ +From 1914106b92eb9c71dcc0d7b7e2e52cb4abc12cfb Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 23:22:31 -0500 +Subject: [PATCH 8/9] BLD: Decouple nvimgcodec and dynlink_* targets + +--- + CMakeLists.txt | 17 ++++------------- + src/CMakeLists.txt | 1 - + 2 files changed, 4 insertions(+), 14 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f15b7c1..dae85f6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -87,13 +87,7 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) + option(BUILD_DOCS "Build documentation" OFF) + option(BUILD_EXTENSIONS "Build extensions modules" ON) + option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) +-if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) +- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") +-endif() + option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) +-if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) +- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") +-endif() + option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) + option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) + option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) +@@ -105,13 +99,6 @@ option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) + option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) + option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) + +-cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON +- "BUILD_NVJPEG_EXT" OFF) +-propagate_option(WITH_DYNAMIC_NVJPEG) +-cmake_dependent_option(WITH_DYNAMIC_NVJPEG2K "Dynamically loads nvjpeg2k at runtime" ON +- "BUILD_NVJPEG2K_EXT" OFF) +-propagate_option(WITH_DYNAMIC_NVJPEG2K) +- + string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) + + # Introduce variables: +@@ -256,6 +243,10 @@ include(Dependencies) + + add_subdirectory(external) + ++if(BUILD_LIBRARY OR BUILD_PYTHON OR BUILD_EXTENSIONS OR BUILD_TEST) ++ add_subdirectory(src/dynlink) ++endif() ++ + if(BUILD_LIBRARY) + add_subdirectory(src) + endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 83fdfe6..306ad46 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -69,7 +69,6 @@ add_library(${NVIMGCODEC_LIBRARY_NAME}_static STATIC ${NVIMGCODEC_SRCS} ${Produc + set(LIBTOPACK ${NVIMGCODEC_LIBRARY_NAME} ${NVIMGCODEC_LIBRARY_NAME}_static) + + find_package(CUDAToolkit REQUIRED) +-add_subdirectory(dynlink) + + target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static dynlink_cuda) + +-- +2.34.1 + diff --git a/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch b/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch new file mode 100644 index 0000000000000..e67a27c951ebe --- /dev/null +++ b/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch @@ -0,0 +1,27 @@ +From 7fd9348235602b98ca7738053df1af0a8b0e843a Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Thu, 31 Oct 2024 23:23:20 -0500 +Subject: [PATCH 9/9] BLD: Link system nvimgcodec to python module + +--- + python/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 39f54c7..10c2f7e 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -16,6 +16,10 @@ + include(Utils) + include(GNUInstallDirs) + ++if(NOT TARGET nvimgcodec) ++ find_package(nvimgcodec REQUIRED) ++endif() ++ + if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden") + endif() +-- +2.34.1 + From 3abea6a27169eebe92e05459f08755884afd596b Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Fri, 1 Nov 2024 11:39:22 -0500 Subject: [PATCH 02/14] BLD: Add support for CUDA 11 --- recipes/libnvimgcodec/meta.yaml | 7 +++++++ recipes/nvimgcodec/meta.yaml | 3 +++ 2 files changed, 10 insertions(+) diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index 7487eb84eb42a..32774d655e1b2 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. {% set version = '0.3.0' %} +{% set cuda_major = environ.get("cuda_compiler_version", "11.8").split(".")[0]|int %} package: name: libnvimgcodec-split @@ -51,7 +52,9 @@ requirements: - cuda-version {{ cuda_compiler_version }} - libboost-headers - libjpeg-turbo +{% if cuda_major == 12 %} - libnvjpeg-dev +{% endif %} - libopencv - libtiff - nvtx-c @@ -95,7 +98,9 @@ outputs: - {{ stdlib('c') }} # [build_platform == target_platform] - cmake # [build_platform == target_platform] - ninja # [build_platform == target_platform] +{% if cuda_major == 12 %} - cuda-cudart-dev # [build_platform == target_platform] +{% endif %} commands: - cmake ${CMAKE_ARGS} -GNinja test # [build_platform == target_platform] - cmake --build . # [build_platform == target_platform] @@ -122,7 +127,9 @@ outputs: host: - cuda-version {{ cuda_compiler_version }} - libjpeg-turbo +{% if cuda_major == 12 %} - libnvjpeg-dev +{% endif %} - libopencv - libtiff test: diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index 3044e2ee3e0f7..ddcd1c96c5a21 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. {% set version = '0.3.0' %} +{% set cuda_major = environ.get("cuda_compiler_version", "11.8").split(".")[0]|int %} package: name: nvimgcodec @@ -52,7 +53,9 @@ requirements: - cuda-version {{ cuda_compiler_version }} - dlpack - libnvimgcodec-dev {{ version }} +{% if cuda_major == 12 %} - libnvjpeg-dev +{% endif %} - pybind11 - python - setuptools From fefb9c11f06383f6aca40178928dc4477c097992 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Fri, 1 Nov 2024 15:45:22 -0500 Subject: [PATCH 03/14] BLD: Try to build for Windows --- recipes/libnvimgcodec/bld.bat | 48 +++ recipes/libnvimgcodec/meta.yaml | 53 +-- ...10-BLD-Find-libclang-for-conda-forge.patch | 320 ++++++++++++++++++ ...f-nvimgcodec-as-external-target-for-.patch | 25 ++ recipes/nvimgcodec/bld.bat | 54 +++ recipes/nvimgcodec/meta.yaml | 4 +- ...10-BLD-Find-libclang-for-conda-forge.patch | 320 ++++++++++++++++++ ...f-nvimgcodec-as-external-target-for-.patch | 25 ++ 8 files changed, 828 insertions(+), 21 deletions(-) create mode 100644 recipes/libnvimgcodec/bld.bat create mode 100644 recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch create mode 100644 recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch create mode 100644 recipes/nvimgcodec/bld.bat create mode 100644 recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch create mode 100644 recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch diff --git a/recipes/libnvimgcodec/bld.bat b/recipes/libnvimgcodec/bld.bat new file mode 100644 index 0000000000000..6f926bba08541 --- /dev/null +++ b/recipes/libnvimgcodec/bld.bat @@ -0,0 +1,48 @@ +@echo on +REM Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +REM Licensed under the Apache License, Version 2.0 (the "License"); + +setlocal enabledelayedexpansion + +mkdir build + +cd build + +set NVIMG_BUILD_ARGS= ^ + -DBUILD_DOCS:BOOL=OFF ^ + -DBUILD_SAMPLES:BOOL=OFF ^ + -DBUILD_TEST:BOOL=OFF + +set NVIMG_LIBRARY_ARGS= ^ + -DBUILD_LIBRARY:BOOL=ON ^ + -DBUILD_SHARED_LIBS:BOOL=ON ^ + -DBUILD_STATIC_LIBS:BOOL=OFF ^ + -DWITH_DYNAMIC_NVJPEG:BOOL=ON ^ + -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF + +set NVIMG_EXT_ARGS= ^ + -DBUILD_EXTENSIONS:BOOL=ON ^ + -DBUILD_NVJPEG_EXT:BOOL=ON ^ + -DBUILD_NVJPEG2K_EXT:BOOL=OFF ^ + -DBUILD_NVBMP_EXT:BOOL=ON ^ + -DBUILD_NVPNM_EXT:BOOL=ON ^ + -DBUILD_LIBJPEG_TURBO_EXT:BOOL=ON ^ + -DBUILD_LIBTIFF_EXT:BOOL=ON ^ + -DBUILD_OPENCV_EXT:BOOL=ON + +set NVIMG_PYTHON_ARGS= ^ + -DBUILD_PYTHON:BOOL=OFF ^ + -DNVIMG_CODEC_PYTHON_VERSIONS=%PY_VER% ^ + -DBUILD_WHEEL:BOOL=OFF -DNVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF ^ + -DNVIMG_CODEC_USE_SYSTEM_PYBIND:BOOL=OFF ^ + -DNVIMG_CODEC_USE_SYSTEM_DLPACK:BOOL=OFF + +cmake %CMAKE_ARGS% -GNinja -DCMAKE_INSTALL_PREFIX="%PREFIX%/Library" ^ + %NVIMG_BUILD_ARGS% %NVIMG_LIBRARY_ARGS% %NVIMG_EXT_ARGS% ^ + %NVIMG_PYTHON_ARGS% %SRC_DIR% + +cmake --build . + +cmake --install . + +endlocal diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index 32774d655e1b2..1d37bdb23deb9 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. {% set version = '0.3.0' %} +{% set somajor = version.split('.')[0] %} {% set cuda_major = environ.get("cuda_compiler_version", "11.8").split(".")[0]|int %} package: @@ -31,9 +32,11 @@ source: - patches/0007-BLD-Let-python-versions-be-user-selectable.patch - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch + - patches/0010-BLD-Find-libclang-for-conda-forge.patch + - patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch build: - skip: true # [not linux] + skip: true # [not (linux or win)] skip: true # [cuda_compiler_version in (None, 'None')] # Debug skips below # skip: true # [py != 312] @@ -58,7 +61,6 @@ requirements: - libopencv - libtiff - nvtx-c - - setuptools - zlib - zstd @@ -67,22 +69,28 @@ outputs: - name: libnvimgcodec-dev build: run_exports: - - {{ pin_subpackage('libnvimgcodec') }} + - {{ pin_subpackage('libnvimgcodec' ~ somajor) }} files: # This recipe requires conda-build 24.7 or later include: - - include/** - - lib/libnvimgcodec.so - - lib/cmake/nvimgcodec - - etc/** - - extensions/*.so + - include/** # [linux] + - Library/include/** # [win] + - lib/libnvimgcodec.so # [linux] + - Library/lib/nvimagecodec.lib # [linux] + - lib/cmake/nvimgcodec # [linux] + - Library/lib/cmake/nvimgcodec # [win] + - etc/** # [linux] + - Library/etc/** # [win] + - extensions/*.so # [linux] # FIXME: Drop static libraries once CMake config supports it - - extensions/*.a - - lib/libnvimgcodec_static.a + - extensions/*.a # [linux] + - Library/extensions/*static.lib + - lib/libnvimgcodec_static.a # [linux] + - Library/lib/nvimagecodec_static.lib # [linux] exclude: - - lib/python* - - lib/libnvimgcodec.so.* - - extensions/*.so.* + - lib/python* # [linux] + - lib/libnvimgcodec.so.* # [linux] + - extensions/*.so.* # [linux] requirements: host: - {{ pin_subpackage('libnvimgcodec', exact=True) }} @@ -104,20 +112,24 @@ outputs: commands: - cmake ${CMAKE_ARGS} -GNinja test # [build_platform == target_platform] - cmake --build . # [build_platform == target_platform] - - test -f ${PREFIX}/include/nvimgcodec.h # [unix] - - test -f ${PREFIX}/lib/libnvimgcodec.so.0 # [linux] + - test -f ${PREFIX}/include/nvimgcodec.h # [linux] + - if not exist %LIBRARY_INC%\\nvimgcodec.h exit 1 # [win] + - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ somajor }} # [linux] - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }}.0 # [linux] + - if not exist %LIBRARY_LIB%\\nvimgcodec.lib exit 1 # [win] - test -f ${PREFIX}/etc/ld.so.conf.d/nvimgcodec.conf # [unix] - test -f ${PREFIX}/lib/cmake/nvimgcodec/nvimgcodecConfig.cmake # [unix] # - test ! -f ${PREFIX}/lib/libnvimgcodec_static.a # [unix] - - name: libnvimgcodec + - name: libnvimgcodec{{ somajor }} build: run_exports: - - {{ pin_subpackage('libnvimgcodec') }} + - {{ pin_subpackage('libnvimgcodec' ~ somajor) }} files: - - lib/libnvimgcodec.so.* - - extensions/*.so.* + - lib/libnvimgcodec.so.* # [linux] + - Library/bin/nvimgcodec_{{ somajor }}.dll # [win] + - extensions/*.so.* # [linux] + - Library/extensions/*.dll # [win] requirements: build: - {{ compiler('c') }} @@ -134,8 +146,9 @@ outputs: - libtiff test: commands: - - test -f ${PREFIX}/lib/libnvimgcodec.so.0 # [linux] + - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ somajor }} # [linux] - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }}.0 # [linux] + - if not exist %LIBRARY_BIN%\\nvimgcodec_{{ somajor }}.dll exit 1 # [win] about: home: https://github.com/NVIDIA/nvImageCodec diff --git a/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch b/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch new file mode 100644 index 0000000000000..51eb67f3be71a --- /dev/null +++ b/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch @@ -0,0 +1,320 @@ +From 8438661800214ff4be8f33896a13b413d65d62ff Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Fri, 1 Nov 2024 15:27:28 -0500 +Subject: [PATCH 1/2] BLD: Find libclang for conda-forge + +--- + tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- + 1 file changed, 155 insertions(+), 145 deletions(-) + +diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py +index 0447d01..25ad4ef 100644 +--- a/tools/stub_generator/stub_codegen.py ++++ b/tools/stub_generator/stub_codegen.py +@@ -1,148 +1,158 @@ +-# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +-# SPDX-License-Identifier: Apache-2.0 +-# +-# Copyright 2020 The TensorFlow Runtime Authors +-# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. ++# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. ++# SPDX-License-Identifier: Apache-2.0 ++# ++# Copyright 2020 The TensorFlow Runtime Authors ++# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + # +-# Licensed under the Apache License, Version 2.0 (the "License"); +-# you may not use this file except in compliance with the License. +-# You may obtain a copy of the License at ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at + # +-# http://www.apache.org/licenses/LICENSE-2.0 ++# http://www.apache.org/licenses/LICENSE-2.0 + # +-# Unless required by applicable law or agreed to in writing, software +-# distributed under the License is distributed on an "AS IS" BASIS, +-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-# See the License for the specific language governing permissions and +-# limitations under the License. +- +-# Lint as: python3 +-"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" +- +-from __future__ import absolute_import +-from __future__ import print_function +- +-import argparse +-import re +-import json +-import clang.cindex +-import os +- +- +-def function_header(return_type, name, args): +- args_expr = [] +- for arg_type, arg_name in args: +- # handle arrays and function (or array of) pointer and reference to an array differently +- # as well +- # int[], int (*)(), int (*[])(), int (&)[5] +- match = re.search(r'\[|\)', arg_type) +- if match: +- pos = match.span()[0] +- print(arg_type[:pos]) +- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") +- else: +- args_expr.append(f"{arg_type} {arg_name}") +- +- arg_str = ", ".join(args_expr) +- ret = f"{return_type} {name}({arg_str})" +- return ret +- +- +-def main(): +- parser = argparse.ArgumentParser( +- description='Generate dynamic loading stubs for CUDA and HIP APIs.') +- parser.add_argument('--unique_prefix', default="", type=str, +- help='Unique prefix for used in the stub') +- parser.add_argument( +- 'input', nargs='?', type=argparse.FileType('r')) +- parser.add_argument( +- 'output', nargs='?', type=argparse.FileType('w')) +- parser.add_argument( +- 'header', nargs='?', type=str, default=None) +- parser.add_argument( +- 'extra_args', nargs='*', type=str, default=None) +- args = parser.parse_args() +- +- +- if os.name == 'nt': +- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') +- config = json.load(args.input) +- +- function_impl = """ +-{return_type} %s {1}NotFound({2}) {{ +- return {not_found_error}; +-}} +- +-{0} {{ +- using FuncPtr = {return_type} (*) ({2}); +- +- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? +- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : +- {1}NotFound; +- return func_ptr({3}); +-}}\n""" % (config['calling_conv']) +- +- prolog = """ +-void *{0}LoadSymbol(const char *name); +- +-#define LOAD_SYMBOL_FUNC {0}##LoadSymbol +- +-""" +- +- index = clang.cindex.Index.create() +- header = args.header +- extra_args = args.extra_args +- +- translation_unit = index.parse(header, args=extra_args) +- +- for diag in translation_unit.diagnostics: +- if diag.severity in [diag.Warning, diag.Fatal]: +- raise Exception(str(diag)) +- +- for extra_i in config['extra_include']: +- args.output.write('#include {}\n'.format(extra_i)) +- args.output.write(prolog.format(args.unique_prefix)) +- +- all_definition = set() +- all_declaration = set() +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.is_definition(): +- all_definition.add(cursor.spelling) +- +- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: +- all_declaration.add(cursor.spelling) +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: +- continue +- +- function_name = cursor.spelling +- +- # make sure that we deal only with functions with no definition +- if function_name not in config['functions'] or function_name in all_definition or \ +- function_name not in all_declaration: +- continue +- +- # make sure that we deal with every function only once +- all_declaration.remove(function_name) +- +- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] +- arg_names = [arg.spelling for arg in cursor.get_arguments()] +- +- return_type = config['functions'][function_name].get( +- 'return_type', config['return_type']) +- not_found_error = config['functions'][function_name].get( +- 'not_found_error', config['not_found_error']) +- +- header = function_header(return_type, function_name, zip(arg_types, arg_names)) +- +- implementation = function_impl.format(header, function_name, ', '.join(arg_types), +- ', '.join(arg_names), return_type=return_type, +- not_found_error=not_found_error) +- +- args.output.write(implementation) +- +- +-if __name__ == '__main__': +- main() ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++ ++# Lint as: python3 ++"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" ++ ++from __future__ import absolute_import ++from __future__ import print_function ++ ++import argparse ++import re ++import json ++import clang.cindex ++import os ++ ++ ++def function_header(return_type, name, args): ++ args_expr = [] ++ for arg_type, arg_name in args: ++ # handle arrays and function (or array of) pointer and reference to an array differently ++ # as well ++ # int[], int (*)(), int (*[])(), int (&)[5] ++ match = re.search(r'\[|\)', arg_type) ++ if match: ++ pos = match.span()[0] ++ print(arg_type[:pos]) ++ args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") ++ else: ++ args_expr.append(f"{arg_type} {arg_name}") ++ ++ arg_str = ", ".join(args_expr) ++ ret = f"{return_type} {name}({arg_str})" ++ return ret ++ ++ ++def main(): ++ parser = argparse.ArgumentParser( ++ description='Generate dynamic loading stubs for CUDA and HIP APIs.') ++ parser.add_argument('--unique_prefix', default="", type=str, ++ help='Unique prefix for used in the stub') ++ parser.add_argument( ++ 'input', nargs='?', type=argparse.FileType('r')) ++ parser.add_argument( ++ 'output', nargs='?', type=argparse.FileType('w')) ++ parser.add_argument( ++ 'header', nargs='?', type=str, default=None) ++ parser.add_argument( ++ 'extra_args', nargs='*', type=str, default=None) ++ args = parser.parse_args() ++ ++ ++ if os.name == 'nt': ++ for libclang_file in [ ++ 'C:/Program Files/LLVM/bin/libclang.dll', ++ os.path.join(os.environ['BUILD_PREFIX'], 'Library/bin/libclang-13.dll'), ++ os.path.join(os.environ['PREFIX'], 'Library/bin/libclang-13.dll'), ++ os.path.join(os.environ['CONDA_PREFIX'], 'Library/bin/libclang-13.dll'), ++ ]: ++ libclang_file = os.path.abspath(libclang_file) ++ if os.path.isfile(libclang_file): ++ print(f"Found libclang at {libclang_file}") ++ clang.cindex.Config.set_library_file(libclang_file) ++ break ++ config = json.load(args.input) ++ ++ function_impl = """ ++{return_type} %s {1}NotFound({2}) {{ ++ return {not_found_error}; ++}} ++ ++{0} {{ ++ using FuncPtr = {return_type} (*) ({2}); ++ ++ static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? ++ reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : ++ {1}NotFound; ++ return func_ptr({3}); ++}}\n""" % (config['calling_conv']) ++ ++ prolog = """ ++void *{0}LoadSymbol(const char *name); ++ ++#define LOAD_SYMBOL_FUNC {0}##LoadSymbol ++ ++""" ++ ++ index = clang.cindex.Index.create() ++ header = args.header ++ extra_args = args.extra_args ++ ++ translation_unit = index.parse(header, args=extra_args) ++ ++ for diag in translation_unit.diagnostics: ++ if diag.severity in [diag.Warning, diag.Fatal]: ++ raise Exception(str(diag)) ++ ++ for extra_i in config['extra_include']: ++ args.output.write('#include {}\n'.format(extra_i)) ++ args.output.write(prolog.format(args.unique_prefix)) ++ ++ all_definition = set() ++ all_declaration = set() ++ ++ for cursor in translation_unit.cursor.get_children(): ++ if cursor.is_definition(): ++ all_definition.add(cursor.spelling) ++ ++ if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: ++ all_declaration.add(cursor.spelling) ++ ++ for cursor in translation_unit.cursor.get_children(): ++ if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: ++ continue ++ ++ function_name = cursor.spelling ++ ++ # make sure that we deal only with functions with no definition ++ if function_name not in config['functions'] or function_name in all_definition or \ ++ function_name not in all_declaration: ++ continue ++ ++ # make sure that we deal with every function only once ++ all_declaration.remove(function_name) ++ ++ arg_types = [arg.type.spelling for arg in cursor.get_arguments()] ++ arg_names = [arg.spelling for arg in cursor.get_arguments()] ++ ++ return_type = config['functions'][function_name].get( ++ 'return_type', config['return_type']) ++ not_found_error = config['functions'][function_name].get( ++ 'not_found_error', config['not_found_error']) ++ ++ header = function_header(return_type, function_name, zip(arg_types, arg_names)) ++ ++ implementation = function_impl.format(header, function_name, ', '.join(arg_types), ++ ', '.join(arg_names), return_type=return_type, ++ not_found_error=not_found_error) ++ ++ args.output.write(implementation) ++ ++ ++if __name__ == '__main__': ++ main() +-- +2.46.2.windows.1 + diff --git a/recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch b/recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch new file mode 100644 index 0000000000000..6e295c649e21e --- /dev/null +++ b/recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch @@ -0,0 +1,25 @@ +From 36664a005abdb0024b47dce49fd2c38788179077 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Fri, 1 Nov 2024 15:28:37 -0500 +Subject: [PATCH 2/2] BLD: Fix import of nvimgcodec as external target for + Windows + +--- + python/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 10c2f7e..f34b5c7 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -18,6 +18,7 @@ include(GNUInstallDirs) + + if(NOT TARGET nvimgcodec) + find_package(nvimgcodec REQUIRED) ++ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) + endif() + + if(UNIX) +-- +2.46.2.windows.1 + diff --git a/recipes/nvimgcodec/bld.bat b/recipes/nvimgcodec/bld.bat new file mode 100644 index 0000000000000..2d307a861544a --- /dev/null +++ b/recipes/nvimgcodec/bld.bat @@ -0,0 +1,54 @@ +@echo on +REM Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +REM Licensed under the Apache License, Version 2.0 (the "License"); + +setlocal enabledelayedexpansion + +mkdir build + +cd build + +set NVIMG_BUILD_ARGS= ^ + -DBUILD_DOCS:BOOL=OFF ^ + -DBUILD_SAMPLES:BOOL=OFF ^ + -DBUILD_TEST:BOOL=OFF + +set NVIMG_LIBRARY_ARGS= ^ + -DBUILD_LIBRARY:BOOL=OFF ^ + -DBUILD_SHARED_LIBS:BOOL=ON ^ + -DBUILD_STATIC_LIBS:BOOL=OFF ^ + -DWITH_DYNAMIC_NVJPEG:BOOL=ON ^ + -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF + +set NVIMG_EXT_ARGS= ^ + -DBUILD_EXTENSIONS:BOOL=OFF ^ + -DBUILD_NVJPEG_EXT:BOOL=OFF ^ + -DBUILD_NVJPEG2K_EXT:BOOL=OFF ^ + -DBUILD_NVBMP_EXT:BOOL=OFF ^ + -DBUILD_NVPNM_EXT:BOOL=OFF ^ + -DBUILD_LIBJPEG_TURBO_EXT:BOOL=OFF ^ + -DBUILD_LIBTIFF_EXT:BOOL=OFF ^ + -DBUILD_OPENCV_EXT:BOOL=OFF + +set NVIMG_PYTHON_ARGS= ^ + -DBUILD_PYTHON:BOOL=ON ^ + -DNVIMG_CODEC_PYTHON_VERSIONS=%PY_VER% ^ + -DBUILD_WHEEL:BOOL=OFF ^ + -DNVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF ^ + -DNVIMG_CODEC_USE_SYSTEM_PYBIND:BOOL=ON ^ + -DNVIMG_CODEC_USE_SYSTEM_DLPACK:BOOL=ON + +cmake %CMAKE_ARGS% -GNinja -DCMAKE_INSTALL_PREFIX="%PREFIX%/Library" ^ + %NVIMG_BUILD_ARGS% %NVIMG_LIBRARY_ARGS% %NVIMG_EXT_ARGS% ^ + %NVIMG_PYTHON_ARGS% %SRC_DIR% + +cmake --build . + +cmake --install . + +@REM copy in CMakeLists doesn't work for unknown reason +move .\python\nvimgcodec*.pyd .\python\nvidia\nvimgcodec\ + +%PYTHON% -m pip install .\python --no-deps --no-build-isolation -v + +endlocal diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index ddcd1c96c5a21..6378c4638a0ef 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -31,9 +31,11 @@ source: - patches/0007-BLD-Let-python-versions-be-user-selectable.patch - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch + - patches/0010-BLD-Find-libclang-for-conda-forge.patch + - patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch build: - skip: true # [not linux] + skip: true # [not (linux or win)] skip: true # [cuda_compiler_version in (None, 'None')] # Debug skips below # skip: true # [py != 312] diff --git a/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch b/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch new file mode 100644 index 0000000000000..51eb67f3be71a --- /dev/null +++ b/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch @@ -0,0 +1,320 @@ +From 8438661800214ff4be8f33896a13b413d65d62ff Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Fri, 1 Nov 2024 15:27:28 -0500 +Subject: [PATCH 1/2] BLD: Find libclang for conda-forge + +--- + tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- + 1 file changed, 155 insertions(+), 145 deletions(-) + +diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py +index 0447d01..25ad4ef 100644 +--- a/tools/stub_generator/stub_codegen.py ++++ b/tools/stub_generator/stub_codegen.py +@@ -1,148 +1,158 @@ +-# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +-# SPDX-License-Identifier: Apache-2.0 +-# +-# Copyright 2020 The TensorFlow Runtime Authors +-# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. ++# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. ++# SPDX-License-Identifier: Apache-2.0 ++# ++# Copyright 2020 The TensorFlow Runtime Authors ++# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + # +-# Licensed under the Apache License, Version 2.0 (the "License"); +-# you may not use this file except in compliance with the License. +-# You may obtain a copy of the License at ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at + # +-# http://www.apache.org/licenses/LICENSE-2.0 ++# http://www.apache.org/licenses/LICENSE-2.0 + # +-# Unless required by applicable law or agreed to in writing, software +-# distributed under the License is distributed on an "AS IS" BASIS, +-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-# See the License for the specific language governing permissions and +-# limitations under the License. +- +-# Lint as: python3 +-"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" +- +-from __future__ import absolute_import +-from __future__ import print_function +- +-import argparse +-import re +-import json +-import clang.cindex +-import os +- +- +-def function_header(return_type, name, args): +- args_expr = [] +- for arg_type, arg_name in args: +- # handle arrays and function (or array of) pointer and reference to an array differently +- # as well +- # int[], int (*)(), int (*[])(), int (&)[5] +- match = re.search(r'\[|\)', arg_type) +- if match: +- pos = match.span()[0] +- print(arg_type[:pos]) +- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") +- else: +- args_expr.append(f"{arg_type} {arg_name}") +- +- arg_str = ", ".join(args_expr) +- ret = f"{return_type} {name}({arg_str})" +- return ret +- +- +-def main(): +- parser = argparse.ArgumentParser( +- description='Generate dynamic loading stubs for CUDA and HIP APIs.') +- parser.add_argument('--unique_prefix', default="", type=str, +- help='Unique prefix for used in the stub') +- parser.add_argument( +- 'input', nargs='?', type=argparse.FileType('r')) +- parser.add_argument( +- 'output', nargs='?', type=argparse.FileType('w')) +- parser.add_argument( +- 'header', nargs='?', type=str, default=None) +- parser.add_argument( +- 'extra_args', nargs='*', type=str, default=None) +- args = parser.parse_args() +- +- +- if os.name == 'nt': +- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') +- config = json.load(args.input) +- +- function_impl = """ +-{return_type} %s {1}NotFound({2}) {{ +- return {not_found_error}; +-}} +- +-{0} {{ +- using FuncPtr = {return_type} (*) ({2}); +- +- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? +- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : +- {1}NotFound; +- return func_ptr({3}); +-}}\n""" % (config['calling_conv']) +- +- prolog = """ +-void *{0}LoadSymbol(const char *name); +- +-#define LOAD_SYMBOL_FUNC {0}##LoadSymbol +- +-""" +- +- index = clang.cindex.Index.create() +- header = args.header +- extra_args = args.extra_args +- +- translation_unit = index.parse(header, args=extra_args) +- +- for diag in translation_unit.diagnostics: +- if diag.severity in [diag.Warning, diag.Fatal]: +- raise Exception(str(diag)) +- +- for extra_i in config['extra_include']: +- args.output.write('#include {}\n'.format(extra_i)) +- args.output.write(prolog.format(args.unique_prefix)) +- +- all_definition = set() +- all_declaration = set() +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.is_definition(): +- all_definition.add(cursor.spelling) +- +- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: +- all_declaration.add(cursor.spelling) +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: +- continue +- +- function_name = cursor.spelling +- +- # make sure that we deal only with functions with no definition +- if function_name not in config['functions'] or function_name in all_definition or \ +- function_name not in all_declaration: +- continue +- +- # make sure that we deal with every function only once +- all_declaration.remove(function_name) +- +- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] +- arg_names = [arg.spelling for arg in cursor.get_arguments()] +- +- return_type = config['functions'][function_name].get( +- 'return_type', config['return_type']) +- not_found_error = config['functions'][function_name].get( +- 'not_found_error', config['not_found_error']) +- +- header = function_header(return_type, function_name, zip(arg_types, arg_names)) +- +- implementation = function_impl.format(header, function_name, ', '.join(arg_types), +- ', '.join(arg_names), return_type=return_type, +- not_found_error=not_found_error) +- +- args.output.write(implementation) +- +- +-if __name__ == '__main__': +- main() ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++ ++# Lint as: python3 ++"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" ++ ++from __future__ import absolute_import ++from __future__ import print_function ++ ++import argparse ++import re ++import json ++import clang.cindex ++import os ++ ++ ++def function_header(return_type, name, args): ++ args_expr = [] ++ for arg_type, arg_name in args: ++ # handle arrays and function (or array of) pointer and reference to an array differently ++ # as well ++ # int[], int (*)(), int (*[])(), int (&)[5] ++ match = re.search(r'\[|\)', arg_type) ++ if match: ++ pos = match.span()[0] ++ print(arg_type[:pos]) ++ args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") ++ else: ++ args_expr.append(f"{arg_type} {arg_name}") ++ ++ arg_str = ", ".join(args_expr) ++ ret = f"{return_type} {name}({arg_str})" ++ return ret ++ ++ ++def main(): ++ parser = argparse.ArgumentParser( ++ description='Generate dynamic loading stubs for CUDA and HIP APIs.') ++ parser.add_argument('--unique_prefix', default="", type=str, ++ help='Unique prefix for used in the stub') ++ parser.add_argument( ++ 'input', nargs='?', type=argparse.FileType('r')) ++ parser.add_argument( ++ 'output', nargs='?', type=argparse.FileType('w')) ++ parser.add_argument( ++ 'header', nargs='?', type=str, default=None) ++ parser.add_argument( ++ 'extra_args', nargs='*', type=str, default=None) ++ args = parser.parse_args() ++ ++ ++ if os.name == 'nt': ++ for libclang_file in [ ++ 'C:/Program Files/LLVM/bin/libclang.dll', ++ os.path.join(os.environ['BUILD_PREFIX'], 'Library/bin/libclang-13.dll'), ++ os.path.join(os.environ['PREFIX'], 'Library/bin/libclang-13.dll'), ++ os.path.join(os.environ['CONDA_PREFIX'], 'Library/bin/libclang-13.dll'), ++ ]: ++ libclang_file = os.path.abspath(libclang_file) ++ if os.path.isfile(libclang_file): ++ print(f"Found libclang at {libclang_file}") ++ clang.cindex.Config.set_library_file(libclang_file) ++ break ++ config = json.load(args.input) ++ ++ function_impl = """ ++{return_type} %s {1}NotFound({2}) {{ ++ return {not_found_error}; ++}} ++ ++{0} {{ ++ using FuncPtr = {return_type} (*) ({2}); ++ ++ static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? ++ reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : ++ {1}NotFound; ++ return func_ptr({3}); ++}}\n""" % (config['calling_conv']) ++ ++ prolog = """ ++void *{0}LoadSymbol(const char *name); ++ ++#define LOAD_SYMBOL_FUNC {0}##LoadSymbol ++ ++""" ++ ++ index = clang.cindex.Index.create() ++ header = args.header ++ extra_args = args.extra_args ++ ++ translation_unit = index.parse(header, args=extra_args) ++ ++ for diag in translation_unit.diagnostics: ++ if diag.severity in [diag.Warning, diag.Fatal]: ++ raise Exception(str(diag)) ++ ++ for extra_i in config['extra_include']: ++ args.output.write('#include {}\n'.format(extra_i)) ++ args.output.write(prolog.format(args.unique_prefix)) ++ ++ all_definition = set() ++ all_declaration = set() ++ ++ for cursor in translation_unit.cursor.get_children(): ++ if cursor.is_definition(): ++ all_definition.add(cursor.spelling) ++ ++ if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: ++ all_declaration.add(cursor.spelling) ++ ++ for cursor in translation_unit.cursor.get_children(): ++ if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: ++ continue ++ ++ function_name = cursor.spelling ++ ++ # make sure that we deal only with functions with no definition ++ if function_name not in config['functions'] or function_name in all_definition or \ ++ function_name not in all_declaration: ++ continue ++ ++ # make sure that we deal with every function only once ++ all_declaration.remove(function_name) ++ ++ arg_types = [arg.type.spelling for arg in cursor.get_arguments()] ++ arg_names = [arg.spelling for arg in cursor.get_arguments()] ++ ++ return_type = config['functions'][function_name].get( ++ 'return_type', config['return_type']) ++ not_found_error = config['functions'][function_name].get( ++ 'not_found_error', config['not_found_error']) ++ ++ header = function_header(return_type, function_name, zip(arg_types, arg_names)) ++ ++ implementation = function_impl.format(header, function_name, ', '.join(arg_types), ++ ', '.join(arg_names), return_type=return_type, ++ not_found_error=not_found_error) ++ ++ args.output.write(implementation) ++ ++ ++if __name__ == '__main__': ++ main() +-- +2.46.2.windows.1 + diff --git a/recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch b/recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch new file mode 100644 index 0000000000000..6e295c649e21e --- /dev/null +++ b/recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch @@ -0,0 +1,25 @@ +From 36664a005abdb0024b47dce49fd2c38788179077 Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Fri, 1 Nov 2024 15:28:37 -0500 +Subject: [PATCH 2/2] BLD: Fix import of nvimgcodec as external target for + Windows + +--- + python/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 10c2f7e..f34b5c7 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -18,6 +18,7 @@ include(GNUInstallDirs) + + if(NOT TARGET nvimgcodec) + find_package(nvimgcodec REQUIRED) ++ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) + endif() + + if(UNIX) +-- +2.46.2.windows.1 + From 1dba43c5d73ad2cab85a61f3d0311a532319db9c Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Fri, 1 Nov 2024 15:58:23 -0500 Subject: [PATCH 04/14] STY: Fix recipe lint --- recipes/libnvimgcodec/meta.yaml | 14 ++++++++++---- recipes/nvimgcodec/meta.yaml | 10 ++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index 1d37bdb23deb9..7944e45c9f5d2 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -36,6 +36,7 @@ source: - patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch build: + number: 0 skip: true # [not (linux or win)] skip: true # [cuda_compiler_version in (None, 'None')] # Debug skips below @@ -45,7 +46,7 @@ requirements: build: - {{ compiler('c') }} - {{ compiler('cuda') }} - - {{ compiler('cxx')}} + - {{ compiler('cxx') }} - {{ stdlib('c') }} - cmake >=3.18 - ninja @@ -93,9 +94,9 @@ outputs: - extensions/*.so.* # [linux] requirements: host: - - {{ pin_subpackage('libnvimgcodec', exact=True) }} + - {{ pin_subpackage('libnvimgcodec' ~ somajor, exact=True) }} run: - - {{ pin_subpackage('libnvimgcodec', exact=True) }} + - {{ pin_subpackage('libnvimgcodec' ~ somajor, exact=True) }} test: files: - test @@ -152,13 +153,18 @@ outputs: about: home: https://github.com/NVIDIA/nvImageCodec + summary: The C API for nvImageCodec. description: > The nvImageCodec is an open-source library of accelerated codecs with unified interface. This package is the C-API only. See nvimgcodec for the Python-API. - license: Apache-2.0 license + license: Apache-2.0 license_family: APACHE license_file: - LICENSE.txt - Acknowledgements.txt + +extra: feedstock_name: libnvimgcodec + recipe-maintainers: + - conda-forge/cuda diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index 6378c4638a0ef..17aad2e70fbe0 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -35,6 +35,7 @@ source: - patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch build: + number: 0 skip: true # [not (linux or win)] skip: true # [cuda_compiler_version in (None, 'None')] # Debug skips below @@ -45,7 +46,7 @@ requirements: build: - {{ compiler('c') }} - {{ compiler('cuda') }} - - {{ compiler('cxx')}} + - {{ compiler('cxx') }} - {{ stdlib('c') }} - cmake >=3.18 - ninja @@ -74,13 +75,18 @@ test: about: home: https://github.com/NVIDIA/nvImageCodec + summary: The Python API for nvImageCodec. description: > The nvImageCodec is an open-source library of accelerated codecs with unified interface. This package is the Python-API only. See libnvimgcodec for the C-API. - license: Apache-2.0 license + license: Apache-2.0 license_family: APACHE license_file: - LICENSE.txt - Acknowledgements.txt + +extra: feedstock_name: nvimgcodec + recipe-maintainers: + - conda-forge/cuda From 8257e560b2a14568c59b6860bf25813a14037a1f Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Fri, 1 Nov 2024 16:03:09 -0500 Subject: [PATCH 05/14] STY: Fix more lint --- recipes/libnvimgcodec/meta.yaml | 4 ++-- recipes/nvimgcodec/meta.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index 7944e45c9f5d2..9a8a98f3f38e2 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -135,7 +135,7 @@ outputs: build: - {{ compiler('c') }} - {{ compiler('cuda') }} - - {{ compiler('cxx')}} + - {{ compiler('cxx') }} - {{ stdlib('c') }} host: - cuda-version {{ cuda_compiler_version }} @@ -165,6 +165,6 @@ about: - Acknowledgements.txt extra: - feedstock_name: libnvimgcodec + feedstock-name: libnvimgcodec recipe-maintainers: - conda-forge/cuda diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index 17aad2e70fbe0..dc9ecefd3ec8c 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -87,6 +87,6 @@ about: - Acknowledgements.txt extra: - feedstock_name: nvimgcodec + feedstock-name: nvimgcodec recipe-maintainers: - conda-forge/cuda From 9139d844415ce4d7182dfe17d1962122554e02d9 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Fri, 1 Nov 2024 16:40:12 -0500 Subject: [PATCH 06/14] BLD: Consolidate patches --- recipes/libnvimgcodec/meta.yaml | 1 - ...issing-headers-from-standard-library.patch | 4 +- ...ack-only-needed-when-building-for-py.patch | 5 +- ...ror-if-extensions-are-built-without-.patch | 4 +- ...ser-set-libdir-using-CMake-variables.patch | 4 +- ...libraries-to-python-directory-option.patch | 4 +- ...nt-install-directory-for-cmake-confi.patch | 4 +- ...t-python-versions-be-user-selectable.patch | 4 +- ...uple-nvimgcodec-and-dynlink_-targets.patch | 4 +- ...k-system-nvimgcodec-to-python-module.patch | 15 +- ...10-BLD-Find-libclang-for-conda-forge.patch | 330 +++++++++--------- ...f-nvimgcodec-as-external-target-for-.patch | 25 -- recipes/nvimgcodec/meta.yaml | 1 - ...issing-headers-from-standard-library.patch | 4 +- ...ack-only-needed-when-building-for-py.patch | 5 +- ...ror-if-extensions-are-built-without-.patch | 4 +- ...ser-set-libdir-using-CMake-variables.patch | 4 +- ...libraries-to-python-directory-option.patch | 4 +- ...nt-install-directory-for-cmake-confi.patch | 4 +- ...t-python-versions-be-user-selectable.patch | 4 +- ...uple-nvimgcodec-and-dynlink_-targets.patch | 4 +- ...k-system-nvimgcodec-to-python-module.patch | 15 +- ...10-BLD-Find-libclang-for-conda-forge.patch | 330 +++++++++--------- ...f-nvimgcodec-as-external-target-for-.patch | 25 -- 24 files changed, 380 insertions(+), 428 deletions(-) delete mode 100644 recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch delete mode 100644 recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index 9a8a98f3f38e2..bdcd2825f9f0e 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -33,7 +33,6 @@ source: - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch - patches/0010-BLD-Find-libclang-for-conda-forge.patch - - patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch build: number: 0 diff --git a/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch b/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch index 51ad9d47a45f5..da8ffef8a9e1d 100644 --- a/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch +++ b/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch @@ -1,7 +1,7 @@ From db52313b58080519bb3be0422599564fd01d8db2 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 10 Sep 2024 17:46:15 -0500 -Subject: [PATCH 1/9] BUG: Add missing headers from standard library +Subject: [PATCH 01/10] BUG: Add missing headers from standard library --- extensions/libjpeg_turbo/jpeg_handle.h | 9 +++++---- @@ -83,5 +83,5 @@ index aff554c..d996317 100644 #include #include -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch b/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch index e4552d516e1fe..2bd2fe62be85a 100644 --- a/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch +++ b/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch @@ -1,7 +1,8 @@ From 04c6631102716182a5df671a57bd0a944dfc195e Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 10 Sep 2024 18:12:59 -0500 -Subject: [PATCH 2/9] BLD: pybind11 dlpack only needed when building for python +Subject: [PATCH 02/10] BLD: pybind11 dlpack only needed when building for + python Also allow system libraries for these deps --- @@ -45,5 +46,5 @@ index 50685ce..88ff95d 100644 +endif(BUILD_PYTHON) + -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch b/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch index 01173f262a065..edb835674f2f4 100644 --- a/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch +++ b/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch @@ -1,7 +1,7 @@ From a3327de7c8b08ac2224efa6193f2918f411152f8 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 17 Sep 2024 11:09:47 -0500 -Subject: [PATCH 3/9] DOC: Add Fatal Error if extensions are built without +Subject: [PATCH 03/10] DOC: Add Fatal Error if extensions are built without library --- @@ -27,5 +27,5 @@ index 7e19bdf..5e4162b 100644 option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch b/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch index bfad729a4adca..b505cd1d11df0 100644 --- a/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch +++ b/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch @@ -1,7 +1,7 @@ From d062794e03a8e167718b7ecd05776216cd338a75 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 13:09:10 -0500 -Subject: [PATCH 4/9] BLD: Let end user set libdir using CMake variables +Subject: [PATCH 04/10] BLD: Let end user set libdir using CMake variables --- CMakeLists.txt | 13 +++++++++++++ @@ -236,5 +236,5 @@ index 5d8aeb0..940e2a6 100644 \ No newline at end of file +# } -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch b/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch index ab352457154b3..6dd936cf4061e 100644 --- a/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch +++ b/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch @@ -1,7 +1,7 @@ From 561f4ca740edc3ba4605b12202edea4e0c7d023d Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 13:37:13 -0500 -Subject: [PATCH 5/9] BLD: Make moving libraries to python directory optional +Subject: [PATCH 05/10] BLD: Make moving libraries to python directory optional --- CMakeLists.txt | 2 +- @@ -128,5 +128,5 @@ index 0837211..39f54c7 100644 if(BUILD_WHEEL) string(REGEX REPLACE "-" "_" NVIMGCODEC_FLAVOR_UNDERSCORE "${NVIMGCODEC_FLAVOR_MINUS}") -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch b/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch index f6691431e37f7..c40b6a47d24c4 100644 --- a/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch +++ b/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch @@ -1,7 +1,7 @@ From 6732446c6b8bdd8d631d96b4f6a7d1763e284097 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 14:50:32 -0500 -Subject: [PATCH 6/9] BLD: Use consistent install directory for cmake configs +Subject: [PATCH 06/10] BLD: Use consistent install directory for cmake configs --- src/CMakeLists.txt | 6 +++--- @@ -39,5 +39,5 @@ index 940e2a6..83fdfe6 100644 ) -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch b/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch index 0285ba9a9b6ed..ceda92abf14c1 100644 --- a/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch +++ b/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch @@ -1,7 +1,7 @@ From e93ff96907aa40b1441f6b79689415eb45f5e478 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 17:48:31 -0500 -Subject: [PATCH 7/9] BLD: Let python versions be user-selectable +Subject: [PATCH 07/10] BLD: Let python versions be user-selectable --- cmake/Utils.cmake | 34 ++++++++++++++++++---------------- @@ -110,5 +110,5 @@ index fb8110d..f247794 100644 \ No newline at end of file +endfunction(propagate_option) -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch b/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch index 71fba57b473de..34bc525611267 100644 --- a/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch +++ b/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch @@ -1,7 +1,7 @@ From 1914106b92eb9c71dcc0d7b7e2e52cb4abc12cfb Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 23:22:31 -0500 -Subject: [PATCH 8/9] BLD: Decouple nvimgcodec and dynlink_* targets +Subject: [PATCH 08/10] BLD: Decouple nvimgcodec and dynlink_* targets --- CMakeLists.txt | 17 ++++------------- @@ -64,5 +64,5 @@ index 83fdfe6..306ad46 100644 target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static dynlink_cuda) -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch b/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch index e67a27c951ebe..1be4b4bb55e6a 100644 --- a/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch +++ b/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch @@ -1,27 +1,28 @@ -From 7fd9348235602b98ca7738053df1af0a8b0e843a Mon Sep 17 00:00:00 2001 +From 8ef486ccb76873b65d81680fb71bc4b78f9a2274 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 23:23:20 -0500 -Subject: [PATCH 9/9] BLD: Link system nvimgcodec to python module +Subject: [PATCH 09/10] BLD: Link system nvimgcodec to python module --- - python/CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) + python/CMakeLists.txt | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 39f54c7..10c2f7e 100644 +index 39f54c7..f34b5c7 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt -@@ -16,6 +16,10 @@ +@@ -16,6 +16,11 @@ include(Utils) include(GNUInstallDirs) +if(NOT TARGET nvimgcodec) + find_package(nvimgcodec REQUIRED) ++ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) +endif() + if(UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden") endif() -- -2.34.1 +2.47.0 diff --git a/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch b/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch index 51eb67f3be71a..33e510c6603a0 100644 --- a/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch +++ b/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch @@ -1,174 +1,174 @@ -From 8438661800214ff4be8f33896a13b413d65d62ff Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Fri, 1 Nov 2024 15:27:28 -0500 -Subject: [PATCH 1/2] BLD: Find libclang for conda-forge - ---- - tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- - 1 file changed, 155 insertions(+), 145 deletions(-) - -diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py -index 0447d01..25ad4ef 100644 ---- a/tools/stub_generator/stub_codegen.py -+++ b/tools/stub_generator/stub_codegen.py -@@ -1,148 +1,158 @@ --# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --# SPDX-License-Identifier: Apache-2.0 --# --# Copyright 2020 The TensorFlow Runtime Authors --# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +From e5cfc92372ad75fd54c4d1ea3948130ac6fb079f Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Fri, 1 Nov 2024 15:27:28 -0500 +Subject: [PATCH 10/10] BLD: Find libclang for conda-forge + +--- + tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- + 1 file changed, 155 insertions(+), 145 deletions(-) + +diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py +index 0447d01..25ad4ef 100644 +--- a/tools/stub_generator/stub_codegen.py ++++ b/tools/stub_generator/stub_codegen.py +@@ -1,148 +1,158 @@ +-# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +-# SPDX-License-Identifier: Apache-2.0 +-# +-# Copyright 2020 The TensorFlow Runtime Authors +-# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2020 The TensorFlow Runtime Authors +# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - # --# Licensed under the Apache License, Version 2.0 (the "License"); --# you may not use this file except in compliance with the License. --# You may obtain a copy of the License at + # +-# Licensed under the Apache License, Version 2.0 (the "License"); +-# you may not use this file except in compliance with the License. +-# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at - # --# http://www.apache.org/licenses/LICENSE-2.0 + # +-# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 - # --# Unless required by applicable law or agreed to in writing, software --# distributed under the License is distributed on an "AS IS" BASIS, --# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --# See the License for the specific language governing permissions and --# limitations under the License. -- --# Lint as: python3 --"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" -- --from __future__ import absolute_import --from __future__ import print_function -- --import argparse --import re --import json --import clang.cindex --import os -- -- --def function_header(return_type, name, args): -- args_expr = [] -- for arg_type, arg_name in args: -- # handle arrays and function (or array of) pointer and reference to an array differently -- # as well -- # int[], int (*)(), int (*[])(), int (&)[5] -- match = re.search(r'\[|\)', arg_type) -- if match: -- pos = match.span()[0] -- print(arg_type[:pos]) -- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") -- else: -- args_expr.append(f"{arg_type} {arg_name}") -- -- arg_str = ", ".join(args_expr) -- ret = f"{return_type} {name}({arg_str})" -- return ret -- -- --def main(): -- parser = argparse.ArgumentParser( -- description='Generate dynamic loading stubs for CUDA and HIP APIs.') -- parser.add_argument('--unique_prefix', default="", type=str, -- help='Unique prefix for used in the stub') -- parser.add_argument( -- 'input', nargs='?', type=argparse.FileType('r')) -- parser.add_argument( -- 'output', nargs='?', type=argparse.FileType('w')) -- parser.add_argument( -- 'header', nargs='?', type=str, default=None) -- parser.add_argument( -- 'extra_args', nargs='*', type=str, default=None) -- args = parser.parse_args() -- -- -- if os.name == 'nt': -- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') -- config = json.load(args.input) -- -- function_impl = """ --{return_type} %s {1}NotFound({2}) {{ -- return {not_found_error}; --}} -- --{0} {{ -- using FuncPtr = {return_type} (*) ({2}); -- -- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? -- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : -- {1}NotFound; -- return func_ptr({3}); --}}\n""" % (config['calling_conv']) -- -- prolog = """ --void *{0}LoadSymbol(const char *name); -- --#define LOAD_SYMBOL_FUNC {0}##LoadSymbol -- --""" -- -- index = clang.cindex.Index.create() -- header = args.header -- extra_args = args.extra_args -- -- translation_unit = index.parse(header, args=extra_args) -- -- for diag in translation_unit.diagnostics: -- if diag.severity in [diag.Warning, diag.Fatal]: -- raise Exception(str(diag)) -- -- for extra_i in config['extra_include']: -- args.output.write('#include {}\n'.format(extra_i)) -- args.output.write(prolog.format(args.unique_prefix)) -- -- all_definition = set() -- all_declaration = set() -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.is_definition(): -- all_definition.add(cursor.spelling) -- -- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: -- all_declaration.add(cursor.spelling) -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: -- continue -- -- function_name = cursor.spelling -- -- # make sure that we deal only with functions with no definition -- if function_name not in config['functions'] or function_name in all_definition or \ -- function_name not in all_declaration: -- continue -- -- # make sure that we deal with every function only once -- all_declaration.remove(function_name) -- -- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] -- arg_names = [arg.spelling for arg in cursor.get_arguments()] -- -- return_type = config['functions'][function_name].get( -- 'return_type', config['return_type']) -- not_found_error = config['functions'][function_name].get( -- 'not_found_error', config['not_found_error']) -- -- header = function_header(return_type, function_name, zip(arg_types, arg_names)) -- -- implementation = function_impl.format(header, function_name, ', '.join(arg_types), -- ', '.join(arg_names), return_type=return_type, -- not_found_error=not_found_error) -- -- args.output.write(implementation) -- -- --if __name__ == '__main__': -- main() + # +-# Unless required by applicable law or agreed to in writing, software +-# distributed under the License is distributed on an "AS IS" BASIS, +-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-# See the License for the specific language governing permissions and +-# limitations under the License. +- +-# Lint as: python3 +-"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" +- +-from __future__ import absolute_import +-from __future__ import print_function +- +-import argparse +-import re +-import json +-import clang.cindex +-import os +- +- +-def function_header(return_type, name, args): +- args_expr = [] +- for arg_type, arg_name in args: +- # handle arrays and function (or array of) pointer and reference to an array differently +- # as well +- # int[], int (*)(), int (*[])(), int (&)[5] +- match = re.search(r'\[|\)', arg_type) +- if match: +- pos = match.span()[0] +- print(arg_type[:pos]) +- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") +- else: +- args_expr.append(f"{arg_type} {arg_name}") +- +- arg_str = ", ".join(args_expr) +- ret = f"{return_type} {name}({arg_str})" +- return ret +- +- +-def main(): +- parser = argparse.ArgumentParser( +- description='Generate dynamic loading stubs for CUDA and HIP APIs.') +- parser.add_argument('--unique_prefix', default="", type=str, +- help='Unique prefix for used in the stub') +- parser.add_argument( +- 'input', nargs='?', type=argparse.FileType('r')) +- parser.add_argument( +- 'output', nargs='?', type=argparse.FileType('w')) +- parser.add_argument( +- 'header', nargs='?', type=str, default=None) +- parser.add_argument( +- 'extra_args', nargs='*', type=str, default=None) +- args = parser.parse_args() +- +- +- if os.name == 'nt': +- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') +- config = json.load(args.input) +- +- function_impl = """ +-{return_type} %s {1}NotFound({2}) {{ +- return {not_found_error}; +-}} +- +-{0} {{ +- using FuncPtr = {return_type} (*) ({2}); +- +- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? +- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : +- {1}NotFound; +- return func_ptr({3}); +-}}\n""" % (config['calling_conv']) +- +- prolog = """ +-void *{0}LoadSymbol(const char *name); +- +-#define LOAD_SYMBOL_FUNC {0}##LoadSymbol +- +-""" +- +- index = clang.cindex.Index.create() +- header = args.header +- extra_args = args.extra_args +- +- translation_unit = index.parse(header, args=extra_args) +- +- for diag in translation_unit.diagnostics: +- if diag.severity in [diag.Warning, diag.Fatal]: +- raise Exception(str(diag)) +- +- for extra_i in config['extra_include']: +- args.output.write('#include {}\n'.format(extra_i)) +- args.output.write(prolog.format(args.unique_prefix)) +- +- all_definition = set() +- all_declaration = set() +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.is_definition(): +- all_definition.add(cursor.spelling) +- +- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: +- all_declaration.add(cursor.spelling) +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: +- continue +- +- function_name = cursor.spelling +- +- # make sure that we deal only with functions with no definition +- if function_name not in config['functions'] or function_name in all_definition or \ +- function_name not in all_declaration: +- continue +- +- # make sure that we deal with every function only once +- all_declaration.remove(function_name) +- +- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] +- arg_names = [arg.spelling for arg in cursor.get_arguments()] +- +- return_type = config['functions'][function_name].get( +- 'return_type', config['return_type']) +- not_found_error = config['functions'][function_name].get( +- 'not_found_error', config['not_found_error']) +- +- header = function_header(return_type, function_name, zip(arg_types, arg_names)) +- +- implementation = function_impl.format(header, function_name, ', '.join(arg_types), +- ', '.join(arg_names), return_type=return_type, +- not_found_error=not_found_error) +- +- args.output.write(implementation) +- +- +-if __name__ == '__main__': +- main() +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -315,6 +315,6 @@ index 0447d01..25ad4ef 100644 + +if __name__ == '__main__': + main() --- -2.46.2.windows.1 - +-- +2.47.0 + diff --git a/recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch b/recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch deleted file mode 100644 index 6e295c649e21e..0000000000000 --- a/recipes/libnvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 36664a005abdb0024b47dce49fd2c38788179077 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Fri, 1 Nov 2024 15:28:37 -0500 -Subject: [PATCH 2/2] BLD: Fix import of nvimgcodec as external target for - Windows - ---- - python/CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 10c2f7e..f34b5c7 100644 ---- a/python/CMakeLists.txt -+++ b/python/CMakeLists.txt -@@ -18,6 +18,7 @@ include(GNUInstallDirs) - - if(NOT TARGET nvimgcodec) - find_package(nvimgcodec REQUIRED) -+ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) - endif() - - if(UNIX) --- -2.46.2.windows.1 - diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index dc9ecefd3ec8c..2f63915c0bc5d 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -32,7 +32,6 @@ source: - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch - patches/0010-BLD-Find-libclang-for-conda-forge.patch - - patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch build: number: 0 diff --git a/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch b/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch index 51ad9d47a45f5..da8ffef8a9e1d 100644 --- a/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch +++ b/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch @@ -1,7 +1,7 @@ From db52313b58080519bb3be0422599564fd01d8db2 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 10 Sep 2024 17:46:15 -0500 -Subject: [PATCH 1/9] BUG: Add missing headers from standard library +Subject: [PATCH 01/10] BUG: Add missing headers from standard library --- extensions/libjpeg_turbo/jpeg_handle.h | 9 +++++---- @@ -83,5 +83,5 @@ index aff554c..d996317 100644 #include #include -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch b/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch index e4552d516e1fe..2bd2fe62be85a 100644 --- a/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch +++ b/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch @@ -1,7 +1,8 @@ From 04c6631102716182a5df671a57bd0a944dfc195e Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 10 Sep 2024 18:12:59 -0500 -Subject: [PATCH 2/9] BLD: pybind11 dlpack only needed when building for python +Subject: [PATCH 02/10] BLD: pybind11 dlpack only needed when building for + python Also allow system libraries for these deps --- @@ -45,5 +46,5 @@ index 50685ce..88ff95d 100644 +endif(BUILD_PYTHON) + -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch b/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch index 01173f262a065..edb835674f2f4 100644 --- a/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch +++ b/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch @@ -1,7 +1,7 @@ From a3327de7c8b08ac2224efa6193f2918f411152f8 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 17 Sep 2024 11:09:47 -0500 -Subject: [PATCH 3/9] DOC: Add Fatal Error if extensions are built without +Subject: [PATCH 03/10] DOC: Add Fatal Error if extensions are built without library --- @@ -27,5 +27,5 @@ index 7e19bdf..5e4162b 100644 option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch b/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch index bfad729a4adca..b505cd1d11df0 100644 --- a/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch +++ b/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch @@ -1,7 +1,7 @@ From d062794e03a8e167718b7ecd05776216cd338a75 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 13:09:10 -0500 -Subject: [PATCH 4/9] BLD: Let end user set libdir using CMake variables +Subject: [PATCH 04/10] BLD: Let end user set libdir using CMake variables --- CMakeLists.txt | 13 +++++++++++++ @@ -236,5 +236,5 @@ index 5d8aeb0..940e2a6 100644 \ No newline at end of file +# } -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch b/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch index ab352457154b3..6dd936cf4061e 100644 --- a/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch +++ b/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch @@ -1,7 +1,7 @@ From 561f4ca740edc3ba4605b12202edea4e0c7d023d Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 13:37:13 -0500 -Subject: [PATCH 5/9] BLD: Make moving libraries to python directory optional +Subject: [PATCH 05/10] BLD: Make moving libraries to python directory optional --- CMakeLists.txt | 2 +- @@ -128,5 +128,5 @@ index 0837211..39f54c7 100644 if(BUILD_WHEEL) string(REGEX REPLACE "-" "_" NVIMGCODEC_FLAVOR_UNDERSCORE "${NVIMGCODEC_FLAVOR_MINUS}") -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch b/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch index f6691431e37f7..c40b6a47d24c4 100644 --- a/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch +++ b/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch @@ -1,7 +1,7 @@ From 6732446c6b8bdd8d631d96b4f6a7d1763e284097 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 14:50:32 -0500 -Subject: [PATCH 6/9] BLD: Use consistent install directory for cmake configs +Subject: [PATCH 06/10] BLD: Use consistent install directory for cmake configs --- src/CMakeLists.txt | 6 +++--- @@ -39,5 +39,5 @@ index 940e2a6..83fdfe6 100644 ) -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch b/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch index 0285ba9a9b6ed..ceda92abf14c1 100644 --- a/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch +++ b/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch @@ -1,7 +1,7 @@ From e93ff96907aa40b1441f6b79689415eb45f5e478 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 17:48:31 -0500 -Subject: [PATCH 7/9] BLD: Let python versions be user-selectable +Subject: [PATCH 07/10] BLD: Let python versions be user-selectable --- cmake/Utils.cmake | 34 ++++++++++++++++++---------------- @@ -110,5 +110,5 @@ index fb8110d..f247794 100644 \ No newline at end of file +endfunction(propagate_option) -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch b/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch index 71fba57b473de..34bc525611267 100644 --- a/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch +++ b/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch @@ -1,7 +1,7 @@ From 1914106b92eb9c71dcc0d7b7e2e52cb4abc12cfb Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 23:22:31 -0500 -Subject: [PATCH 8/9] BLD: Decouple nvimgcodec and dynlink_* targets +Subject: [PATCH 08/10] BLD: Decouple nvimgcodec and dynlink_* targets --- CMakeLists.txt | 17 ++++------------- @@ -64,5 +64,5 @@ index 83fdfe6..306ad46 100644 target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static dynlink_cuda) -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch b/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch index e67a27c951ebe..1be4b4bb55e6a 100644 --- a/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch +++ b/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch @@ -1,27 +1,28 @@ -From 7fd9348235602b98ca7738053df1af0a8b0e843a Mon Sep 17 00:00:00 2001 +From 8ef486ccb76873b65d81680fb71bc4b78f9a2274 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 31 Oct 2024 23:23:20 -0500 -Subject: [PATCH 9/9] BLD: Link system nvimgcodec to python module +Subject: [PATCH 09/10] BLD: Link system nvimgcodec to python module --- - python/CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) + python/CMakeLists.txt | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 39f54c7..10c2f7e 100644 +index 39f54c7..f34b5c7 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt -@@ -16,6 +16,10 @@ +@@ -16,6 +16,11 @@ include(Utils) include(GNUInstallDirs) +if(NOT TARGET nvimgcodec) + find_package(nvimgcodec REQUIRED) ++ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) +endif() + if(UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden") endif() -- -2.34.1 +2.47.0 diff --git a/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch b/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch index 51eb67f3be71a..33e510c6603a0 100644 --- a/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch +++ b/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch @@ -1,174 +1,174 @@ -From 8438661800214ff4be8f33896a13b413d65d62ff Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Fri, 1 Nov 2024 15:27:28 -0500 -Subject: [PATCH 1/2] BLD: Find libclang for conda-forge - ---- - tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- - 1 file changed, 155 insertions(+), 145 deletions(-) - -diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py -index 0447d01..25ad4ef 100644 ---- a/tools/stub_generator/stub_codegen.py -+++ b/tools/stub_generator/stub_codegen.py -@@ -1,148 +1,158 @@ --# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --# SPDX-License-Identifier: Apache-2.0 --# --# Copyright 2020 The TensorFlow Runtime Authors --# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +From e5cfc92372ad75fd54c4d1ea3948130ac6fb079f Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Fri, 1 Nov 2024 15:27:28 -0500 +Subject: [PATCH 10/10] BLD: Find libclang for conda-forge + +--- + tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- + 1 file changed, 155 insertions(+), 145 deletions(-) + +diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py +index 0447d01..25ad4ef 100644 +--- a/tools/stub_generator/stub_codegen.py ++++ b/tools/stub_generator/stub_codegen.py +@@ -1,148 +1,158 @@ +-# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +-# SPDX-License-Identifier: Apache-2.0 +-# +-# Copyright 2020 The TensorFlow Runtime Authors +-# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2020 The TensorFlow Runtime Authors +# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - # --# Licensed under the Apache License, Version 2.0 (the "License"); --# you may not use this file except in compliance with the License. --# You may obtain a copy of the License at + # +-# Licensed under the Apache License, Version 2.0 (the "License"); +-# you may not use this file except in compliance with the License. +-# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at - # --# http://www.apache.org/licenses/LICENSE-2.0 + # +-# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 - # --# Unless required by applicable law or agreed to in writing, software --# distributed under the License is distributed on an "AS IS" BASIS, --# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --# See the License for the specific language governing permissions and --# limitations under the License. -- --# Lint as: python3 --"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" -- --from __future__ import absolute_import --from __future__ import print_function -- --import argparse --import re --import json --import clang.cindex --import os -- -- --def function_header(return_type, name, args): -- args_expr = [] -- for arg_type, arg_name in args: -- # handle arrays and function (or array of) pointer and reference to an array differently -- # as well -- # int[], int (*)(), int (*[])(), int (&)[5] -- match = re.search(r'\[|\)', arg_type) -- if match: -- pos = match.span()[0] -- print(arg_type[:pos]) -- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") -- else: -- args_expr.append(f"{arg_type} {arg_name}") -- -- arg_str = ", ".join(args_expr) -- ret = f"{return_type} {name}({arg_str})" -- return ret -- -- --def main(): -- parser = argparse.ArgumentParser( -- description='Generate dynamic loading stubs for CUDA and HIP APIs.') -- parser.add_argument('--unique_prefix', default="", type=str, -- help='Unique prefix for used in the stub') -- parser.add_argument( -- 'input', nargs='?', type=argparse.FileType('r')) -- parser.add_argument( -- 'output', nargs='?', type=argparse.FileType('w')) -- parser.add_argument( -- 'header', nargs='?', type=str, default=None) -- parser.add_argument( -- 'extra_args', nargs='*', type=str, default=None) -- args = parser.parse_args() -- -- -- if os.name == 'nt': -- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') -- config = json.load(args.input) -- -- function_impl = """ --{return_type} %s {1}NotFound({2}) {{ -- return {not_found_error}; --}} -- --{0} {{ -- using FuncPtr = {return_type} (*) ({2}); -- -- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? -- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : -- {1}NotFound; -- return func_ptr({3}); --}}\n""" % (config['calling_conv']) -- -- prolog = """ --void *{0}LoadSymbol(const char *name); -- --#define LOAD_SYMBOL_FUNC {0}##LoadSymbol -- --""" -- -- index = clang.cindex.Index.create() -- header = args.header -- extra_args = args.extra_args -- -- translation_unit = index.parse(header, args=extra_args) -- -- for diag in translation_unit.diagnostics: -- if diag.severity in [diag.Warning, diag.Fatal]: -- raise Exception(str(diag)) -- -- for extra_i in config['extra_include']: -- args.output.write('#include {}\n'.format(extra_i)) -- args.output.write(prolog.format(args.unique_prefix)) -- -- all_definition = set() -- all_declaration = set() -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.is_definition(): -- all_definition.add(cursor.spelling) -- -- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: -- all_declaration.add(cursor.spelling) -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: -- continue -- -- function_name = cursor.spelling -- -- # make sure that we deal only with functions with no definition -- if function_name not in config['functions'] or function_name in all_definition or \ -- function_name not in all_declaration: -- continue -- -- # make sure that we deal with every function only once -- all_declaration.remove(function_name) -- -- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] -- arg_names = [arg.spelling for arg in cursor.get_arguments()] -- -- return_type = config['functions'][function_name].get( -- 'return_type', config['return_type']) -- not_found_error = config['functions'][function_name].get( -- 'not_found_error', config['not_found_error']) -- -- header = function_header(return_type, function_name, zip(arg_types, arg_names)) -- -- implementation = function_impl.format(header, function_name, ', '.join(arg_types), -- ', '.join(arg_names), return_type=return_type, -- not_found_error=not_found_error) -- -- args.output.write(implementation) -- -- --if __name__ == '__main__': -- main() + # +-# Unless required by applicable law or agreed to in writing, software +-# distributed under the License is distributed on an "AS IS" BASIS, +-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-# See the License for the specific language governing permissions and +-# limitations under the License. +- +-# Lint as: python3 +-"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" +- +-from __future__ import absolute_import +-from __future__ import print_function +- +-import argparse +-import re +-import json +-import clang.cindex +-import os +- +- +-def function_header(return_type, name, args): +- args_expr = [] +- for arg_type, arg_name in args: +- # handle arrays and function (or array of) pointer and reference to an array differently +- # as well +- # int[], int (*)(), int (*[])(), int (&)[5] +- match = re.search(r'\[|\)', arg_type) +- if match: +- pos = match.span()[0] +- print(arg_type[:pos]) +- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") +- else: +- args_expr.append(f"{arg_type} {arg_name}") +- +- arg_str = ", ".join(args_expr) +- ret = f"{return_type} {name}({arg_str})" +- return ret +- +- +-def main(): +- parser = argparse.ArgumentParser( +- description='Generate dynamic loading stubs for CUDA and HIP APIs.') +- parser.add_argument('--unique_prefix', default="", type=str, +- help='Unique prefix for used in the stub') +- parser.add_argument( +- 'input', nargs='?', type=argparse.FileType('r')) +- parser.add_argument( +- 'output', nargs='?', type=argparse.FileType('w')) +- parser.add_argument( +- 'header', nargs='?', type=str, default=None) +- parser.add_argument( +- 'extra_args', nargs='*', type=str, default=None) +- args = parser.parse_args() +- +- +- if os.name == 'nt': +- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') +- config = json.load(args.input) +- +- function_impl = """ +-{return_type} %s {1}NotFound({2}) {{ +- return {not_found_error}; +-}} +- +-{0} {{ +- using FuncPtr = {return_type} (*) ({2}); +- +- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? +- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : +- {1}NotFound; +- return func_ptr({3}); +-}}\n""" % (config['calling_conv']) +- +- prolog = """ +-void *{0}LoadSymbol(const char *name); +- +-#define LOAD_SYMBOL_FUNC {0}##LoadSymbol +- +-""" +- +- index = clang.cindex.Index.create() +- header = args.header +- extra_args = args.extra_args +- +- translation_unit = index.parse(header, args=extra_args) +- +- for diag in translation_unit.diagnostics: +- if diag.severity in [diag.Warning, diag.Fatal]: +- raise Exception(str(diag)) +- +- for extra_i in config['extra_include']: +- args.output.write('#include {}\n'.format(extra_i)) +- args.output.write(prolog.format(args.unique_prefix)) +- +- all_definition = set() +- all_declaration = set() +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.is_definition(): +- all_definition.add(cursor.spelling) +- +- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: +- all_declaration.add(cursor.spelling) +- +- for cursor in translation_unit.cursor.get_children(): +- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: +- continue +- +- function_name = cursor.spelling +- +- # make sure that we deal only with functions with no definition +- if function_name not in config['functions'] or function_name in all_definition or \ +- function_name not in all_declaration: +- continue +- +- # make sure that we deal with every function only once +- all_declaration.remove(function_name) +- +- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] +- arg_names = [arg.spelling for arg in cursor.get_arguments()] +- +- return_type = config['functions'][function_name].get( +- 'return_type', config['return_type']) +- not_found_error = config['functions'][function_name].get( +- 'not_found_error', config['not_found_error']) +- +- header = function_header(return_type, function_name, zip(arg_types, arg_names)) +- +- implementation = function_impl.format(header, function_name, ', '.join(arg_types), +- ', '.join(arg_names), return_type=return_type, +- not_found_error=not_found_error) +- +- args.output.write(implementation) +- +- +-if __name__ == '__main__': +- main() +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -315,6 +315,6 @@ index 0447d01..25ad4ef 100644 + +if __name__ == '__main__': + main() --- -2.46.2.windows.1 - +-- +2.47.0 + diff --git a/recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch b/recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch deleted file mode 100644 index 6e295c649e21e..0000000000000 --- a/recipes/nvimgcodec/patches/0011-BLD-Fix-import-of-nvimgcodec-as-external-target-for-.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 36664a005abdb0024b47dce49fd2c38788179077 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Fri, 1 Nov 2024 15:28:37 -0500 -Subject: [PATCH 2/2] BLD: Fix import of nvimgcodec as external target for - Windows - ---- - python/CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 10c2f7e..f34b5c7 100644 ---- a/python/CMakeLists.txt -+++ b/python/CMakeLists.txt -@@ -18,6 +18,7 @@ include(GNUInstallDirs) - - if(NOT TARGET nvimgcodec) - find_package(nvimgcodec REQUIRED) -+ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) - endif() - - if(UNIX) --- -2.46.2.windows.1 - From 4b572504b6a63869472291fe70d51e4c7ede1264 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Fri, 6 Dec 2024 09:43:03 -0600 Subject: [PATCH 07/14] BLD: Add error checks to Windows build scripts --- recipes/libnvimgcodec/bld.bat | 6 ++++++ recipes/nvimgcodec/bld.bat | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/recipes/libnvimgcodec/bld.bat b/recipes/libnvimgcodec/bld.bat index 6f926bba08541..2415616201440 100644 --- a/recipes/libnvimgcodec/bld.bat +++ b/recipes/libnvimgcodec/bld.bat @@ -8,6 +8,8 @@ mkdir build cd build +if errorlevel 1 exit 1 + set NVIMG_BUILD_ARGS= ^ -DBUILD_DOCS:BOOL=OFF ^ -DBUILD_SAMPLES:BOOL=OFF ^ @@ -41,8 +43,12 @@ cmake %CMAKE_ARGS% -GNinja -DCMAKE_INSTALL_PREFIX="%PREFIX%/Library" ^ %NVIMG_BUILD_ARGS% %NVIMG_LIBRARY_ARGS% %NVIMG_EXT_ARGS% ^ %NVIMG_PYTHON_ARGS% %SRC_DIR% +if errorlevel 1 exit 1 + cmake --build . +if errorlevel 1 exit 1 + cmake --install . endlocal diff --git a/recipes/nvimgcodec/bld.bat b/recipes/nvimgcodec/bld.bat index 2d307a861544a..4110b79f844cc 100644 --- a/recipes/nvimgcodec/bld.bat +++ b/recipes/nvimgcodec/bld.bat @@ -8,6 +8,8 @@ mkdir build cd build +if errorlevel 1 exit 1 + set NVIMG_BUILD_ARGS= ^ -DBUILD_DOCS:BOOL=OFF ^ -DBUILD_SAMPLES:BOOL=OFF ^ @@ -42,13 +44,23 @@ cmake %CMAKE_ARGS% -GNinja -DCMAKE_INSTALL_PREFIX="%PREFIX%/Library" ^ %NVIMG_BUILD_ARGS% %NVIMG_LIBRARY_ARGS% %NVIMG_EXT_ARGS% ^ %NVIMG_PYTHON_ARGS% %SRC_DIR% +if errorlevel 1 exit 1 + cmake --build . +if errorlevel 1 exit 1 + cmake --install . +if errorlevel 1 exit 1 + @REM copy in CMakeLists doesn't work for unknown reason move .\python\nvimgcodec*.pyd .\python\nvidia\nvimgcodec\ +if errorlevel 1 exit 1 + %PYTHON% -m pip install .\python --no-deps --no-build-isolation -v +if errorlevel 1 exit 1 + endlocal From f92117c1745336cd2fd4767b84982c32b91e3fc5 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 3 Feb 2025 13:13:34 -0600 Subject: [PATCH 08/14] BLD: Fixup build for Linux --- .ci_support/linux64_cuda120.yaml | 2 +- recipes/libnvimgcodec/build.sh | 25 ++++++++++----- recipes/libnvimgcodec/meta.yaml | 28 ++++++----------- .../patches/001-move-config.patch | 31 +++++++++++++++++++ 4 files changed, 59 insertions(+), 27 deletions(-) create mode 100644 recipes/libnvimgcodec/patches/001-move-config.patch diff --git a/.ci_support/linux64_cuda120.yaml b/.ci_support/linux64_cuda120.yaml index be7982d0d4fda..f67e819d2175e 100644 --- a/.ci_support/linux64_cuda120.yaml +++ b/.ci_support/linux64_cuda120.yaml @@ -29,6 +29,6 @@ docker_image: cuda_compiler: - cuda-nvcc cuda_compiler_version: -- 12.0 +- 12.6 cuda_compiler_version_min: - 11.8 diff --git a/recipes/libnvimgcodec/build.sh b/recipes/libnvimgcodec/build.sh index c14783d598612..5e03210c97f38 100644 --- a/recipes/libnvimgcodec/build.sh +++ b/recipes/libnvimgcodec/build.sh @@ -18,28 +18,36 @@ set -ex mkdir build cd build +export CUDAARCHS="50" + nvimg_build_args=( -DBUILD_DOCS:BOOL=OFF -DBUILD_SAMPLES:BOOL=OFF -DBUILD_TEST:BOOL=OFF + -DCUDA_TARGET_ARCHS=${CUDAARCHS} # Library args -DBUILD_LIBRARY:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF - -DWITH_DYNAMIC_NVJPEG:BOOL=ON - -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF +# "DYNAMIC_LINK" means using dlopen, but we want to link to shared libraries? + -DWITH_DYNAMIC_LINK:BOOL=ON # Extension args -DBUILD_EXTENSIONS:BOOL=ON - -DBUILD_NVJPEG_EXT:BOOL=ON - # nvjpek2k is not yet on conda-forge - -DBUILD_NVJPEG2K_EXT:BOOL=OFF - -DBUILD_NVBMP_EXT:BOOL=ON - -DBUILD_NVPNM_EXT:BOOL=ON -DBUILD_LIBJPEG_TURBO_EXT:BOOL=ON -DBUILD_LIBTIFF_EXT:BOOL=ON + -DBUILD_NVBMP_EXT:BOOL=ON + -DBUILD_NVJPEG_EXT:BOOL=ON + -DBUILD_NVJPEG2K_EXT:BOOL=ON + -DBUILD_NVPNM_EXT:BOOL=ON + -DBUILD_NVTIFF_EXT:BOOL=OFF -DBUILD_OPENCV_EXT:BOOL=ON # Python args -DBUILD_PYTHON:BOOL=OFF + -DPYTHON_VERSIONS="${PY_VER}" + -DBUILD_WHEEL:BOOL=OFF + -DNVIMGCODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF + -DNVIMGCODEC_BUILD_PYBIND:BOOL=OFF + -DNVIMGCODEC_BUILD_DLPACK:BOOL=OFF ) cmake ${CMAKE_ARGS} -GNinja "${nvimg_build_args[@]}" ${SRC_DIR} @@ -47,3 +55,6 @@ cmake ${CMAKE_ARGS} -GNinja "${nvimg_build_args[@]}" ${SRC_DIR} cmake --build . cmake --install . --strip + +rm $PREFIX/LICENSE.txt +rm $PREFIX/Acknowledgements.txt diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index bdcd2825f9f0e..557dc7b616ac7 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -{% set version = '0.3.0' %} +{% set version = '0.5.0' %} {% set somajor = version.split('.')[0] %} {% set cuda_major = environ.get("cuda_compiler_version", "11.8").split(".")[0]|int %} @@ -23,24 +23,12 @@ source: url: https://github.com/NVIDIA/nvImageCodec/archive/refs/tags/v{{ version }}.tar.gz sha256: 4bba949d6cf4e88fcd6b2d86bff960c9ed68eb25b6c4dde3b7772615480ab9fb patches: - - patches/0001-BUG-Add-missing-headers-from-standard-library.patch - - patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch - - patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch - - patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch - - patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch - - patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch - - patches/0007-BLD-Let-python-versions-be-user-selectable.patch - - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch - - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch - - patches/0010-BLD-Find-libclang-for-conda-forge.patch - + - patches/001-move-config.patch build: number: 0 - skip: true # [not (linux or win)] - skip: true # [cuda_compiler_version in (None, 'None')] + skip: true # [cuda_compiler_version in (undefined, 'None')] # Debug skips below # skip: true # [py != 312] - # skip: true # [cuda_compiler_version != '12.0'] requirements: build: - {{ compiler('c') }} @@ -57,6 +45,8 @@ requirements: - libjpeg-turbo {% if cuda_major == 12 %} - libnvjpeg-dev + - libnvjpeg2k-dev + - libnvtiff-dev {% endif %} - libopencv - libtiff @@ -110,15 +100,15 @@ outputs: - cuda-cudart-dev # [build_platform == target_platform] {% endif %} commands: - - cmake ${CMAKE_ARGS} -GNinja test # [build_platform == target_platform] - - cmake --build . # [build_platform == target_platform] - test -f ${PREFIX}/include/nvimgcodec.h # [linux] - if not exist %LIBRARY_INC%\\nvimgcodec.h exit 1 # [win] - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ somajor }} # [linux] - - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }}.0 # [linux] + - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }} # [linux] - if not exist %LIBRARY_LIB%\\nvimgcodec.lib exit 1 # [win] - test -f ${PREFIX}/etc/ld.so.conf.d/nvimgcodec.conf # [unix] - test -f ${PREFIX}/lib/cmake/nvimgcodec/nvimgcodecConfig.cmake # [unix] + - cmake ${CMAKE_ARGS} -GNinja test # [build_platform == target_platform] + - cmake --build . # [build_platform == target_platform] # - test ! -f ${PREFIX}/lib/libnvimgcodec_static.a # [unix] - name: libnvimgcodec{{ somajor }} @@ -147,7 +137,7 @@ outputs: test: commands: - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ somajor }} # [linux] - - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }}.0 # [linux] + - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ version }} # [linux] - if not exist %LIBRARY_BIN%\\nvimgcodec_{{ somajor }}.dll exit 1 # [win] about: diff --git a/recipes/libnvimgcodec/patches/001-move-config.patch b/recipes/libnvimgcodec/patches/001-move-config.patch new file mode 100644 index 0000000000000..3c3c8a216f932 --- /dev/null +++ b/recipes/libnvimgcodec/patches/001-move-config.patch @@ -0,0 +1,31 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9558804..3607d6b 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -121,7 +121,7 @@ endif() + # * /cmake/ + # * /lib*/ + # * /include/ +-set(config_install_dir "${CMAKE_INSTALL_PREFIX}/cmake") ++set(config_install_dir "${CMAKE_INSTALL_PREFIX}/lib/cmake") + + set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") + +@@ -173,7 +173,7 @@ install( + # * /cmake/nvimgcodec/nvimgcodecConfigVersion.cmake + install( + FILES "${project_config}" "${version_config}" +- DESTINATION "cmake/nvimgcodec" ++ DESTINATION "${config_install_dir}/nvimgcodec" + COMPONENT lib + ) + +@@ -182,7 +182,7 @@ install( + install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" +- DESTINATION "cmake/nvimgcodec" ++ DESTINATION "${config_install_dir}/nvimgcodec" + COMPONENT lib + ) + From e624fd0c2b4b7f7fc82da51f345cdfb60f9bdc2e Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 3 Feb 2025 14:28:18 -0600 Subject: [PATCH 09/14] BLD: Update python recipe --- recipes/libnvimgcodec/meta.yaml | 3 --- recipes/nvimgcodec/build.sh | 22 ++++++++++--------- recipes/nvimgcodec/meta.yaml | 15 ++++--------- .../patches/0001-missing-static-target.patch | 12 ++++++++++ 4 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 recipes/nvimgcodec/patches/0001-missing-static-target.patch diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index 557dc7b616ac7..908d678cfc1b6 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -112,9 +112,6 @@ outputs: # - test ! -f ${PREFIX}/lib/libnvimgcodec_static.a # [unix] - name: libnvimgcodec{{ somajor }} - build: - run_exports: - - {{ pin_subpackage('libnvimgcodec' ~ somajor) }} files: - lib/libnvimgcodec.so.* # [linux] - Library/bin/nvimgcodec_{{ somajor }}.dll # [win] diff --git a/recipes/nvimgcodec/build.sh b/recipes/nvimgcodec/build.sh index 53b9285a1a1a8..01a23f527638e 100644 --- a/recipes/nvimgcodec/build.sh +++ b/recipes/nvimgcodec/build.sh @@ -15,6 +15,8 @@ set -ex +export CUDAARCHS="50" + mkdir build cd build @@ -22,22 +24,22 @@ nvimg_build_args=( -DBUILD_DOCS:BOOL=OFF -DBUILD_SAMPLES:BOOL=OFF -DBUILD_TEST:BOOL=OFF + -DCUDA_TARGET_ARCHS=${CUDAARCHS} # Library args -DBUILD_LIBRARY:BOOL=OFF - -DWITH_DYNAMIC_NVJPEG:BOOL=ON - -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF + -DBUILD_SHARED_LIBS:BOOL=ON + -DBUILD_STATIC_LIBS:BOOL=OFF +# "DYNAMIC_LINK" means using dlopen, but we want to link to shared libraries? + -DWITH_DYNAMIC_LINK:BOOL=OFF # Extension args -DBUILD_EXTENSIONS:BOOL=OFF - -DBUILD_NVJPEG_EXT:BOOL=OFF - # nvjpek2k is not yet on conda-forge - -DBUILD_NVJPEG2K_EXT:BOOL=OFF # Python args -DBUILD_PYTHON:BOOL=ON + -DPYTHON_VERSIONS="${PY_VER}" -DBUILD_WHEEL:BOOL=OFF - -DNVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF - -DNVIMG_CODEC_PYTHON_VERSIONS=${PY_VER} - -DNVIMG_CODEC_USE_SYSTEM_DLPACK:BOOL=ON - -DNVIMG_CODEC_USE_SYSTEM_PYBIND:BOOL=ON + -DNVIMGCODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF + -DNVIMGCODEC_BUILD_PYBIND11:BOOL=OFF + -DNVIMGCODEC_BUILD_DLPACK:BOOL=OFF ) cmake ${CMAKE_ARGS} -GNinja "${nvimg_build_args[@]}" ${SRC_DIR} @@ -48,4 +50,4 @@ cmake --install . --strip $PYTHON -m pip install --no-deps --no-build-isolation -v $SRC_DIR/build/python -ln -s $PREFIX/extensions $SP_DIR/nvidia/nvimgcodec/extensions +# ln -s $PREFIX/extensions $SP_DIR/nvidia/nvimgcodec/extensions diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index 2f63915c0bc5d..1e49dcccb80b1 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -{% set version = '0.3.0' %} +{% set version = '0.5.0' %} {% set cuda_major = environ.get("cuda_compiler_version", "11.8").split(".")[0]|int %} package: @@ -22,16 +22,7 @@ source: url: https://github.com/NVIDIA/nvImageCodec/archive/refs/tags/v{{ version }}.tar.gz sha256: 4bba949d6cf4e88fcd6b2d86bff960c9ed68eb25b6c4dde3b7772615480ab9fb patches: - - patches/0001-BUG-Add-missing-headers-from-standard-library.patch - - patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch - - patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch - - patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch - - patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch - - patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch - - patches/0007-BLD-Let-python-versions-be-user-selectable.patch - - patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch - - patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch - - patches/0010-BLD-Find-libclang-for-conda-forge.patch + - patches/0001-missing-static-target.patch build: number: 0 @@ -54,6 +45,7 @@ requirements: host: - cuda-version {{ cuda_compiler_version }} - dlpack + - libboost-headers - libnvimgcodec-dev {{ version }} {% if cuda_major == 12 %} - libnvjpeg-dev @@ -61,6 +53,7 @@ requirements: - pybind11 - python - setuptools + - zlib run: - python diff --git a/recipes/nvimgcodec/patches/0001-missing-static-target.patch b/recipes/nvimgcodec/patches/0001-missing-static-target.patch new file mode 100644 index 0000000000000..4c8e0fd8e4db7 --- /dev/null +++ b/recipes/nvimgcodec/patches/0001-missing-static-target.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b52399f..afd4f2e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -336,6 +336,7 @@ if(BUILD_SAMPLES) + endif() + + if(BUILD_PYTHON) ++ add_subdirectory(src/imgproc) + add_subdirectory(python) + endif() + From 97dacddfee179a8f2af4b44fdb285ea250ea9807 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 3 Feb 2025 17:33:03 -0600 Subject: [PATCH 10/14] BLD: Fixup libnvimgcodec build on Windows --- recipes/libnvimgcodec/bld.bat | 29 ++++++++++++++++++----------- recipes/libnvimgcodec/build.sh | 2 +- recipes/libnvimgcodec/meta.yaml | 22 ++++++++++++---------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/recipes/libnvimgcodec/bld.bat b/recipes/libnvimgcodec/bld.bat index 2415616201440..22ba1b901a844 100644 --- a/recipes/libnvimgcodec/bld.bat +++ b/recipes/libnvimgcodec/bld.bat @@ -10,34 +10,38 @@ cd build if errorlevel 1 exit 1 +set CUDAARCHS="50" + set NVIMG_BUILD_ARGS= ^ -DBUILD_DOCS:BOOL=OFF ^ -DBUILD_SAMPLES:BOOL=OFF ^ - -DBUILD_TEST:BOOL=OFF + -DBUILD_TEST:BOOL=OFF ^ + -DCUDA_TARGET_ARCHS=%CUDAARCHS% set NVIMG_LIBRARY_ARGS= ^ -DBUILD_LIBRARY:BOOL=ON ^ -DBUILD_SHARED_LIBS:BOOL=ON ^ -DBUILD_STATIC_LIBS:BOOL=OFF ^ - -DWITH_DYNAMIC_NVJPEG:BOOL=ON ^ - -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF + -DWITH_DYNAMIC_LINK:BOOL=OFF set NVIMG_EXT_ARGS= ^ -DBUILD_EXTENSIONS:BOOL=ON ^ - -DBUILD_NVJPEG_EXT:BOOL=ON ^ - -DBUILD_NVJPEG2K_EXT:BOOL=OFF ^ - -DBUILD_NVBMP_EXT:BOOL=ON ^ - -DBUILD_NVPNM_EXT:BOOL=ON ^ -DBUILD_LIBJPEG_TURBO_EXT:BOOL=ON ^ -DBUILD_LIBTIFF_EXT:BOOL=ON ^ + -DBUILD_NVBMP_EXT:BOOL=ON ^ + -DBUILD_NVJPEG_EXT:BOOL=ON ^ + -DBUILD_NVJPEG2K_EXT:BOOL=ON ^ + -DBUILD_NVPNM_EXT:BOOL=ON ^ + -DBUILD_NVTIFF_EXT:BOOL=OFF ^ -DBUILD_OPENCV_EXT:BOOL=ON set NVIMG_PYTHON_ARGS= ^ -DBUILD_PYTHON:BOOL=OFF ^ - -DNVIMG_CODEC_PYTHON_VERSIONS=%PY_VER% ^ - -DBUILD_WHEEL:BOOL=OFF -DNVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF ^ - -DNVIMG_CODEC_USE_SYSTEM_PYBIND:BOOL=OFF ^ - -DNVIMG_CODEC_USE_SYSTEM_DLPACK:BOOL=OFF + -DPYTHON_VERSIONS=%PY_VER% ^ + -DBUILD_WHEEL:BOOL=OFF ^ + -DNVIMGCODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF ^ + -DNVIMGCODEC_BUILD_PYBIND11:BOOL=OFF ^ + -DNVIMGCODEC_BUILD_DLPACK:BOOL=OFF cmake %CMAKE_ARGS% -GNinja -DCMAKE_INSTALL_PREFIX="%PREFIX%/Library" ^ %NVIMG_BUILD_ARGS% %NVIMG_LIBRARY_ARGS% %NVIMG_EXT_ARGS% ^ @@ -51,4 +55,7 @@ if errorlevel 1 exit 1 cmake --install . +del %PREFIX%/Library/LICENSE.txt +del %PREFIX%/Library/Acknowledgements.txt + endlocal diff --git a/recipes/libnvimgcodec/build.sh b/recipes/libnvimgcodec/build.sh index 5e03210c97f38..d4e387eb3c1c9 100644 --- a/recipes/libnvimgcodec/build.sh +++ b/recipes/libnvimgcodec/build.sh @@ -46,7 +46,7 @@ nvimg_build_args=( -DPYTHON_VERSIONS="${PY_VER}" -DBUILD_WHEEL:BOOL=OFF -DNVIMGCODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF - -DNVIMGCODEC_BUILD_PYBIND:BOOL=OFF + -DNVIMGCODEC_BUILD_PYBIND11:BOOL=OFF -DNVIMGCODEC_BUILD_DLPACK:BOOL=OFF ) diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index 908d678cfc1b6..ad75abdd4b2a5 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -35,7 +35,8 @@ requirements: - {{ compiler('cuda') }} - {{ compiler('cxx') }} - {{ stdlib('c') }} - - cmake >=3.18 + # Must use 3.18 because of changes in find_package(TIFF) - @carterbox Jan 2025 + - cmake 3.18.* - ninja - pkg-config - python-clang @@ -46,7 +47,8 @@ requirements: {% if cuda_major == 12 %} - libnvjpeg-dev - libnvjpeg2k-dev - - libnvtiff-dev + # nvTIFF package not published on conda-forge yet - @carterbox Jan 2025 + - libnvtiff-dev # [not win] {% endif %} - libopencv - libtiff @@ -64,19 +66,19 @@ outputs: # This recipe requires conda-build 24.7 or later include: - include/** # [linux] - - Library/include/** # [win] - lib/libnvimgcodec.so # [linux] - - Library/lib/nvimagecodec.lib # [linux] - lib/cmake/nvimgcodec # [linux] - - Library/lib/cmake/nvimgcodec # [win] - etc/** # [linux] - - Library/etc/** # [win] - extensions/*.so # [linux] # FIXME: Drop static libraries once CMake config supports it - - extensions/*.a # [linux] - - Library/extensions/*static.lib - lib/libnvimgcodec_static.a # [linux] - - Library/lib/nvimagecodec_static.lib # [linux] + - Library/include/** # [win] + - Library/lib/nvimgcodec.lib # [win] + - Library/lib/cmake/nvimgcodec # [win] + - Library/etc/** # [win] + - Library/extensions/*.lib # [win] + # FIXME: Drop static libraries once CMake config supports it + - Library/lib/nvimgcodec_static.lib # [win] exclude: - lib/python* # [linux] - lib/libnvimgcodec.so.* # [linux] @@ -114,8 +116,8 @@ outputs: - name: libnvimgcodec{{ somajor }} files: - lib/libnvimgcodec.so.* # [linux] - - Library/bin/nvimgcodec_{{ somajor }}.dll # [win] - extensions/*.so.* # [linux] + - Library/bin/nvimgcodec_{{ somajor }}.dll # [win] - Library/extensions/*.dll # [win] requirements: build: From 29e03bb128fd378964d603000c5d35e1bd30a5cb Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 4 Feb 2025 12:35:55 -0600 Subject: [PATCH 11/14] BLD: Debug Windows builds --- recipes/libnvimgcodec/bld.bat | 1 + recipes/libnvimgcodec/build.sh | 1 + recipes/nvimgcodec/bld.bat | 29 ++++++++++++----------------- recipes/nvimgcodec/meta.yaml | 18 +++++++++--------- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/recipes/libnvimgcodec/bld.bat b/recipes/libnvimgcodec/bld.bat index 22ba1b901a844..ace7bb42ef715 100644 --- a/recipes/libnvimgcodec/bld.bat +++ b/recipes/libnvimgcodec/bld.bat @@ -36,6 +36,7 @@ set NVIMG_EXT_ARGS= ^ -DBUILD_OPENCV_EXT:BOOL=ON set NVIMG_PYTHON_ARGS= ^ + -DPython_EXECUTABLE=%PYTHON% ^ -DBUILD_PYTHON:BOOL=OFF ^ -DPYTHON_VERSIONS=%PY_VER% ^ -DBUILD_WHEEL:BOOL=OFF ^ diff --git a/recipes/libnvimgcodec/build.sh b/recipes/libnvimgcodec/build.sh index d4e387eb3c1c9..70adab24f39f8 100644 --- a/recipes/libnvimgcodec/build.sh +++ b/recipes/libnvimgcodec/build.sh @@ -42,6 +42,7 @@ nvimg_build_args=( -DBUILD_NVTIFF_EXT:BOOL=OFF -DBUILD_OPENCV_EXT:BOOL=ON # Python args + -DPython_EXECUTABLE=$PYTHON -DBUILD_PYTHON:BOOL=OFF -DPYTHON_VERSIONS="${PY_VER}" -DBUILD_WHEEL:BOOL=OFF diff --git a/recipes/nvimgcodec/bld.bat b/recipes/nvimgcodec/bld.bat index 4110b79f844cc..686636485df76 100644 --- a/recipes/nvimgcodec/bld.bat +++ b/recipes/nvimgcodec/bld.bat @@ -10,35 +10,30 @@ cd build if errorlevel 1 exit 1 +set CUDAARCHS="50" + set NVIMG_BUILD_ARGS= ^ -DBUILD_DOCS:BOOL=OFF ^ -DBUILD_SAMPLES:BOOL=OFF ^ - -DBUILD_TEST:BOOL=OFF + -DBUILD_TEST:BOOL=OFF ^ + -DCUDA_TARGET_ARCHS=%CUDAARCHS% set NVIMG_LIBRARY_ARGS= ^ -DBUILD_LIBRARY:BOOL=OFF ^ -DBUILD_SHARED_LIBS:BOOL=ON ^ -DBUILD_STATIC_LIBS:BOOL=OFF ^ - -DWITH_DYNAMIC_NVJPEG:BOOL=ON ^ - -DWITH_DYNAMIC_NVJPEG2K:BOOL=OFF + -DWITH_DYNAMIC_LINK:BOOL=OFF set NVIMG_EXT_ARGS= ^ - -DBUILD_EXTENSIONS:BOOL=OFF ^ - -DBUILD_NVJPEG_EXT:BOOL=OFF ^ - -DBUILD_NVJPEG2K_EXT:BOOL=OFF ^ - -DBUILD_NVBMP_EXT:BOOL=OFF ^ - -DBUILD_NVPNM_EXT:BOOL=OFF ^ - -DBUILD_LIBJPEG_TURBO_EXT:BOOL=OFF ^ - -DBUILD_LIBTIFF_EXT:BOOL=OFF ^ - -DBUILD_OPENCV_EXT:BOOL=OFF + -DBUILD_EXTENSIONS:BOOL=OFF set NVIMG_PYTHON_ARGS= ^ -DBUILD_PYTHON:BOOL=ON ^ - -DNVIMG_CODEC_PYTHON_VERSIONS=%PY_VER% ^ + -DPYTHON_VERSIONS=%PY_VER% ^ -DBUILD_WHEEL:BOOL=OFF ^ - -DNVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF ^ - -DNVIMG_CODEC_USE_SYSTEM_PYBIND:BOOL=ON ^ - -DNVIMG_CODEC_USE_SYSTEM_DLPACK:BOOL=ON + -DNVIMGCODEC_COPY_LIBS_TO_PYTHON_DIR:BOOL=OFF ^ + -DNVIMGCODEC_BUILD_PYBIND11:BOOL=OFF ^ + -DNVIMGCODEC_BUILD_DLPACK:BOOL=OFF cmake %CMAKE_ARGS% -GNinja -DCMAKE_INSTALL_PREFIX="%PREFIX%/Library" ^ %NVIMG_BUILD_ARGS% %NVIMG_LIBRARY_ARGS% %NVIMG_EXT_ARGS% ^ @@ -55,11 +50,11 @@ cmake --install . if errorlevel 1 exit 1 @REM copy in CMakeLists doesn't work for unknown reason -move .\python\nvimgcodec*.pyd .\python\nvidia\nvimgcodec\ +move .\python\*.pyd .\python\nvidia\nvimgcodec\ if errorlevel 1 exit 1 -%PYTHON% -m pip install .\python --no-deps --no-build-isolation -v +%PYTHON% -m pip install --no-deps --no-build-isolation -v %SRC_DIR%/build/python if errorlevel 1 exit 1 diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index 1e49dcccb80b1..f1228f61bb1f0 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -26,11 +26,13 @@ source: build: number: 0 - skip: true # [not (linux or win)] - skip: true # [cuda_compiler_version in (None, 'None')] + skip: true # [cuda_compiler_version in (undefined, 'None')] # Debug skips below - # skip: true # [py != 312] + skip: true # [py != 312] # skip: true # [cuda_compiler_version != '12.0'] + ignore_run_exports_from: + # For enhanced CUDA compatability + - {{ compiler('cuda') }} requirements: build: @@ -38,23 +40,21 @@ requirements: - {{ compiler('cuda') }} - {{ compiler('cxx') }} - {{ stdlib('c') }} - - cmake >=3.18 + # The python build requires CMake>=3.19 because of find_package syntax in cmake/Utils.cmake - @carterbox Jan 2025 + - cmake 3.19 - ninja - pkg-config - - python-clang + - python-clang # [not win] host: - cuda-version {{ cuda_compiler_version }} - dlpack - libboost-headers - libnvimgcodec-dev {{ version }} -{% if cuda_major == 12 %} - - libnvjpeg-dev -{% endif %} - pybind11 - python - setuptools - - zlib run: + - {{ pin_compatible('cuda-version', min_pin='x', max_pin='x') }} - python test: From 8037ca950818333b34e48bc750ae52fa99f71a17 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 4 Feb 2025 12:36:21 -0600 Subject: [PATCH 12/14] BLD: Remove unused patches --- ...issing-headers-from-standard-library.patch | 87 ----- ...ack-only-needed-when-building-for-py.patch | 50 --- ...ror-if-extensions-are-built-without-.patch | 31 -- ...ser-set-libdir-using-CMake-variables.patch | 240 ------------- ...libraries-to-python-directory-option.patch | 132 -------- ...nt-install-directory-for-cmake-confi.patch | 43 --- ...t-python-versions-be-user-selectable.patch | 114 ------- ...uple-nvimgcodec-and-dynlink_-targets.patch | 68 ---- ...k-system-nvimgcodec-to-python-module.patch | 28 -- ...10-BLD-Find-libclang-for-conda-forge.patch | 320 ------------------ ...issing-headers-from-standard-library.patch | 87 ----- ...ack-only-needed-when-building-for-py.patch | 50 --- ...ror-if-extensions-are-built-without-.patch | 31 -- ...ser-set-libdir-using-CMake-variables.patch | 240 ------------- ...libraries-to-python-directory-option.patch | 132 -------- ...nt-install-directory-for-cmake-confi.patch | 43 --- ...t-python-versions-be-user-selectable.patch | 114 ------- ...uple-nvimgcodec-and-dynlink_-targets.patch | 68 ---- ...k-system-nvimgcodec-to-python-module.patch | 28 -- ...10-BLD-Find-libclang-for-conda-forge.patch | 320 ------------------ 20 files changed, 2226 deletions(-) delete mode 100644 recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch delete mode 100644 recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch delete mode 100644 recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch delete mode 100644 recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch delete mode 100644 recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch delete mode 100644 recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch delete mode 100644 recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch delete mode 100644 recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch delete mode 100644 recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch delete mode 100644 recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch delete mode 100644 recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch delete mode 100644 recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch delete mode 100644 recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch delete mode 100644 recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch delete mode 100644 recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch delete mode 100644 recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch delete mode 100644 recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch delete mode 100644 recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch delete mode 100644 recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch delete mode 100644 recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch diff --git a/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch b/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch deleted file mode 100644 index da8ffef8a9e1d..0000000000000 --- a/recipes/libnvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch +++ /dev/null @@ -1,87 +0,0 @@ -From db52313b58080519bb3be0422599564fd01d8db2 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Tue, 10 Sep 2024 17:46:15 -0500 -Subject: [PATCH 01/10] BUG: Add missing headers from standard library - ---- - extensions/libjpeg_turbo/jpeg_handle.h | 9 +++++---- - src/logger.h | 5 +++-- - src/parsers/exif.h | 1 + - 3 files changed, 9 insertions(+), 6 deletions(-) - -diff --git a/extensions/libjpeg_turbo/jpeg_handle.h b/extensions/libjpeg_turbo/jpeg_handle.h -index bc24173..6da1652 100644 ---- a/extensions/libjpeg_turbo/jpeg_handle.h -+++ b/extensions/libjpeg_turbo/jpeg_handle.h -@@ -1,16 +1,16 @@ --/* -+/* - * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright 2015 The TensorFlow Authors. All Rights Reserved. - * Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -- * -+ * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at -- * -+ * - * http://www.apache.org/licenses/LICENSE-2.0 -- * -+ * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@@ -23,6 +23,7 @@ - - #pragma once - -+#include - #include - #include "jpeg_utils.h" - -diff --git a/src/logger.h b/src/logger.h -index 4b75869..3264a95 100644 ---- a/src/logger.h -+++ b/src/logger.h -@@ -17,6 +17,7 @@ - - #pragma once - -+#include - #include - #include - #include -@@ -46,7 +47,7 @@ class Logger : public ILogger - } - - void log(const nvimgcodecDebugMessageSeverity_t message_severity, -- const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override -+ const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override - { - nvimgcodecDebugMessageData_t data{NVIMGCODEC_STRUCTURE_TYPE_DEBUG_MESSAGE_DATA, sizeof(nvimgcodecDebugMessageData_t), nullptr, - message.c_str(), 0, nullptr, name_.c_str(), 0}; -@@ -85,4 +86,4 @@ class Logger : public ILogger - std::string name_; - }; - --} //namespace nvimgcodec -\ No newline at end of file -+} //namespace nvimgcodec -diff --git a/src/parsers/exif.h b/src/parsers/exif.h -index aff554c..d996317 100644 ---- a/src/parsers/exif.h -+++ b/src/parsers/exif.h -@@ -42,6 +42,7 @@ - - #pragma once - -+#include - #include - #include - #include --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch b/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch deleted file mode 100644 index 2bd2fe62be85a..0000000000000 --- a/recipes/libnvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 04c6631102716182a5df671a57bd0a944dfc195e Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Tue, 10 Sep 2024 18:12:59 -0500 -Subject: [PATCH 02/10] BLD: pybind11 dlpack only needed when building for - python - -Also allow system libraries for these deps ---- - CMakeLists.txt | 3 +++ - external/CMakeLists.txt | 15 +++++++++++++-- - 2 files changed, 16 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7f9f1ae..7e19bdf 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -95,6 +95,9 @@ option(BUILD_LIBTIFF_EXT "Build libtiff extensions module" ON) - option(BUILD_OPENCV_EXT "Build opencv extensions module" ON) - option(BUILD_PYTHON "Build Python binding" ON) - option(BUILD_WHEEL "Build python wheel package" ON) -+option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) -+option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) -+ - - cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON - "BUILD_NVJPEG_EXT" OFF) -diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index 50685ce..88ff95d 100644 ---- a/external/CMakeLists.txt -+++ b/external/CMakeLists.txt -@@ -1,2 +1,13 @@ --add_subdirectory(pybind11 EXCLUDE_FROM_ALL) --add_subdirectory(dlpack EXCLUDE_FROM_ALL) -\ No newline at end of file -+if(BUILD_PYTHON) -+ if(NVIMG_CODEC_USE_SYSTEM_PYBIND) -+ find_package(pybind11 REQUIRED) -+ else() -+ add_subdirectory(pybind11 EXCLUDE_FROM_ALL) -+ endif(NVIMG_CODEC_USE_SYSTEM_PYBIND) -+ if(NVIMG_CODEC_USE_SYSTEM_DLPACK) -+ find_package(dlpack REQUIRED) -+ else() -+ add_subdirectory(dlpack EXCLUDE_FROM_ALL) -+ endif(NVIMG_CODEC_USE_SYSTEM_DLPACK) -+endif(BUILD_PYTHON) -+ --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch b/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch deleted file mode 100644 index edb835674f2f4..0000000000000 --- a/recipes/libnvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a3327de7c8b08ac2224efa6193f2918f411152f8 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Tue, 17 Sep 2024 11:09:47 -0500 -Subject: [PATCH 03/10] DOC: Add Fatal Error if extensions are built without - library - ---- - CMakeLists.txt | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7e19bdf..5e4162b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -87,7 +87,13 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) - option(BUILD_DOCS "Build documentation" OFF) - option(BUILD_EXTENSIONS "Build extensions modules" ON) - option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) -+if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) -+ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") -+endif() - option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) -+if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) -+ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") -+endif() - option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) - option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) - option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch b/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch deleted file mode 100644 index b505cd1d11df0..0000000000000 --- a/recipes/libnvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch +++ /dev/null @@ -1,240 +0,0 @@ -From d062794e03a8e167718b7ecd05776216cd338a75 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 13:09:10 -0500 -Subject: [PATCH 04/10] BLD: Let end user set libdir using CMake variables - ---- - CMakeLists.txt | 13 +++++++++++++ - cpack/ld.so.conf.in | 6 +----- - extensions/libjpeg_turbo/CMakeLists.txt | 5 ++--- - extensions/libtiff/CMakeLists.txt | 5 ++--- - extensions/nvbmp/CMakeLists.txt | 5 ++--- - extensions/nvjpeg/CMakeLists.txt | 5 ++--- - extensions/nvjpeg2k/CMakeLists.txt | 5 ++--- - extensions/nvpnm/CMakeLists.txt | 5 ++--- - extensions/opencv/CMakeLists.txt | 5 ++--- - src/CMakeLists.txt | 14 +------------- - 10 files changed, 29 insertions(+), 39 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5e4162b..941a033 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -114,6 +114,19 @@ propagate_option(WITH_DYNAMIC_NVJPEG2K) - - string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) - -+# Introduce variables: -+# * CMAKE_INSTALL_LIBDIR -+# * CMAKE_INSTALL_BINDIR -+# * CMAKE_INSTALL_INCLUDEDIR -+if(NOT DEFINED CMAKE_INSTALL_LIBDIR) -+ if(UNIX) -+ set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib -+ else() -+ set(CMAKE_INSTALL_LIBDIR "lib") -+ endif() -+endif() -+include(GNUInstallDirs) -+ - if(WIN32) - set(CPACK_GENERATOR "ZIP") - if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) -diff --git a/cpack/ld.so.conf.in b/cpack/ld.so.conf.in -index def1924..389dc26 100644 ---- a/cpack/ld.so.conf.in -+++ b/cpack/ld.so.conf.in -@@ -13,8 +13,4 @@ - # See the License for the specific language governing permissions and - # limitations under the License. - --if(UNIX) -- @CMAKE_INSTALL_PREFIX@/lib64 --else() -- @CMAKE_INSTALL_PREFIX@/lib --endif() -\ No newline at end of file -+@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -diff --git a/extensions/libjpeg_turbo/CMakeLists.txt b/extensions/libjpeg_turbo/CMakeLists.txt -index 6b75f9f..b157f66 100644 ---- a/extensions/libjpeg_turbo/CMakeLists.txt -+++ b/extensions/libjpeg_turbo/CMakeLists.txt -@@ -48,15 +48,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/libtiff/CMakeLists.txt b/extensions/libtiff/CMakeLists.txt -index 25ecae0..092fdba 100644 ---- a/extensions/libtiff/CMakeLists.txt -+++ b/extensions/libtiff/CMakeLists.txt -@@ -47,14 +47,13 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - else() - install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/nvbmp/CMakeLists.txt b/extensions/nvbmp/CMakeLists.txt -index 4cf1b97..a408ce6 100644 ---- a/extensions/nvbmp/CMakeLists.txt -+++ b/extensions/nvbmp/CMakeLists.txt -@@ -44,12 +44,11 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib) - else() - install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib) - endif() -diff --git a/extensions/nvjpeg/CMakeLists.txt b/extensions/nvjpeg/CMakeLists.txt -index dc302de..f888288 100644 ---- a/extensions/nvjpeg/CMakeLists.txt -+++ b/extensions/nvjpeg/CMakeLists.txt -@@ -91,15 +91,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/nvjpeg2k/CMakeLists.txt b/extensions/nvjpeg2k/CMakeLists.txt -index 18c99c9..8e569e0 100644 ---- a/extensions/nvjpeg2k/CMakeLists.txt -+++ b/extensions/nvjpeg2k/CMakeLists.txt -@@ -60,15 +60,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/nvpnm/CMakeLists.txt b/extensions/nvpnm/CMakeLists.txt -index 4ed5134..66b1093 100644 ---- a/extensions/nvpnm/CMakeLists.txt -+++ b/extensions/nvpnm/CMakeLists.txt -@@ -43,15 +43,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/opencv/CMakeLists.txt b/extensions/opencv/CMakeLists.txt -index 36ec99f..ba956a9 100644 ---- a/extensions/opencv/CMakeLists.txt -+++ b/extensions/opencv/CMakeLists.txt -@@ -49,15 +49,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 5d8aeb0..940e2a6 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -109,18 +109,6 @@ endif() - - # Installation (https://github.com/forexample/package-example) { - --# Introduce variables: --# * CMAKE_INSTALL_LIBDIR --# * CMAKE_INSTALL_BINDIR --# * CMAKE_INSTALL_INCLUDEDIR --include(GNUInstallDirs) --if(UNIX) -- set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib --else() -- set(CMAKE_INSTALL_LIBDIR "lib") --endif() --set(CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") # adjust accordingly -- - # Layout. This works for all platforms: - # * /cmake/ - # * /lib*/ -@@ -190,4 +178,4 @@ install( - COMPONENT lib - ) - --# } -\ No newline at end of file -+# } --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch b/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch deleted file mode 100644 index 6dd936cf4061e..0000000000000 --- a/recipes/libnvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 561f4ca740edc3ba4605b12202edea4e0c7d023d Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 13:37:13 -0500 -Subject: [PATCH 05/10] BLD: Make moving libraries to python directory optional - ---- - CMakeLists.txt | 2 +- - python/CMakeLists.txt | 82 +++++++++++++++++++++++-------------------- - 2 files changed, 44 insertions(+), 40 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 941a033..f15b7c1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -103,7 +103,7 @@ option(BUILD_PYTHON "Build Python binding" ON) - option(BUILD_WHEEL "Build python wheel package" ON) - option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) - option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) -- -+option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) - - cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON - "BUILD_NVJPEG_EXT" OFF) -diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 0837211..39f54c7 100644 ---- a/python/CMakeLists.txt -+++ b/python/CMakeLists.txt -@@ -43,7 +43,7 @@ set(PY_NVIMGCODEC_SRCS - image_buffer_kind.cpp - code_stream.cpp - region.cpp) -- -+ - if(UNIX) - set(PY_NVIMGCODEC_IMPL_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec) - else() -@@ -66,50 +66,54 @@ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.in" DESTINATION "${CMAKE_CURRENT - file(COPY "${PROJECT_SOURCE_DIR}/Acknowledgements.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${PROJECT_SOURCE_DIR}/LICENSE.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - --add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) --add_dependencies(copy_libs_to_python_dir -- nvimgcodec -- nvbmp_ext -- nvpnm_ext) -+if(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) - --if (BUILD_NVJPEG_EXT) -- add_dependencies(copy_libs_to_python_dir nvjpeg_ext) --endif() -+ add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) -+ add_dependencies(copy_libs_to_python_dir -+ nvimgcodec -+ nvbmp_ext -+ nvpnm_ext) - --if (BUILD_NVJPEG2K_EXT) -- add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) --endif() -+ if (BUILD_NVJPEG_EXT) -+ add_dependencies(copy_libs_to_python_dir nvjpeg_ext) -+ endif() - --if(BUILD_LIBJPEG_TURBO_EXT) -- add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) --endif() -+ if (BUILD_NVJPEG2K_EXT) -+ add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) -+ endif() - --if(BUILD_LIBTIFF_EXT) -- add_dependencies(copy_libs_to_python_dir libtiff_ext) --endif() -+ if(BUILD_LIBJPEG_TURBO_EXT) -+ add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) -+ endif() - --if(BUILD_OPENCV_EXT) -- add_dependencies(copy_libs_to_python_dir opencv_ext) --endif() -+ if(BUILD_LIBTIFF_EXT) -+ add_dependencies(copy_libs_to_python_dir libtiff_ext) -+ endif() - --if(UNIX) -- add_custom_command( -- TARGET copy_libs_to_python_dir -- COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && -- cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && -- cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" -- ) --else() -- string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) -- string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) -- string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -- add_custom_command( -- TARGET copy_libs_to_python_dir -- COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -- copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -- for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && -- xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) --endif() -+ if(BUILD_OPENCV_EXT) -+ add_dependencies(copy_libs_to_python_dir opencv_ext) -+ endif() -+ -+ if(UNIX) -+ add_custom_command( -+ TARGET copy_libs_to_python_dir -+ COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && -+ cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && -+ cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" -+ ) -+ else() -+ string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) -+ string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) -+ string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -+ add_custom_command( -+ TARGET copy_libs_to_python_dir -+ COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -+ copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -+ for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && -+ xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) -+ endif() -+ -+endif(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) - - if(BUILD_WHEEL) - string(REGEX REPLACE "-" "_" NVIMGCODEC_FLAVOR_UNDERSCORE "${NVIMGCODEC_FLAVOR_MINUS}") --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch b/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch deleted file mode 100644 index c40b6a47d24c4..0000000000000 --- a/recipes/libnvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 6732446c6b8bdd8d631d96b4f6a7d1763e284097 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 14:50:32 -0500 -Subject: [PATCH 06/10] BLD: Use consistent install directory for cmake configs - ---- - src/CMakeLists.txt | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 940e2a6..83fdfe6 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -113,7 +113,7 @@ endif() - # * /cmake/ - # * /lib*/ - # * /include/ --set(config_install_dir "${CMAKE_INSTALL_PREFIX}/cmake") -+set(config_install_dir "${CMAKE_INSTALL_PREFIX}/lib/cmake/nvimgcodec") - - set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") - -@@ -165,7 +165,7 @@ install( - # * /cmake/nvimgcodec/nvimgcodecConfigVersion.cmake - install( - FILES "${project_config}" "${version_config}" -- DESTINATION "cmake/nvimgcodec" -+ DESTINATION "${config_install_dir}" - COMPONENT lib - ) - -@@ -174,7 +174,7 @@ install( - install( - EXPORT "${TARGETS_EXPORT_NAME}" - NAMESPACE "${namespace}" -- DESTINATION "cmake/nvimgcodec" -+ DESTINATION "${config_install_dir}" - COMPONENT lib - ) - --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch b/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch deleted file mode 100644 index ceda92abf14c1..0000000000000 --- a/recipes/libnvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch +++ /dev/null @@ -1,114 +0,0 @@ -From e93ff96907aa40b1441f6b79689415eb45f5e478 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 17:48:31 -0500 -Subject: [PATCH 07/10] BLD: Let python versions be user-selectable - ---- - cmake/Utils.cmake | 34 ++++++++++++++++++---------------- - 1 file changed, 18 insertions(+), 16 deletions(-) - -diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake -index fb8110d..f247794 100644 ---- a/cmake/Utils.cmake -+++ b/cmake/Utils.cmake -@@ -11,9 +11,9 @@ - # its affiliates is strictly prohibited. - - # this is needed because cmake caching behavior was --# preventing finding multiple packages of python -+# preventing finding multiple packages of python - # using find_package. So everytime a new python version --# needs to be found, UnsetPython needs to be called. -+# needs to be found, UnsetPython needs to be called. - function(UnsetPython) - get_cmake_property(all_variables VARIABLES) - foreach(var ${all_variables}) -@@ -65,7 +65,7 @@ function(FindPython PYVER) - message("Python version ${PYVER} not found.") - set(PYTHON_EXISTS 1 PARENT_SCOPE) - endif() --endfunction() -+endfunction() - - # Build a .so (or .pyd on windows) library variant for each python version provided in PYTHON_VERSIONS variable - # if it is accesible during the build time. The library sufix is provided and specific for each python version -@@ -87,7 +87,7 @@ endfunction() - function(build_per_python_lib) - set(oneValueArgs TARGET_NAME OUTPUT_NAME OUTPUT_DIR PREFIX) - set(multiValueArgs PRIV_LIBS PUBLIC_LIBS SRC EXCLUDE_LIBS) -- -+ - cmake_parse_arguments(PARSE_ARGV 1 PYTHON_LIB_ARG "${options}" "${oneValueArgs}" "${multiValueArgs}") - - set(PYTHON_LIB_ARG_TARGET_NAME ${ARGV0}) -@@ -106,10 +106,12 @@ function(build_per_python_lib) - target_include_directories(${PYTHON_LIB_ARG_TARGET_NAME}_private - INTERFACE "${PYBIND11_INCLUDE_DIR}" - INTERFACE "${pybind11_INCLUDE_DIR}") -- - -- set (PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") -- foreach(PYVER ${PYTHON_VERSIONS}) -+ if(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) -+ set(NVIMG_CODEC_PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") -+ endif(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) -+ -+ foreach(PYVER ${NVIMG_CODEC_PYTHON_VERSIONS}) - - set(PYTHON_LIB_TARGET_FOR_PYVER "${PYTHON_LIB_ARG_TARGET_NAME}_${PYVER}") - # check if listed python versions are accesible -@@ -136,12 +138,12 @@ function(build_per_python_lib) - else() - string(REPLACE "." "" PYVER_WIN "${PYVER}") - set(PYTHON_SUFFIX ".cp${PYVER_WIN}-win_amd64") -- -+ - set(PYTHON_INCLUDES ${Python_INCLUDE_DIRS}) -- -+ - set(PYTHON_LIBRARY ${Python_LIBRARIES}) - endif() -- -+ - # split and make it a list - string(REPLACE "-I" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") - string(REPLACE "\n" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") -@@ -170,23 +172,23 @@ function(build_per_python_lib) - # add interface dummy lib as a dependnecy to easilly propagate options we could set from the above - target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC ${PYTHON_LIB_ARG_TARGET_NAME}_public) - target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PRIVATE ${PYTHON_LIB_ARG_TARGET_NAME}_private) -- -+ - if (WIN32) - target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC "${PYTHON_LIBRARY}") - endif() -- -+ - add_dependencies(${PYTHON_LIB_ARG_TARGET_NAME} ${PYTHON_LIB_TARGET_FOR_PYVER}) - endif() - - endforeach(PYVER) -- if (WIN32) -- # Need to set back the python version which was found at -+ if (WIN32) -+ # Need to set back the python version which was found at - # the beginning of this CMakeLists - UnsetPython() - find_package(Python COMPONENTS Interpreter) - endif() - --endfunction() -+endfunction() - - - function(parse_cuda_version CUDA_VERSION CUDA_VERSION_MAJOR_VAR CUDA_VERSION_MINOR_VAR CUDA_VERSION_PATCH_VAR CUDA_VERSION_SHORT_VAR CUDA_VERSION_SHORT_DIGIT_ONLY_VAR) -@@ -284,4 +286,4 @@ function(propagate_option BUILD_OPTION_NAME) - message(STATUS "${BUILD_OPTION_NAME} -- OFF") - add_definitions(-D${DEFINE_NAME}=0) - endif() --endfunction(propagate_option) -\ No newline at end of file -+endfunction(propagate_option) --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch b/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch deleted file mode 100644 index 34bc525611267..0000000000000 --- a/recipes/libnvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 1914106b92eb9c71dcc0d7b7e2e52cb4abc12cfb Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 23:22:31 -0500 -Subject: [PATCH 08/10] BLD: Decouple nvimgcodec and dynlink_* targets - ---- - CMakeLists.txt | 17 ++++------------- - src/CMakeLists.txt | 1 - - 2 files changed, 4 insertions(+), 14 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f15b7c1..dae85f6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -87,13 +87,7 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) - option(BUILD_DOCS "Build documentation" OFF) - option(BUILD_EXTENSIONS "Build extensions modules" ON) - option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) --if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) -- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") --endif() - option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) --if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) -- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") --endif() - option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) - option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) - option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) -@@ -105,13 +99,6 @@ option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) - option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) - option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) - --cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON -- "BUILD_NVJPEG_EXT" OFF) --propagate_option(WITH_DYNAMIC_NVJPEG) --cmake_dependent_option(WITH_DYNAMIC_NVJPEG2K "Dynamically loads nvjpeg2k at runtime" ON -- "BUILD_NVJPEG2K_EXT" OFF) --propagate_option(WITH_DYNAMIC_NVJPEG2K) -- - string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) - - # Introduce variables: -@@ -256,6 +243,10 @@ include(Dependencies) - - add_subdirectory(external) - -+if(BUILD_LIBRARY OR BUILD_PYTHON OR BUILD_EXTENSIONS OR BUILD_TEST) -+ add_subdirectory(src/dynlink) -+endif() -+ - if(BUILD_LIBRARY) - add_subdirectory(src) - endif() -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 83fdfe6..306ad46 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -69,7 +69,6 @@ add_library(${NVIMGCODEC_LIBRARY_NAME}_static STATIC ${NVIMGCODEC_SRCS} ${Produc - set(LIBTOPACK ${NVIMGCODEC_LIBRARY_NAME} ${NVIMGCODEC_LIBRARY_NAME}_static) - - find_package(CUDAToolkit REQUIRED) --add_subdirectory(dynlink) - - target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static dynlink_cuda) - --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch b/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch deleted file mode 100644 index 1be4b4bb55e6a..0000000000000 --- a/recipes/libnvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 8ef486ccb76873b65d81680fb71bc4b78f9a2274 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 23:23:20 -0500 -Subject: [PATCH 09/10] BLD: Link system nvimgcodec to python module - ---- - python/CMakeLists.txt | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 39f54c7..f34b5c7 100644 ---- a/python/CMakeLists.txt -+++ b/python/CMakeLists.txt -@@ -16,6 +16,11 @@ - include(Utils) - include(GNUInstallDirs) - -+if(NOT TARGET nvimgcodec) -+ find_package(nvimgcodec REQUIRED) -+ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) -+endif() -+ - if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden") - endif() --- -2.47.0 - diff --git a/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch b/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch deleted file mode 100644 index 33e510c6603a0..0000000000000 --- a/recipes/libnvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch +++ /dev/null @@ -1,320 +0,0 @@ -From e5cfc92372ad75fd54c4d1ea3948130ac6fb079f Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Fri, 1 Nov 2024 15:27:28 -0500 -Subject: [PATCH 10/10] BLD: Find libclang for conda-forge - ---- - tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- - 1 file changed, 155 insertions(+), 145 deletions(-) - -diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py -index 0447d01..25ad4ef 100644 ---- a/tools/stub_generator/stub_codegen.py -+++ b/tools/stub_generator/stub_codegen.py -@@ -1,148 +1,158 @@ --# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --# SPDX-License-Identifier: Apache-2.0 --# --# Copyright 2020 The TensorFlow Runtime Authors --# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -+# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -+# SPDX-License-Identifier: Apache-2.0 -+# -+# Copyright 2020 The TensorFlow Runtime Authors -+# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - # --# Licensed under the Apache License, Version 2.0 (the "License"); --# you may not use this file except in compliance with the License. --# You may obtain a copy of the License at -+# Licensed under the Apache License, Version 2.0 (the "License"); -+# you may not use this file except in compliance with the License. -+# You may obtain a copy of the License at - # --# http://www.apache.org/licenses/LICENSE-2.0 -+# http://www.apache.org/licenses/LICENSE-2.0 - # --# Unless required by applicable law or agreed to in writing, software --# distributed under the License is distributed on an "AS IS" BASIS, --# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --# See the License for the specific language governing permissions and --# limitations under the License. -- --# Lint as: python3 --"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" -- --from __future__ import absolute_import --from __future__ import print_function -- --import argparse --import re --import json --import clang.cindex --import os -- -- --def function_header(return_type, name, args): -- args_expr = [] -- for arg_type, arg_name in args: -- # handle arrays and function (or array of) pointer and reference to an array differently -- # as well -- # int[], int (*)(), int (*[])(), int (&)[5] -- match = re.search(r'\[|\)', arg_type) -- if match: -- pos = match.span()[0] -- print(arg_type[:pos]) -- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") -- else: -- args_expr.append(f"{arg_type} {arg_name}") -- -- arg_str = ", ".join(args_expr) -- ret = f"{return_type} {name}({arg_str})" -- return ret -- -- --def main(): -- parser = argparse.ArgumentParser( -- description='Generate dynamic loading stubs for CUDA and HIP APIs.') -- parser.add_argument('--unique_prefix', default="", type=str, -- help='Unique prefix for used in the stub') -- parser.add_argument( -- 'input', nargs='?', type=argparse.FileType('r')) -- parser.add_argument( -- 'output', nargs='?', type=argparse.FileType('w')) -- parser.add_argument( -- 'header', nargs='?', type=str, default=None) -- parser.add_argument( -- 'extra_args', nargs='*', type=str, default=None) -- args = parser.parse_args() -- -- -- if os.name == 'nt': -- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') -- config = json.load(args.input) -- -- function_impl = """ --{return_type} %s {1}NotFound({2}) {{ -- return {not_found_error}; --}} -- --{0} {{ -- using FuncPtr = {return_type} (*) ({2}); -- -- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? -- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : -- {1}NotFound; -- return func_ptr({3}); --}}\n""" % (config['calling_conv']) -- -- prolog = """ --void *{0}LoadSymbol(const char *name); -- --#define LOAD_SYMBOL_FUNC {0}##LoadSymbol -- --""" -- -- index = clang.cindex.Index.create() -- header = args.header -- extra_args = args.extra_args -- -- translation_unit = index.parse(header, args=extra_args) -- -- for diag in translation_unit.diagnostics: -- if diag.severity in [diag.Warning, diag.Fatal]: -- raise Exception(str(diag)) -- -- for extra_i in config['extra_include']: -- args.output.write('#include {}\n'.format(extra_i)) -- args.output.write(prolog.format(args.unique_prefix)) -- -- all_definition = set() -- all_declaration = set() -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.is_definition(): -- all_definition.add(cursor.spelling) -- -- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: -- all_declaration.add(cursor.spelling) -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: -- continue -- -- function_name = cursor.spelling -- -- # make sure that we deal only with functions with no definition -- if function_name not in config['functions'] or function_name in all_definition or \ -- function_name not in all_declaration: -- continue -- -- # make sure that we deal with every function only once -- all_declaration.remove(function_name) -- -- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] -- arg_names = [arg.spelling for arg in cursor.get_arguments()] -- -- return_type = config['functions'][function_name].get( -- 'return_type', config['return_type']) -- not_found_error = config['functions'][function_name].get( -- 'not_found_error', config['not_found_error']) -- -- header = function_header(return_type, function_name, zip(arg_types, arg_names)) -- -- implementation = function_impl.format(header, function_name, ', '.join(arg_types), -- ', '.join(arg_names), return_type=return_type, -- not_found_error=not_found_error) -- -- args.output.write(implementation) -- -- --if __name__ == '__main__': -- main() -+# Unless required by applicable law or agreed to in writing, software -+# distributed under the License is distributed on an "AS IS" BASIS, -+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+# See the License for the specific language governing permissions and -+# limitations under the License. -+ -+# Lint as: python3 -+"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" -+ -+from __future__ import absolute_import -+from __future__ import print_function -+ -+import argparse -+import re -+import json -+import clang.cindex -+import os -+ -+ -+def function_header(return_type, name, args): -+ args_expr = [] -+ for arg_type, arg_name in args: -+ # handle arrays and function (or array of) pointer and reference to an array differently -+ # as well -+ # int[], int (*)(), int (*[])(), int (&)[5] -+ match = re.search(r'\[|\)', arg_type) -+ if match: -+ pos = match.span()[0] -+ print(arg_type[:pos]) -+ args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") -+ else: -+ args_expr.append(f"{arg_type} {arg_name}") -+ -+ arg_str = ", ".join(args_expr) -+ ret = f"{return_type} {name}({arg_str})" -+ return ret -+ -+ -+def main(): -+ parser = argparse.ArgumentParser( -+ description='Generate dynamic loading stubs for CUDA and HIP APIs.') -+ parser.add_argument('--unique_prefix', default="", type=str, -+ help='Unique prefix for used in the stub') -+ parser.add_argument( -+ 'input', nargs='?', type=argparse.FileType('r')) -+ parser.add_argument( -+ 'output', nargs='?', type=argparse.FileType('w')) -+ parser.add_argument( -+ 'header', nargs='?', type=str, default=None) -+ parser.add_argument( -+ 'extra_args', nargs='*', type=str, default=None) -+ args = parser.parse_args() -+ -+ -+ if os.name == 'nt': -+ for libclang_file in [ -+ 'C:/Program Files/LLVM/bin/libclang.dll', -+ os.path.join(os.environ['BUILD_PREFIX'], 'Library/bin/libclang-13.dll'), -+ os.path.join(os.environ['PREFIX'], 'Library/bin/libclang-13.dll'), -+ os.path.join(os.environ['CONDA_PREFIX'], 'Library/bin/libclang-13.dll'), -+ ]: -+ libclang_file = os.path.abspath(libclang_file) -+ if os.path.isfile(libclang_file): -+ print(f"Found libclang at {libclang_file}") -+ clang.cindex.Config.set_library_file(libclang_file) -+ break -+ config = json.load(args.input) -+ -+ function_impl = """ -+{return_type} %s {1}NotFound({2}) {{ -+ return {not_found_error}; -+}} -+ -+{0} {{ -+ using FuncPtr = {return_type} (*) ({2}); -+ -+ static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? -+ reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : -+ {1}NotFound; -+ return func_ptr({3}); -+}}\n""" % (config['calling_conv']) -+ -+ prolog = """ -+void *{0}LoadSymbol(const char *name); -+ -+#define LOAD_SYMBOL_FUNC {0}##LoadSymbol -+ -+""" -+ -+ index = clang.cindex.Index.create() -+ header = args.header -+ extra_args = args.extra_args -+ -+ translation_unit = index.parse(header, args=extra_args) -+ -+ for diag in translation_unit.diagnostics: -+ if diag.severity in [diag.Warning, diag.Fatal]: -+ raise Exception(str(diag)) -+ -+ for extra_i in config['extra_include']: -+ args.output.write('#include {}\n'.format(extra_i)) -+ args.output.write(prolog.format(args.unique_prefix)) -+ -+ all_definition = set() -+ all_declaration = set() -+ -+ for cursor in translation_unit.cursor.get_children(): -+ if cursor.is_definition(): -+ all_definition.add(cursor.spelling) -+ -+ if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: -+ all_declaration.add(cursor.spelling) -+ -+ for cursor in translation_unit.cursor.get_children(): -+ if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: -+ continue -+ -+ function_name = cursor.spelling -+ -+ # make sure that we deal only with functions with no definition -+ if function_name not in config['functions'] or function_name in all_definition or \ -+ function_name not in all_declaration: -+ continue -+ -+ # make sure that we deal with every function only once -+ all_declaration.remove(function_name) -+ -+ arg_types = [arg.type.spelling for arg in cursor.get_arguments()] -+ arg_names = [arg.spelling for arg in cursor.get_arguments()] -+ -+ return_type = config['functions'][function_name].get( -+ 'return_type', config['return_type']) -+ not_found_error = config['functions'][function_name].get( -+ 'not_found_error', config['not_found_error']) -+ -+ header = function_header(return_type, function_name, zip(arg_types, arg_names)) -+ -+ implementation = function_impl.format(header, function_name, ', '.join(arg_types), -+ ', '.join(arg_names), return_type=return_type, -+ not_found_error=not_found_error) -+ -+ args.output.write(implementation) -+ -+ -+if __name__ == '__main__': -+ main() --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch b/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch deleted file mode 100644 index da8ffef8a9e1d..0000000000000 --- a/recipes/nvimgcodec/patches/0001-BUG-Add-missing-headers-from-standard-library.patch +++ /dev/null @@ -1,87 +0,0 @@ -From db52313b58080519bb3be0422599564fd01d8db2 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Tue, 10 Sep 2024 17:46:15 -0500 -Subject: [PATCH 01/10] BUG: Add missing headers from standard library - ---- - extensions/libjpeg_turbo/jpeg_handle.h | 9 +++++---- - src/logger.h | 5 +++-- - src/parsers/exif.h | 1 + - 3 files changed, 9 insertions(+), 6 deletions(-) - -diff --git a/extensions/libjpeg_turbo/jpeg_handle.h b/extensions/libjpeg_turbo/jpeg_handle.h -index bc24173..6da1652 100644 ---- a/extensions/libjpeg_turbo/jpeg_handle.h -+++ b/extensions/libjpeg_turbo/jpeg_handle.h -@@ -1,16 +1,16 @@ --/* -+/* - * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright 2015 The TensorFlow Authors. All Rights Reserved. - * Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -- * -+ * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at -- * -+ * - * http://www.apache.org/licenses/LICENSE-2.0 -- * -+ * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@@ -23,6 +23,7 @@ - - #pragma once - -+#include - #include - #include "jpeg_utils.h" - -diff --git a/src/logger.h b/src/logger.h -index 4b75869..3264a95 100644 ---- a/src/logger.h -+++ b/src/logger.h -@@ -17,6 +17,7 @@ - - #pragma once - -+#include - #include - #include - #include -@@ -46,7 +47,7 @@ class Logger : public ILogger - } - - void log(const nvimgcodecDebugMessageSeverity_t message_severity, -- const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override -+ const nvimgcodecDebugMessageCategory_t message_category, const std::string& message) override - { - nvimgcodecDebugMessageData_t data{NVIMGCODEC_STRUCTURE_TYPE_DEBUG_MESSAGE_DATA, sizeof(nvimgcodecDebugMessageData_t), nullptr, - message.c_str(), 0, nullptr, name_.c_str(), 0}; -@@ -85,4 +86,4 @@ class Logger : public ILogger - std::string name_; - }; - --} //namespace nvimgcodec -\ No newline at end of file -+} //namespace nvimgcodec -diff --git a/src/parsers/exif.h b/src/parsers/exif.h -index aff554c..d996317 100644 ---- a/src/parsers/exif.h -+++ b/src/parsers/exif.h -@@ -42,6 +42,7 @@ - - #pragma once - -+#include - #include - #include - #include --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch b/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch deleted file mode 100644 index 2bd2fe62be85a..0000000000000 --- a/recipes/nvimgcodec/patches/0002-BLD-pybind11-dlpack-only-needed-when-building-for-py.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 04c6631102716182a5df671a57bd0a944dfc195e Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Tue, 10 Sep 2024 18:12:59 -0500 -Subject: [PATCH 02/10] BLD: pybind11 dlpack only needed when building for - python - -Also allow system libraries for these deps ---- - CMakeLists.txt | 3 +++ - external/CMakeLists.txt | 15 +++++++++++++-- - 2 files changed, 16 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7f9f1ae..7e19bdf 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -95,6 +95,9 @@ option(BUILD_LIBTIFF_EXT "Build libtiff extensions module" ON) - option(BUILD_OPENCV_EXT "Build opencv extensions module" ON) - option(BUILD_PYTHON "Build Python binding" ON) - option(BUILD_WHEEL "Build python wheel package" ON) -+option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) -+option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) -+ - - cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON - "BUILD_NVJPEG_EXT" OFF) -diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt -index 50685ce..88ff95d 100644 ---- a/external/CMakeLists.txt -+++ b/external/CMakeLists.txt -@@ -1,2 +1,13 @@ --add_subdirectory(pybind11 EXCLUDE_FROM_ALL) --add_subdirectory(dlpack EXCLUDE_FROM_ALL) -\ No newline at end of file -+if(BUILD_PYTHON) -+ if(NVIMG_CODEC_USE_SYSTEM_PYBIND) -+ find_package(pybind11 REQUIRED) -+ else() -+ add_subdirectory(pybind11 EXCLUDE_FROM_ALL) -+ endif(NVIMG_CODEC_USE_SYSTEM_PYBIND) -+ if(NVIMG_CODEC_USE_SYSTEM_DLPACK) -+ find_package(dlpack REQUIRED) -+ else() -+ add_subdirectory(dlpack EXCLUDE_FROM_ALL) -+ endif(NVIMG_CODEC_USE_SYSTEM_DLPACK) -+endif(BUILD_PYTHON) -+ --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch b/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch deleted file mode 100644 index edb835674f2f4..0000000000000 --- a/recipes/nvimgcodec/patches/0003-DOC-Add-Fatal-Error-if-extensions-are-built-without-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a3327de7c8b08ac2224efa6193f2918f411152f8 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Tue, 17 Sep 2024 11:09:47 -0500 -Subject: [PATCH 03/10] DOC: Add Fatal Error if extensions are built without - library - ---- - CMakeLists.txt | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7e19bdf..5e4162b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -87,7 +87,13 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) - option(BUILD_DOCS "Build documentation" OFF) - option(BUILD_EXTENSIONS "Build extensions modules" ON) - option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) -+if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) -+ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") -+endif() - option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) -+if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) -+ message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") -+endif() - option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) - option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) - option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch b/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch deleted file mode 100644 index b505cd1d11df0..0000000000000 --- a/recipes/nvimgcodec/patches/0004-BLD-Let-end-user-set-libdir-using-CMake-variables.patch +++ /dev/null @@ -1,240 +0,0 @@ -From d062794e03a8e167718b7ecd05776216cd338a75 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 13:09:10 -0500 -Subject: [PATCH 04/10] BLD: Let end user set libdir using CMake variables - ---- - CMakeLists.txt | 13 +++++++++++++ - cpack/ld.so.conf.in | 6 +----- - extensions/libjpeg_turbo/CMakeLists.txt | 5 ++--- - extensions/libtiff/CMakeLists.txt | 5 ++--- - extensions/nvbmp/CMakeLists.txt | 5 ++--- - extensions/nvjpeg/CMakeLists.txt | 5 ++--- - extensions/nvjpeg2k/CMakeLists.txt | 5 ++--- - extensions/nvpnm/CMakeLists.txt | 5 ++--- - extensions/opencv/CMakeLists.txt | 5 ++--- - src/CMakeLists.txt | 14 +------------- - 10 files changed, 29 insertions(+), 39 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5e4162b..941a033 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -114,6 +114,19 @@ propagate_option(WITH_DYNAMIC_NVJPEG2K) - - string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) - -+# Introduce variables: -+# * CMAKE_INSTALL_LIBDIR -+# * CMAKE_INSTALL_BINDIR -+# * CMAKE_INSTALL_INCLUDEDIR -+if(NOT DEFINED CMAKE_INSTALL_LIBDIR) -+ if(UNIX) -+ set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib -+ else() -+ set(CMAKE_INSTALL_LIBDIR "lib") -+ endif() -+endif() -+include(GNUInstallDirs) -+ - if(WIN32) - set(CPACK_GENERATOR "ZIP") - if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) -diff --git a/cpack/ld.so.conf.in b/cpack/ld.so.conf.in -index def1924..389dc26 100644 ---- a/cpack/ld.so.conf.in -+++ b/cpack/ld.so.conf.in -@@ -13,8 +13,4 @@ - # See the License for the specific language governing permissions and - # limitations under the License. - --if(UNIX) -- @CMAKE_INSTALL_PREFIX@/lib64 --else() -- @CMAKE_INSTALL_PREFIX@/lib --endif() -\ No newline at end of file -+@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -diff --git a/extensions/libjpeg_turbo/CMakeLists.txt b/extensions/libjpeg_turbo/CMakeLists.txt -index 6b75f9f..b157f66 100644 ---- a/extensions/libjpeg_turbo/CMakeLists.txt -+++ b/extensions/libjpeg_turbo/CMakeLists.txt -@@ -48,15 +48,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_LIBJPEG_TURBO_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/libtiff/CMakeLists.txt b/extensions/libtiff/CMakeLists.txt -index 25ecae0..092fdba 100644 ---- a/extensions/libtiff/CMakeLists.txt -+++ b/extensions/libtiff/CMakeLists.txt -@@ -47,14 +47,13 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - else() - install(TARGETS ${NVIMGCODEC_LIBTIFF_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/nvbmp/CMakeLists.txt b/extensions/nvbmp/CMakeLists.txt -index 4cf1b97..a408ce6 100644 ---- a/extensions/nvbmp/CMakeLists.txt -+++ b/extensions/nvbmp/CMakeLists.txt -@@ -44,12 +44,11 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib) - else() - install(TARGETS ${NVIMGCODEC_NVBMP_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib) - endif() -diff --git a/extensions/nvjpeg/CMakeLists.txt b/extensions/nvjpeg/CMakeLists.txt -index dc302de..f888288 100644 ---- a/extensions/nvjpeg/CMakeLists.txt -+++ b/extensions/nvjpeg/CMakeLists.txt -@@ -91,15 +91,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_NVJPEG_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/nvjpeg2k/CMakeLists.txt b/extensions/nvjpeg2k/CMakeLists.txt -index 18c99c9..8e569e0 100644 ---- a/extensions/nvjpeg2k/CMakeLists.txt -+++ b/extensions/nvjpeg2k/CMakeLists.txt -@@ -60,15 +60,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_NVJPEG2K_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/nvpnm/CMakeLists.txt b/extensions/nvpnm/CMakeLists.txt -index 4ed5134..66b1093 100644 ---- a/extensions/nvpnm/CMakeLists.txt -+++ b/extensions/nvpnm/CMakeLists.txt -@@ -43,15 +43,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_NVPNM_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/extensions/opencv/CMakeLists.txt b/extensions/opencv/CMakeLists.txt -index 36ec99f..ba956a9 100644 ---- a/extensions/opencv/CMakeLists.txt -+++ b/extensions/opencv/CMakeLists.txt -@@ -49,15 +49,14 @@ endif() - if(UNIX) - install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME}_static - LIBRARY DESTINATION extensions NAMELINK_SKIP COMPONENT lib -- ARCHIVE DESTINATION lib64 COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - - else() - install(TARGETS ${NVIMGCODEC_OPENCV_EXT_LIBRARY_NAME} - RUNTIME DESTINATION extensions COMPONENT lib -- LIBRARY DESTINATION lib COMPONENT lib -- ARCHIVE DESTINATION lib COMPONENT lib -+ LIBRARY COMPONENT lib -+ ARCHIVE COMPONENT lib - PUBLIC_HEADER DESTINATION include COMPONENT lib - ) - endif() -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 5d8aeb0..940e2a6 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -109,18 +109,6 @@ endif() - - # Installation (https://github.com/forexample/package-example) { - --# Introduce variables: --# * CMAKE_INSTALL_LIBDIR --# * CMAKE_INSTALL_BINDIR --# * CMAKE_INSTALL_INCLUDEDIR --include(GNUInstallDirs) --if(UNIX) -- set(CMAKE_INSTALL_LIBDIR "lib64") # use lib64 instead of lib --else() -- set(CMAKE_INSTALL_LIBDIR "lib") --endif() --set(CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") # adjust accordingly -- - # Layout. This works for all platforms: - # * /cmake/ - # * /lib*/ -@@ -190,4 +178,4 @@ install( - COMPONENT lib - ) - --# } -\ No newline at end of file -+# } --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch b/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch deleted file mode 100644 index 6dd936cf4061e..0000000000000 --- a/recipes/nvimgcodec/patches/0005-BLD-Make-moving-libraries-to-python-directory-option.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 561f4ca740edc3ba4605b12202edea4e0c7d023d Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 13:37:13 -0500 -Subject: [PATCH 05/10] BLD: Make moving libraries to python directory optional - ---- - CMakeLists.txt | 2 +- - python/CMakeLists.txt | 82 +++++++++++++++++++++++-------------------- - 2 files changed, 44 insertions(+), 40 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 941a033..f15b7c1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -103,7 +103,7 @@ option(BUILD_PYTHON "Build Python binding" ON) - option(BUILD_WHEEL "Build python wheel package" ON) - option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) - option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) -- -+option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) - - cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON - "BUILD_NVJPEG_EXT" OFF) -diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 0837211..39f54c7 100644 ---- a/python/CMakeLists.txt -+++ b/python/CMakeLists.txt -@@ -43,7 +43,7 @@ set(PY_NVIMGCODEC_SRCS - image_buffer_kind.cpp - code_stream.cpp - region.cpp) -- -+ - if(UNIX) - set(PY_NVIMGCODEC_IMPL_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec) - else() -@@ -66,50 +66,54 @@ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.in" DESTINATION "${CMAKE_CURRENT - file(COPY "${PROJECT_SOURCE_DIR}/Acknowledgements.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${PROJECT_SOURCE_DIR}/LICENSE.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - --add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) --add_dependencies(copy_libs_to_python_dir -- nvimgcodec -- nvbmp_ext -- nvpnm_ext) -+if(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) - --if (BUILD_NVJPEG_EXT) -- add_dependencies(copy_libs_to_python_dir nvjpeg_ext) --endif() -+ add_custom_target(copy_libs_to_python_dir ALL DEPENDS nvimgcodec_python) -+ add_dependencies(copy_libs_to_python_dir -+ nvimgcodec -+ nvbmp_ext -+ nvpnm_ext) - --if (BUILD_NVJPEG2K_EXT) -- add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) --endif() -+ if (BUILD_NVJPEG_EXT) -+ add_dependencies(copy_libs_to_python_dir nvjpeg_ext) -+ endif() - --if(BUILD_LIBJPEG_TURBO_EXT) -- add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) --endif() -+ if (BUILD_NVJPEG2K_EXT) -+ add_dependencies(copy_libs_to_python_dir nvjpeg2k_ext) -+ endif() - --if(BUILD_LIBTIFF_EXT) -- add_dependencies(copy_libs_to_python_dir libtiff_ext) --endif() -+ if(BUILD_LIBJPEG_TURBO_EXT) -+ add_dependencies(copy_libs_to_python_dir libjpeg_turbo_ext) -+ endif() - --if(BUILD_OPENCV_EXT) -- add_dependencies(copy_libs_to_python_dir opencv_ext) --endif() -+ if(BUILD_LIBTIFF_EXT) -+ add_dependencies(copy_libs_to_python_dir libtiff_ext) -+ endif() - --if(UNIX) -- add_custom_command( -- TARGET copy_libs_to_python_dir -- COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && -- cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && -- cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" -- ) --else() -- string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) -- string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) -- string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -- add_custom_command( -- TARGET copy_libs_to_python_dir -- COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -- copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -- for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && -- xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) --endif() -+ if(BUILD_OPENCV_EXT) -+ add_dependencies(copy_libs_to_python_dir opencv_ext) -+ endif() -+ -+ if(UNIX) -+ add_custom_command( -+ TARGET copy_libs_to_python_dir -+ COMMAND cp "${PROJECT_BINARY_DIR}/src/libnvimgcodec.so.0" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" && -+ cp "${PROJECT_BINARY_DIR}/extensions/*/*.so*" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec/extensions" && -+ cp -r "${PROJECT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/nvidia/nvimgcodec" -+ ) -+ else() -+ string(REGEX REPLACE "/" "\\\\" PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR}) -+ string(REGEX REPLACE "/" "\\\\" PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) -+ string(REGEX REPLACE "/" "\\\\" CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -+ add_custom_command( -+ TARGET copy_libs_to_python_dir -+ COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -+ copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && -+ for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && -+ xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) -+ endif() -+ -+endif(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR) - - if(BUILD_WHEEL) - string(REGEX REPLACE "-" "_" NVIMGCODEC_FLAVOR_UNDERSCORE "${NVIMGCODEC_FLAVOR_MINUS}") --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch b/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch deleted file mode 100644 index c40b6a47d24c4..0000000000000 --- a/recipes/nvimgcodec/patches/0006-BLD-Use-consistent-install-directory-for-cmake-confi.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 6732446c6b8bdd8d631d96b4f6a7d1763e284097 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 14:50:32 -0500 -Subject: [PATCH 06/10] BLD: Use consistent install directory for cmake configs - ---- - src/CMakeLists.txt | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 940e2a6..83fdfe6 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -113,7 +113,7 @@ endif() - # * /cmake/ - # * /lib*/ - # * /include/ --set(config_install_dir "${CMAKE_INSTALL_PREFIX}/cmake") -+set(config_install_dir "${CMAKE_INSTALL_PREFIX}/lib/cmake/nvimgcodec") - - set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") - -@@ -165,7 +165,7 @@ install( - # * /cmake/nvimgcodec/nvimgcodecConfigVersion.cmake - install( - FILES "${project_config}" "${version_config}" -- DESTINATION "cmake/nvimgcodec" -+ DESTINATION "${config_install_dir}" - COMPONENT lib - ) - -@@ -174,7 +174,7 @@ install( - install( - EXPORT "${TARGETS_EXPORT_NAME}" - NAMESPACE "${namespace}" -- DESTINATION "cmake/nvimgcodec" -+ DESTINATION "${config_install_dir}" - COMPONENT lib - ) - --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch b/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch deleted file mode 100644 index ceda92abf14c1..0000000000000 --- a/recipes/nvimgcodec/patches/0007-BLD-Let-python-versions-be-user-selectable.patch +++ /dev/null @@ -1,114 +0,0 @@ -From e93ff96907aa40b1441f6b79689415eb45f5e478 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 17:48:31 -0500 -Subject: [PATCH 07/10] BLD: Let python versions be user-selectable - ---- - cmake/Utils.cmake | 34 ++++++++++++++++++---------------- - 1 file changed, 18 insertions(+), 16 deletions(-) - -diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake -index fb8110d..f247794 100644 ---- a/cmake/Utils.cmake -+++ b/cmake/Utils.cmake -@@ -11,9 +11,9 @@ - # its affiliates is strictly prohibited. - - # this is needed because cmake caching behavior was --# preventing finding multiple packages of python -+# preventing finding multiple packages of python - # using find_package. So everytime a new python version --# needs to be found, UnsetPython needs to be called. -+# needs to be found, UnsetPython needs to be called. - function(UnsetPython) - get_cmake_property(all_variables VARIABLES) - foreach(var ${all_variables}) -@@ -65,7 +65,7 @@ function(FindPython PYVER) - message("Python version ${PYVER} not found.") - set(PYTHON_EXISTS 1 PARENT_SCOPE) - endif() --endfunction() -+endfunction() - - # Build a .so (or .pyd on windows) library variant for each python version provided in PYTHON_VERSIONS variable - # if it is accesible during the build time. The library sufix is provided and specific for each python version -@@ -87,7 +87,7 @@ endfunction() - function(build_per_python_lib) - set(oneValueArgs TARGET_NAME OUTPUT_NAME OUTPUT_DIR PREFIX) - set(multiValueArgs PRIV_LIBS PUBLIC_LIBS SRC EXCLUDE_LIBS) -- -+ - cmake_parse_arguments(PARSE_ARGV 1 PYTHON_LIB_ARG "${options}" "${oneValueArgs}" "${multiValueArgs}") - - set(PYTHON_LIB_ARG_TARGET_NAME ${ARGV0}) -@@ -106,10 +106,12 @@ function(build_per_python_lib) - target_include_directories(${PYTHON_LIB_ARG_TARGET_NAME}_private - INTERFACE "${PYBIND11_INCLUDE_DIR}" - INTERFACE "${pybind11_INCLUDE_DIR}") -- - -- set (PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") -- foreach(PYVER ${PYTHON_VERSIONS}) -+ if(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) -+ set(NVIMG_CODEC_PYTHON_VERSIONS "3.8;3.9;3.10;3.11;3.12") -+ endif(NOT DEFINED NVIMG_CODEC_PYTHON_VERSIONS) -+ -+ foreach(PYVER ${NVIMG_CODEC_PYTHON_VERSIONS}) - - set(PYTHON_LIB_TARGET_FOR_PYVER "${PYTHON_LIB_ARG_TARGET_NAME}_${PYVER}") - # check if listed python versions are accesible -@@ -136,12 +138,12 @@ function(build_per_python_lib) - else() - string(REPLACE "." "" PYVER_WIN "${PYVER}") - set(PYTHON_SUFFIX ".cp${PYVER_WIN}-win_amd64") -- -+ - set(PYTHON_INCLUDES ${Python_INCLUDE_DIRS}) -- -+ - set(PYTHON_LIBRARY ${Python_LIBRARIES}) - endif() -- -+ - # split and make it a list - string(REPLACE "-I" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") - string(REPLACE "\n" "" PYTHON_INCLUDES "${PYTHON_INCLUDES}") -@@ -170,23 +172,23 @@ function(build_per_python_lib) - # add interface dummy lib as a dependnecy to easilly propagate options we could set from the above - target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC ${PYTHON_LIB_ARG_TARGET_NAME}_public) - target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PRIVATE ${PYTHON_LIB_ARG_TARGET_NAME}_private) -- -+ - if (WIN32) - target_link_libraries(${PYTHON_LIB_TARGET_FOR_PYVER} PUBLIC "${PYTHON_LIBRARY}") - endif() -- -+ - add_dependencies(${PYTHON_LIB_ARG_TARGET_NAME} ${PYTHON_LIB_TARGET_FOR_PYVER}) - endif() - - endforeach(PYVER) -- if (WIN32) -- # Need to set back the python version which was found at -+ if (WIN32) -+ # Need to set back the python version which was found at - # the beginning of this CMakeLists - UnsetPython() - find_package(Python COMPONENTS Interpreter) - endif() - --endfunction() -+endfunction() - - - function(parse_cuda_version CUDA_VERSION CUDA_VERSION_MAJOR_VAR CUDA_VERSION_MINOR_VAR CUDA_VERSION_PATCH_VAR CUDA_VERSION_SHORT_VAR CUDA_VERSION_SHORT_DIGIT_ONLY_VAR) -@@ -284,4 +286,4 @@ function(propagate_option BUILD_OPTION_NAME) - message(STATUS "${BUILD_OPTION_NAME} -- OFF") - add_definitions(-D${DEFINE_NAME}=0) - endif() --endfunction(propagate_option) -\ No newline at end of file -+endfunction(propagate_option) --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch b/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch deleted file mode 100644 index 34bc525611267..0000000000000 --- a/recipes/nvimgcodec/patches/0008-BLD-Decouple-nvimgcodec-and-dynlink_-targets.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 1914106b92eb9c71dcc0d7b7e2e52cb4abc12cfb Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 23:22:31 -0500 -Subject: [PATCH 08/10] BLD: Decouple nvimgcodec and dynlink_* targets - ---- - CMakeLists.txt | 17 ++++------------- - src/CMakeLists.txt | 1 - - 2 files changed, 4 insertions(+), 14 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f15b7c1..dae85f6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -87,13 +87,7 @@ option(BUILD_CVCUDA_SAMPLES "Build CVCUDA samples" OFF) - option(BUILD_DOCS "Build documentation" OFF) - option(BUILD_EXTENSIONS "Build extensions modules" ON) - option(BUILD_NVJPEG_EXT "Build nvjpeg extensions module" ON) --if(BUILD_NVJPEG_EXT AND NOT BUILD_LIBRARY) -- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG_EXT is enabled. The NVJPEG extension links to libimgcodec_static.") --endif() - option(BUILD_NVJPEG2K_EXT "Build nvjpeg2k extensions module" ON) --if(BUILD_NVJPEG2K_EXT AND NOT BUILD_LIBRARY) -- message(FATAL_ERROR "BUILD_LIBRARY must be enabled if BUILD_NVJPEG2K_EXT is enabled. The NVJPEG2K extension links to libimgcodec_static.") --endif() - option(BUILD_NVBMP_EXT "Build nvbmp extensions module" ON) - option(BUILD_NVPNM_EXT "Build nvpnm extensions module" ON) - option(BUILD_LIBJPEG_TURBO_EXT "Build libjpeg-turbo extensions module" ON) -@@ -105,13 +99,6 @@ option(NVIMG_CODEC_USE_SYSTEM_DLPACK "Use system installed dlpack" OFF) - option(NVIMG_CODEC_USE_SYSTEM_PYBIND "Use system installed pybind11" OFF) - option(NVIMG_CODEC_COPY_LIBS_TO_PYTHON_DIR "Move nvimgcodec from install prefix to the python directory" ON) - --cmake_dependent_option(WITH_DYNAMIC_NVJPEG "Dynamically loads nvjpeg at runtime" ON -- "BUILD_NVJPEG_EXT" OFF) --propagate_option(WITH_DYNAMIC_NVJPEG) --cmake_dependent_option(WITH_DYNAMIC_NVJPEG2K "Dynamically loads nvjpeg2k at runtime" ON -- "BUILD_NVJPEG2K_EXT" OFF) --propagate_option(WITH_DYNAMIC_NVJPEG2K) -- - string(TOLOWER ${CMAKE_SYSTEM_NAME} SYS_NAME) - - # Introduce variables: -@@ -256,6 +243,10 @@ include(Dependencies) - - add_subdirectory(external) - -+if(BUILD_LIBRARY OR BUILD_PYTHON OR BUILD_EXTENSIONS OR BUILD_TEST) -+ add_subdirectory(src/dynlink) -+endif() -+ - if(BUILD_LIBRARY) - add_subdirectory(src) - endif() -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 83fdfe6..306ad46 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -69,7 +69,6 @@ add_library(${NVIMGCODEC_LIBRARY_NAME}_static STATIC ${NVIMGCODEC_SRCS} ${Produc - set(LIBTOPACK ${NVIMGCODEC_LIBRARY_NAME} ${NVIMGCODEC_LIBRARY_NAME}_static) - - find_package(CUDAToolkit REQUIRED) --add_subdirectory(dynlink) - - target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static dynlink_cuda) - --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch b/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch deleted file mode 100644 index 1be4b4bb55e6a..0000000000000 --- a/recipes/nvimgcodec/patches/0009-BLD-Link-system-nvimgcodec-to-python-module.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 8ef486ccb76873b65d81680fb71bc4b78f9a2274 Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Thu, 31 Oct 2024 23:23:20 -0500 -Subject: [PATCH 09/10] BLD: Link system nvimgcodec to python module - ---- - python/CMakeLists.txt | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt -index 39f54c7..f34b5c7 100644 ---- a/python/CMakeLists.txt -+++ b/python/CMakeLists.txt -@@ -16,6 +16,11 @@ - include(Utils) - include(GNUInstallDirs) - -+if(NOT TARGET nvimgcodec) -+ find_package(nvimgcodec REQUIRED) -+ add_library(nvimgcodec ALIAS nvimgcodec::nvimgcodec) -+endif() -+ - if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden") - endif() --- -2.47.0 - diff --git a/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch b/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch deleted file mode 100644 index 33e510c6603a0..0000000000000 --- a/recipes/nvimgcodec/patches/0010-BLD-Find-libclang-for-conda-forge.patch +++ /dev/null @@ -1,320 +0,0 @@ -From e5cfc92372ad75fd54c4d1ea3948130ac6fb079f Mon Sep 17 00:00:00 2001 -From: Daniel Ching -Date: Fri, 1 Nov 2024 15:27:28 -0500 -Subject: [PATCH 10/10] BLD: Find libclang for conda-forge - ---- - tools/stub_generator/stub_codegen.py | 300 ++++++++++++++------------- - 1 file changed, 155 insertions(+), 145 deletions(-) - -diff --git a/tools/stub_generator/stub_codegen.py b/tools/stub_generator/stub_codegen.py -index 0447d01..25ad4ef 100644 ---- a/tools/stub_generator/stub_codegen.py -+++ b/tools/stub_generator/stub_codegen.py -@@ -1,148 +1,158 @@ --# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --# SPDX-License-Identifier: Apache-2.0 --# --# Copyright 2020 The TensorFlow Runtime Authors --# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -+# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -+# SPDX-License-Identifier: Apache-2.0 -+# -+# Copyright 2020 The TensorFlow Runtime Authors -+# Copyright 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - # --# Licensed under the Apache License, Version 2.0 (the "License"); --# you may not use this file except in compliance with the License. --# You may obtain a copy of the License at -+# Licensed under the Apache License, Version 2.0 (the "License"); -+# you may not use this file except in compliance with the License. -+# You may obtain a copy of the License at - # --# http://www.apache.org/licenses/LICENSE-2.0 -+# http://www.apache.org/licenses/LICENSE-2.0 - # --# Unless required by applicable law or agreed to in writing, software --# distributed under the License is distributed on an "AS IS" BASIS, --# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --# See the License for the specific language governing permissions and --# limitations under the License. -- --# Lint as: python3 --"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" -- --from __future__ import absolute_import --from __future__ import print_function -- --import argparse --import re --import json --import clang.cindex --import os -- -- --def function_header(return_type, name, args): -- args_expr = [] -- for arg_type, arg_name in args: -- # handle arrays and function (or array of) pointer and reference to an array differently -- # as well -- # int[], int (*)(), int (*[])(), int (&)[5] -- match = re.search(r'\[|\)', arg_type) -- if match: -- pos = match.span()[0] -- print(arg_type[:pos]) -- args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") -- else: -- args_expr.append(f"{arg_type} {arg_name}") -- -- arg_str = ", ".join(args_expr) -- ret = f"{return_type} {name}({arg_str})" -- return ret -- -- --def main(): -- parser = argparse.ArgumentParser( -- description='Generate dynamic loading stubs for CUDA and HIP APIs.') -- parser.add_argument('--unique_prefix', default="", type=str, -- help='Unique prefix for used in the stub') -- parser.add_argument( -- 'input', nargs='?', type=argparse.FileType('r')) -- parser.add_argument( -- 'output', nargs='?', type=argparse.FileType('w')) -- parser.add_argument( -- 'header', nargs='?', type=str, default=None) -- parser.add_argument( -- 'extra_args', nargs='*', type=str, default=None) -- args = parser.parse_args() -- -- -- if os.name == 'nt': -- clang.cindex.Config.set_library_file('C:/Program Files/LLVM/bin/libclang.dll') -- config = json.load(args.input) -- -- function_impl = """ --{return_type} %s {1}NotFound({2}) {{ -- return {not_found_error}; --}} -- --{0} {{ -- using FuncPtr = {return_type} (*) ({2}); -- -- static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? -- reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : -- {1}NotFound; -- return func_ptr({3}); --}}\n""" % (config['calling_conv']) -- -- prolog = """ --void *{0}LoadSymbol(const char *name); -- --#define LOAD_SYMBOL_FUNC {0}##LoadSymbol -- --""" -- -- index = clang.cindex.Index.create() -- header = args.header -- extra_args = args.extra_args -- -- translation_unit = index.parse(header, args=extra_args) -- -- for diag in translation_unit.diagnostics: -- if diag.severity in [diag.Warning, diag.Fatal]: -- raise Exception(str(diag)) -- -- for extra_i in config['extra_include']: -- args.output.write('#include {}\n'.format(extra_i)) -- args.output.write(prolog.format(args.unique_prefix)) -- -- all_definition = set() -- all_declaration = set() -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.is_definition(): -- all_definition.add(cursor.spelling) -- -- if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: -- all_declaration.add(cursor.spelling) -- -- for cursor in translation_unit.cursor.get_children(): -- if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: -- continue -- -- function_name = cursor.spelling -- -- # make sure that we deal only with functions with no definition -- if function_name not in config['functions'] or function_name in all_definition or \ -- function_name not in all_declaration: -- continue -- -- # make sure that we deal with every function only once -- all_declaration.remove(function_name) -- -- arg_types = [arg.type.spelling for arg in cursor.get_arguments()] -- arg_names = [arg.spelling for arg in cursor.get_arguments()] -- -- return_type = config['functions'][function_name].get( -- 'return_type', config['return_type']) -- not_found_error = config['functions'][function_name].get( -- 'not_found_error', config['not_found_error']) -- -- header = function_header(return_type, function_name, zip(arg_types, arg_names)) -- -- implementation = function_impl.format(header, function_name, ', '.join(arg_types), -- ', '.join(arg_names), return_type=return_type, -- not_found_error=not_found_error) -- -- args.output.write(implementation) -- -- --if __name__ == '__main__': -- main() -+# Unless required by applicable law or agreed to in writing, software -+# distributed under the License is distributed on an "AS IS" BASIS, -+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+# See the License for the specific language governing permissions and -+# limitations under the License. -+ -+# Lint as: python3 -+"""Generates dynamic loading stubs for functions in CUDA and HIP APIs.""" -+ -+from __future__ import absolute_import -+from __future__ import print_function -+ -+import argparse -+import re -+import json -+import clang.cindex -+import os -+ -+ -+def function_header(return_type, name, args): -+ args_expr = [] -+ for arg_type, arg_name in args: -+ # handle arrays and function (or array of) pointer and reference to an array differently -+ # as well -+ # int[], int (*)(), int (*[])(), int (&)[5] -+ match = re.search(r'\[|\)', arg_type) -+ if match: -+ pos = match.span()[0] -+ print(arg_type[:pos]) -+ args_expr.append(f"{arg_type[:pos]} {arg_name}{arg_type[pos:]}") -+ else: -+ args_expr.append(f"{arg_type} {arg_name}") -+ -+ arg_str = ", ".join(args_expr) -+ ret = f"{return_type} {name}({arg_str})" -+ return ret -+ -+ -+def main(): -+ parser = argparse.ArgumentParser( -+ description='Generate dynamic loading stubs for CUDA and HIP APIs.') -+ parser.add_argument('--unique_prefix', default="", type=str, -+ help='Unique prefix for used in the stub') -+ parser.add_argument( -+ 'input', nargs='?', type=argparse.FileType('r')) -+ parser.add_argument( -+ 'output', nargs='?', type=argparse.FileType('w')) -+ parser.add_argument( -+ 'header', nargs='?', type=str, default=None) -+ parser.add_argument( -+ 'extra_args', nargs='*', type=str, default=None) -+ args = parser.parse_args() -+ -+ -+ if os.name == 'nt': -+ for libclang_file in [ -+ 'C:/Program Files/LLVM/bin/libclang.dll', -+ os.path.join(os.environ['BUILD_PREFIX'], 'Library/bin/libclang-13.dll'), -+ os.path.join(os.environ['PREFIX'], 'Library/bin/libclang-13.dll'), -+ os.path.join(os.environ['CONDA_PREFIX'], 'Library/bin/libclang-13.dll'), -+ ]: -+ libclang_file = os.path.abspath(libclang_file) -+ if os.path.isfile(libclang_file): -+ print(f"Found libclang at {libclang_file}") -+ clang.cindex.Config.set_library_file(libclang_file) -+ break -+ config = json.load(args.input) -+ -+ function_impl = """ -+{return_type} %s {1}NotFound({2}) {{ -+ return {not_found_error}; -+}} -+ -+{0} {{ -+ using FuncPtr = {return_type} (*) ({2}); -+ -+ static auto func_ptr = reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) ? -+ reinterpret_cast(LOAD_SYMBOL_FUNC("{1}")) : -+ {1}NotFound; -+ return func_ptr({3}); -+}}\n""" % (config['calling_conv']) -+ -+ prolog = """ -+void *{0}LoadSymbol(const char *name); -+ -+#define LOAD_SYMBOL_FUNC {0}##LoadSymbol -+ -+""" -+ -+ index = clang.cindex.Index.create() -+ header = args.header -+ extra_args = args.extra_args -+ -+ translation_unit = index.parse(header, args=extra_args) -+ -+ for diag in translation_unit.diagnostics: -+ if diag.severity in [diag.Warning, diag.Fatal]: -+ raise Exception(str(diag)) -+ -+ for extra_i in config['extra_include']: -+ args.output.write('#include {}\n'.format(extra_i)) -+ args.output.write(prolog.format(args.unique_prefix)) -+ -+ all_definition = set() -+ all_declaration = set() -+ -+ for cursor in translation_unit.cursor.get_children(): -+ if cursor.is_definition(): -+ all_definition.add(cursor.spelling) -+ -+ if cursor.kind == clang.cindex.CursorKind.FUNCTION_DECL: -+ all_declaration.add(cursor.spelling) -+ -+ for cursor in translation_unit.cursor.get_children(): -+ if cursor.kind != clang.cindex.CursorKind.FUNCTION_DECL: -+ continue -+ -+ function_name = cursor.spelling -+ -+ # make sure that we deal only with functions with no definition -+ if function_name not in config['functions'] or function_name in all_definition or \ -+ function_name not in all_declaration: -+ continue -+ -+ # make sure that we deal with every function only once -+ all_declaration.remove(function_name) -+ -+ arg_types = [arg.type.spelling for arg in cursor.get_arguments()] -+ arg_names = [arg.spelling for arg in cursor.get_arguments()] -+ -+ return_type = config['functions'][function_name].get( -+ 'return_type', config['return_type']) -+ not_found_error = config['functions'][function_name].get( -+ 'not_found_error', config['not_found_error']) -+ -+ header = function_header(return_type, function_name, zip(arg_types, arg_names)) -+ -+ implementation = function_impl.format(header, function_name, ', '.join(arg_types), -+ ', '.join(arg_names), return_type=return_type, -+ not_found_error=not_found_error) -+ -+ args.output.write(implementation) -+ -+ -+if __name__ == '__main__': -+ main() --- -2.47.0 - From bdb02da8e0360dbd9b6bc9b3dd85ff6f88599cbe Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 4 Feb 2025 14:29:43 -0600 Subject: [PATCH 13/14] BLD: Fixup dynamic linking --- recipes/libnvimgcodec/build.sh | 6 +- recipes/libnvimgcodec/meta.yaml | 31 ++- ...amic-shared-library-links-to-CUDA-ta.patch | 184 ++++++++++++++++++ 3 files changed, 208 insertions(+), 13 deletions(-) create mode 100644 recipes/libnvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch diff --git a/recipes/libnvimgcodec/build.sh b/recipes/libnvimgcodec/build.sh index 70adab24f39f8..7c9e6f2e68475 100644 --- a/recipes/libnvimgcodec/build.sh +++ b/recipes/libnvimgcodec/build.sh @@ -29,8 +29,8 @@ nvimg_build_args=( -DBUILD_LIBRARY:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -# "DYNAMIC_LINK" means using dlopen, but we want to link to shared libraries? - -DWITH_DYNAMIC_LINK:BOOL=ON +# "DYNAMIC_LINK" means using dlopen, but we want to link to shared libraries. + -DWITH_DYNAMIC_LINK:BOOL=OFF # Extension args -DBUILD_EXTENSIONS:BOOL=ON -DBUILD_LIBJPEG_TURBO_EXT:BOOL=ON @@ -39,7 +39,7 @@ nvimg_build_args=( -DBUILD_NVJPEG_EXT:BOOL=ON -DBUILD_NVJPEG2K_EXT:BOOL=ON -DBUILD_NVPNM_EXT:BOOL=ON - -DBUILD_NVTIFF_EXT:BOOL=OFF + -DBUILD_NVTIFF_EXT:BOOL=ON -DBUILD_OPENCV_EXT:BOOL=ON # Python args -DPython_EXECUTABLE=$PYTHON diff --git a/recipes/libnvimgcodec/meta.yaml b/recipes/libnvimgcodec/meta.yaml index ad75abdd4b2a5..09da2bdb6dee7 100644 --- a/recipes/libnvimgcodec/meta.yaml +++ b/recipes/libnvimgcodec/meta.yaml @@ -23,6 +23,7 @@ source: url: https://github.com/NVIDIA/nvImageCodec/archive/refs/tags/v{{ version }}.tar.gz sha256: 4bba949d6cf4e88fcd6b2d86bff960c9ed68eb25b6c4dde3b7772615480ab9fb patches: + - patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch - patches/001-move-config.patch build: number: 0 @@ -36,20 +37,21 @@ requirements: - {{ compiler('cxx') }} - {{ stdlib('c') }} # Must use 3.18 because of changes in find_package(TIFF) - @carterbox Jan 2025 - - cmake 3.18.* + - cmake 3.18.* # [win] + - cmake # [not win] - ninja - pkg-config - - python-clang host: - cuda-version {{ cuda_compiler_version }} - libboost-headers - libjpeg-turbo -{% if cuda_major == 12 %} + {% if cuda_major == 12 %} + - cuda-driver-dev # [linux] + - cuda-cudart-dev - libnvjpeg-dev - libnvjpeg2k-dev - # nvTIFF package not published on conda-forge yet - @carterbox Jan 2025 - - libnvtiff-dev # [not win] -{% endif %} + - libnvtiff-dev + {% endif %} - libopencv - libtiff - nvtx-c @@ -98,9 +100,9 @@ outputs: - {{ stdlib('c') }} # [build_platform == target_platform] - cmake # [build_platform == target_platform] - ninja # [build_platform == target_platform] -{% if cuda_major == 12 %} + {% if cuda_major == 12 %} - cuda-cudart-dev # [build_platform == target_platform] -{% endif %} + {% endif %} commands: - test -f ${PREFIX}/include/nvimgcodec.h # [linux] - if not exist %LIBRARY_INC%\\nvimgcodec.h exit 1 # [win] @@ -119,6 +121,9 @@ outputs: - extensions/*.so.* # [linux] - Library/bin/nvimgcodec_{{ somajor }}.dll # [win] - Library/extensions/*.dll # [win] + build: + ignore_run_exports_from: + - {{ compiler('cuda') }} requirements: build: - {{ compiler('c') }} @@ -128,11 +133,17 @@ outputs: host: - cuda-version {{ cuda_compiler_version }} - libjpeg-turbo -{% if cuda_major == 12 %} + {% if cuda_major == 12 %} + - cuda-driver-dev # [linux] + - cuda-cudart-dev - libnvjpeg-dev -{% endif %} + - libnvjpeg2k-dev + - libnvtiff-dev + {% endif %} - libopencv - libtiff + run: + - {{ pin_compatible('cuda-version', min_pin='x', max_pin='x') }} test: commands: - test -f ${PREFIX}/lib/libnvimgcodec.so.{{ somajor }} # [linux] diff --git a/recipes/libnvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch b/recipes/libnvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch new file mode 100644 index 0000000000000..57d4ef5ade3fd --- /dev/null +++ b/recipes/libnvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch @@ -0,0 +1,184 @@ +From 3698c130d4ca7ebd83343c051f7ebfbbf6feb7dc Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 4 Feb 2025 13:06:52 -0600 +Subject: [PATCH 2/2] BLD: Use only dynamic (shared library) links to CUDA + targets + +--- + cmake/Dependencies.cmake | 6 +++--- + extensions/nvjpeg/CMakeLists.txt | 6 +++--- + extensions/nvjpeg2k/CMakeLists.txt | 2 +- + extensions/nvtiff/CMakeLists.txt | 4 ++-- + python/CMakeLists.txt | 8 ++++---- + src/CMakeLists.txt | 2 +- + test/CMakeLists.txt | 6 +++--- + 7 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 2f3881b..7592026 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -48,7 +48,7 @@ include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/external/dlpack/include) + # Linking with static nvjpeg2k until there is a python package for it + if (BUILD_NVJPEG2K_EXT) + if (NOT WITH_DYNAMIC_NVJPEG2K) +- CUDA_find_library(NVJPEG2K_LIBRARY nvjpeg2k_static) ++ CUDA_find_library(NVJPEG2K_LIBRARY nvjpeg2k) + if (${NVJPEG2K_LIBRARY} STREQUAL "NVJPEG2K_LIBRARY-NOTFOUND") + message(WARNING "nvjpeg2k not found - disabled") + set(BUILD_NVJPEG2K_EXT OFF CACHE BOOL INTERNAL) +@@ -93,7 +93,7 @@ if (BUILD_NVTIFF_EXT) + FetchContent_Declare( + nvtiff_headers + URL https://developer.download.nvidia.com/compute/nvtiff/redist/libnvtiff/linux-x86_64/libnvtiff-linux-x86_64-0.4.0.62_cuda12-archive.tar.xz +- URL_HASH SHA512=3084976ec3ace4f08f8ef98d9c4ade89162501ead16e06b201a601e0f1fd82842469b7dec76aecc20b4847a689c9177ce97870eb8a31fb672089a27dfb2fce04 ++ URL_HASH SHA512=3084976ec3ace4f08f8ef98d9c4ade89162501ead16e06b201a601e0f1fd82842469b7dec76aecc20b4847a689c9177ce97870eb8a31fb672089a27dfb2fce04 + ) + FetchContent_Populate(nvtiff_headers) + set(nvtiff_SEARCH_PATH "${nvtiff_headers_SOURCE_DIR}/include") +@@ -105,7 +105,7 @@ if (BUILD_NVTIFF_EXT) + ${nvtiff_SEARCH_PATH} + ) + else() +- find_library(NVTIFF_LIB nvtiff_static PATH_SUFFIXES lib lib64) ++ find_library(NVTIFF_LIB nvtiff PATH_SUFFIXES lib lib64) + if(NOT NVTIFF_LIB) + message(WARNING, "nvTIFF library not found. Disabling its extensions and tests build.") + set(BUILD_NVTIFF_EXT OFF CACHE BOOL INTERNAL) +diff --git a/extensions/nvjpeg/CMakeLists.txt b/extensions/nvjpeg/CMakeLists.txt +index d1b90b7..5162700 100644 +--- a/extensions/nvjpeg/CMakeLists.txt ++++ b/extensions/nvjpeg/CMakeLists.txt +@@ -66,14 +66,14 @@ endif() + if(NOT WITH_DYNAMIC_NVJPEG) + if(UNIX) + target_link_libraries(${EXT_LIBRARY_NAME} +- PUBLIC CUDA::cudart_static CUDA::nvjpeg_static CUDA::culibos) ++ PUBLIC CUDA::cudart CUDA::nvjpeg CUDA::culibos) + else() + target_link_libraries(${EXT_LIBRARY_NAME} +- PUBLIC CUDA::cudart_static CUDA::nvjpeg) ++ PUBLIC CUDA::cudart CUDA::nvjpeg) + endif() + else() + target_link_libraries(${EXT_LIBRARY_NAME} +- PRIVATE CUDA::cudart_static dynlink_nvjpeg) ++ PRIVATE CUDA::cudart dynlink_nvjpeg) + target_link_libraries(${EXT_LIBRARY_NAME} + PRIVATE "-Wl,--exclude-libs,$") + endif() +diff --git a/extensions/nvjpeg2k/CMakeLists.txt b/extensions/nvjpeg2k/CMakeLists.txt +index a231c58..4e82e15 100644 +--- a/extensions/nvjpeg2k/CMakeLists.txt ++++ b/extensions/nvjpeg2k/CMakeLists.txt +@@ -45,7 +45,7 @@ else() + endif() + + target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC +- CUDA::cudart_static) ++ CUDA::cudart) + + if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL") +diff --git a/extensions/nvtiff/CMakeLists.txt b/extensions/nvtiff/CMakeLists.txt +index cd4d353..0d36c53 100644 +--- a/extensions/nvtiff/CMakeLists.txt ++++ b/extensions/nvtiff/CMakeLists.txt +@@ -40,7 +40,7 @@ endif() + + if(NOT WITH_DYNAMIC_NVJPEG) + if(UNIX) +- target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::nvjpeg_static CUDA::culibos) ++ target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::nvjpeg CUDA::culibos) + else() + target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::nvjpeg) + endif() +@@ -49,7 +49,7 @@ else() + target_link_libraries(${EXT_LIBRARY_NAME} PRIVATE "-Wl,--exclude-libs,$") + endif() + +-target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::cudart_static) ++target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::cudart) + + if (UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL") +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 7f5925f..f037ae5 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -69,7 +69,7 @@ build_per_python_lib(nvimgcodec_python + OUTPUT_NAME nvimgcodec_impl + OUTPUT_DIR ${PY_NVIMGCODEC_IMPL_OUTPUT_DIR} + PUBLIC_LIBS nvimgcodec +- PRIV_LIBS CUDA::cudart_static ${CUDA_DRIVER_LIB} $ ++ PRIV_LIBS CUDA::cudart ${CUDA_DRIVER_LIB} $ + SRC ${PY_NVIMGCODEC_SRCS}) + + # Setup wheel depependencies +@@ -89,8 +89,8 @@ else() + set(EXTRAS_REQUIRE "{ + 'nvjpeg': [ 'nvidia-nvjpeg-cu${CUDA_VERSION_MAJOR}'], + 'nvjpeg2k': [ 'nvidia-nvjpeg2k-cu${CUDA_VERSION_MAJOR}'], +- 'nvtiff': [ +- 'nvidia-nvtiff-cu${CUDA_VERSION_MAJOR}', ++ 'nvtiff': [ ++ 'nvidia-nvtiff-cu${CUDA_VERSION_MAJOR}', + 'nvidia-nvcomp-cu${CUDA_VERSION_MAJOR}' + ], + 'all': [ +@@ -161,7 +161,7 @@ if(NVIMGCODEC_COPY_LIBS_TO_PYTHON_DIR) + add_custom_command( + TARGET copy_libs_to_python_dir + COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && +- copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && ++ copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && + for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && + xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) + endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9558804..5f7c3ec 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -76,7 +76,7 @@ else() + set(CUDA_DRIVER_LIB CUDA::cuda_driver) + endif() + +-target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static ${CUDA_DRIVER_LIB}) ++target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart ${CUDA_DRIVER_LIB}) + + if(UNIX) + # CXX flags +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 5f0de3b..6cc9f74 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -122,7 +122,7 @@ foreach(testapp nvimgcodec_tests) + if (WITH_DYNAMIC_NVJPEG) + list(APPEND TARGET_LIBS dynlink_nvjpeg) + else() +- list(APPEND TARGET_LIBS CUDA::nvjpeg_static) ++ list(APPEND TARGET_LIBS CUDA::nvjpeg) + endif() + + if (BUILD_NVJPEG2K_EXT) +@@ -144,7 +144,7 @@ foreach(testapp nvimgcodec_tests) + list(APPEND TARGET_LIBS libtiff_ext_static) + #TODO On Windows linking with OpenCV_LIBRARIES already takes tiff library + if (NOT WIN32) +- list(APPEND TARGET_LIBS ${TIFF_LIBRARY}) ++ list(APPEND TARGET_LIBS ${TIFF_LIBRARIES}) + endif() + list(APPEND TARGET_LIBS ${JPEG_LIBRARY}) + list(APPEND TARGET_LIBS ${ZLIB_LIBRARY}) +@@ -175,7 +175,7 @@ foreach(testapp nvimgcodec_tests) + target_link_libraries(${testapp} PUBLIC + ${TARGET_LIBS} + ${OpenCV_LIBRARIES} +- CUDA::cudart_static ++ CUDA::cudart + CUDA::cuda_driver + gtest + gmock +-- +2.34.1 + From b0fdb43f1857c5424b3cf6abbf11d6ff409cf034 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Tue, 4 Feb 2025 17:16:25 -0600 Subject: [PATCH 14/14] BLD: Add dynamic linking patch to python recipe --- recipes/nvimgcodec/meta.yaml | 1 + ...amic-shared-library-links-to-CUDA-ta.patch | 184 ++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 recipes/nvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch diff --git a/recipes/nvimgcodec/meta.yaml b/recipes/nvimgcodec/meta.yaml index f1228f61bb1f0..4770c7592cd49 100644 --- a/recipes/nvimgcodec/meta.yaml +++ b/recipes/nvimgcodec/meta.yaml @@ -23,6 +23,7 @@ source: sha256: 4bba949d6cf4e88fcd6b2d86bff960c9ed68eb25b6c4dde3b7772615480ab9fb patches: - patches/0001-missing-static-target.patch + - patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch build: number: 0 diff --git a/recipes/nvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch b/recipes/nvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch new file mode 100644 index 0000000000000..57d4ef5ade3fd --- /dev/null +++ b/recipes/nvimgcodec/patches/0002-BLD-Use-only-dynamic-shared-library-links-to-CUDA-ta.patch @@ -0,0 +1,184 @@ +From 3698c130d4ca7ebd83343c051f7ebfbbf6feb7dc Mon Sep 17 00:00:00 2001 +From: Daniel Ching +Date: Tue, 4 Feb 2025 13:06:52 -0600 +Subject: [PATCH 2/2] BLD: Use only dynamic (shared library) links to CUDA + targets + +--- + cmake/Dependencies.cmake | 6 +++--- + extensions/nvjpeg/CMakeLists.txt | 6 +++--- + extensions/nvjpeg2k/CMakeLists.txt | 2 +- + extensions/nvtiff/CMakeLists.txt | 4 ++-- + python/CMakeLists.txt | 8 ++++---- + src/CMakeLists.txt | 2 +- + test/CMakeLists.txt | 6 +++--- + 7 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 2f3881b..7592026 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -48,7 +48,7 @@ include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/external/dlpack/include) + # Linking with static nvjpeg2k until there is a python package for it + if (BUILD_NVJPEG2K_EXT) + if (NOT WITH_DYNAMIC_NVJPEG2K) +- CUDA_find_library(NVJPEG2K_LIBRARY nvjpeg2k_static) ++ CUDA_find_library(NVJPEG2K_LIBRARY nvjpeg2k) + if (${NVJPEG2K_LIBRARY} STREQUAL "NVJPEG2K_LIBRARY-NOTFOUND") + message(WARNING "nvjpeg2k not found - disabled") + set(BUILD_NVJPEG2K_EXT OFF CACHE BOOL INTERNAL) +@@ -93,7 +93,7 @@ if (BUILD_NVTIFF_EXT) + FetchContent_Declare( + nvtiff_headers + URL https://developer.download.nvidia.com/compute/nvtiff/redist/libnvtiff/linux-x86_64/libnvtiff-linux-x86_64-0.4.0.62_cuda12-archive.tar.xz +- URL_HASH SHA512=3084976ec3ace4f08f8ef98d9c4ade89162501ead16e06b201a601e0f1fd82842469b7dec76aecc20b4847a689c9177ce97870eb8a31fb672089a27dfb2fce04 ++ URL_HASH SHA512=3084976ec3ace4f08f8ef98d9c4ade89162501ead16e06b201a601e0f1fd82842469b7dec76aecc20b4847a689c9177ce97870eb8a31fb672089a27dfb2fce04 + ) + FetchContent_Populate(nvtiff_headers) + set(nvtiff_SEARCH_PATH "${nvtiff_headers_SOURCE_DIR}/include") +@@ -105,7 +105,7 @@ if (BUILD_NVTIFF_EXT) + ${nvtiff_SEARCH_PATH} + ) + else() +- find_library(NVTIFF_LIB nvtiff_static PATH_SUFFIXES lib lib64) ++ find_library(NVTIFF_LIB nvtiff PATH_SUFFIXES lib lib64) + if(NOT NVTIFF_LIB) + message(WARNING, "nvTIFF library not found. Disabling its extensions and tests build.") + set(BUILD_NVTIFF_EXT OFF CACHE BOOL INTERNAL) +diff --git a/extensions/nvjpeg/CMakeLists.txt b/extensions/nvjpeg/CMakeLists.txt +index d1b90b7..5162700 100644 +--- a/extensions/nvjpeg/CMakeLists.txt ++++ b/extensions/nvjpeg/CMakeLists.txt +@@ -66,14 +66,14 @@ endif() + if(NOT WITH_DYNAMIC_NVJPEG) + if(UNIX) + target_link_libraries(${EXT_LIBRARY_NAME} +- PUBLIC CUDA::cudart_static CUDA::nvjpeg_static CUDA::culibos) ++ PUBLIC CUDA::cudart CUDA::nvjpeg CUDA::culibos) + else() + target_link_libraries(${EXT_LIBRARY_NAME} +- PUBLIC CUDA::cudart_static CUDA::nvjpeg) ++ PUBLIC CUDA::cudart CUDA::nvjpeg) + endif() + else() + target_link_libraries(${EXT_LIBRARY_NAME} +- PRIVATE CUDA::cudart_static dynlink_nvjpeg) ++ PRIVATE CUDA::cudart dynlink_nvjpeg) + target_link_libraries(${EXT_LIBRARY_NAME} + PRIVATE "-Wl,--exclude-libs,$") + endif() +diff --git a/extensions/nvjpeg2k/CMakeLists.txt b/extensions/nvjpeg2k/CMakeLists.txt +index a231c58..4e82e15 100644 +--- a/extensions/nvjpeg2k/CMakeLists.txt ++++ b/extensions/nvjpeg2k/CMakeLists.txt +@@ -45,7 +45,7 @@ else() + endif() + + target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC +- CUDA::cudart_static) ++ CUDA::cudart) + + if(UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL") +diff --git a/extensions/nvtiff/CMakeLists.txt b/extensions/nvtiff/CMakeLists.txt +index cd4d353..0d36c53 100644 +--- a/extensions/nvtiff/CMakeLists.txt ++++ b/extensions/nvtiff/CMakeLists.txt +@@ -40,7 +40,7 @@ endif() + + if(NOT WITH_DYNAMIC_NVJPEG) + if(UNIX) +- target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::nvjpeg_static CUDA::culibos) ++ target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::nvjpeg CUDA::culibos) + else() + target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::nvjpeg) + endif() +@@ -49,7 +49,7 @@ else() + target_link_libraries(${EXT_LIBRARY_NAME} PRIVATE "-Wl,--exclude-libs,$") + endif() + +-target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::cudart_static) ++target_link_libraries(${EXT_LIBRARY_NAME} PUBLIC CUDA::cudart) + + if (UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fvisibility=hidden -Wl,--exclude-libs,ALL") +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index 7f5925f..f037ae5 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -69,7 +69,7 @@ build_per_python_lib(nvimgcodec_python + OUTPUT_NAME nvimgcodec_impl + OUTPUT_DIR ${PY_NVIMGCODEC_IMPL_OUTPUT_DIR} + PUBLIC_LIBS nvimgcodec +- PRIV_LIBS CUDA::cudart_static ${CUDA_DRIVER_LIB} $ ++ PRIV_LIBS CUDA::cudart ${CUDA_DRIVER_LIB} $ + SRC ${PY_NVIMGCODEC_SRCS}) + + # Setup wheel depependencies +@@ -89,8 +89,8 @@ else() + set(EXTRAS_REQUIRE "{ + 'nvjpeg': [ 'nvidia-nvjpeg-cu${CUDA_VERSION_MAJOR}'], + 'nvjpeg2k': [ 'nvidia-nvjpeg2k-cu${CUDA_VERSION_MAJOR}'], +- 'nvtiff': [ +- 'nvidia-nvtiff-cu${CUDA_VERSION_MAJOR}', ++ 'nvtiff': [ ++ 'nvidia-nvtiff-cu${CUDA_VERSION_MAJOR}', + 'nvidia-nvcomp-cu${CUDA_VERSION_MAJOR}' + ], + 'all': [ +@@ -161,7 +161,7 @@ if(NVIMGCODEC_COPY_LIBS_TO_PYTHON_DIR) + add_custom_command( + TARGET copy_libs_to_python_dir + COMMAND copy "${PROJECT_BINARY_DIR}\\src\\${CMAKE_BUILD_TYPE}\\nvimgcodec_0.dll" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && +- copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && ++ copy "${PROJECT_BINARY_DIR}\\python\\${CMAKE_BUILD_TYPE}\\*.pyd" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec" && + for /r "${PROJECT_BINARY_DIR}\\extensions" %%f in \(*.dll\) do xcopy "%%f" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\extensions\\" /Y && + xcopy "${PROJECT_SOURCE_DIR}\\include\\*.*" "${CMAKE_CURRENT_BINARY_DIR}\\nvidia\\nvimgcodec\\include\\" /S /Y ) + endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9558804..5f7c3ec 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -76,7 +76,7 @@ else() + set(CUDA_DRIVER_LIB CUDA::cuda_driver) + endif() + +-target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart_static ${CUDA_DRIVER_LIB}) ++target_link_libraries(${NVIMGCODEC_LIBRARY_NAME} PRIVATE CUDA::cudart ${CUDA_DRIVER_LIB}) + + if(UNIX) + # CXX flags +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 5f0de3b..6cc9f74 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -122,7 +122,7 @@ foreach(testapp nvimgcodec_tests) + if (WITH_DYNAMIC_NVJPEG) + list(APPEND TARGET_LIBS dynlink_nvjpeg) + else() +- list(APPEND TARGET_LIBS CUDA::nvjpeg_static) ++ list(APPEND TARGET_LIBS CUDA::nvjpeg) + endif() + + if (BUILD_NVJPEG2K_EXT) +@@ -144,7 +144,7 @@ foreach(testapp nvimgcodec_tests) + list(APPEND TARGET_LIBS libtiff_ext_static) + #TODO On Windows linking with OpenCV_LIBRARIES already takes tiff library + if (NOT WIN32) +- list(APPEND TARGET_LIBS ${TIFF_LIBRARY}) ++ list(APPEND TARGET_LIBS ${TIFF_LIBRARIES}) + endif() + list(APPEND TARGET_LIBS ${JPEG_LIBRARY}) + list(APPEND TARGET_LIBS ${ZLIB_LIBRARY}) +@@ -175,7 +175,7 @@ foreach(testapp nvimgcodec_tests) + target_link_libraries(${testapp} PUBLIC + ${TARGET_LIBS} + ${OpenCV_LIBRARIES} +- CUDA::cudart_static ++ CUDA::cudart + CUDA::cuda_driver + gtest + gmock +-- +2.34.1 +