<commit_before>SUMMARY = "Python bindings for TensorRT"
HOMEPAGE = "http://developer.nvidia.com/tensorrt"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://python/packaging/LICENSE.txt;md5=c291e0a531e08d4914e269730ba2f70d"

DEPENDS = "python3-pybind11 tensorrt"

inherit setuptools3 cmake cuda

SRC_REPO = "github.com/NVIDIA/TensorRT.git;protocol=https"
SRCBRANCH = "master"
SRC_URI = "git://${SRC_REPO};branch=${SRCBRANCH} \
           file://0001-Fixups-for-cross-building-in-OE.patch \
           "
# 8.0.1 tag
SRCREV = "eb5de99b523c76c2f3ae997855ad86d3a1e86a31"

S = "${WORKDIR}/git"

OECMAKE_SOURCEPATH = "${S}/python"
DISTUTILS_SETUP_PATH = "${B}"

EXTRA_OECMAKE = "-DONNX_INC_DIR=${STAGING_INCDIR} -DPYBIND11_DIR=${STAGING_DIR_TARGET} \
                 -DTARGET_ARCHITECTURE=${HOST_ARCH} -DCMAKE_BUILD_TYPE=Release \
                 -DPY_INCLUDE=${STAGING_INCDIR}/${PYTHON_DIR}"

CXXFLAGS += "${CUDA_CXXFLAGS}"

do_configure() {
    cmake_do_configure
    TRT_MAJOR=$(awk '/^\#define NV_TENSORRT_MAJOR/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_MINOR=$(awk '/^\#define NV_TENSORRT_MINOR/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_PATCH=$(awk '/^\#define NV_TENSORRT_PATCH/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_BUILD=$(awk '/^\#define NV_TENSORRT_BUILD/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_VERSION=${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}.${TRT_BUILD}
    TRT_MAJMINPATCH=${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}
    varsubst() {
        sed -e "s|\#\#TENSORRT_VERSION\#\#|${TRT_VERSION}|g" \
	    -e "s|\#\#TENSORRT_MAJMINPATCH\#\#|${TRT_MAJMINPATCH}|g" $1 >$2
    }

    rm -rf ${B}/tensorrt
    mkdir ${B}/tensorrt
    varsubst ${S}/python/packaging/setup.cfg ${B}/setup.cfg
    varsubst ${S}/python/packaging/setup.py ${B}/setup.py
    varsubst ${S}/python/packaging/tensorrt/__init__.py ${B}/tensorrt/__init__.py
    cp ${S}/python/packaging/LICENSE.txt ${B}/
}

do_compile() {
    cmake_do_compile
    distutils3_do_compile
}

do_install() {
    distutils3_do_install
}

RDEPENDS:${PN} = "python3-ctypes python3-numpy"
<commit_msg>python3-tensorrt: add tensorrt-core and tensorrt-plugins in the dependency list<commit_after>SUMMARY = "Python bindings for TensorRT"
HOMEPAGE = "http://developer.nvidia.com/tensorrt"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://python/packaging/LICENSE.txt;md5=c291e0a531e08d4914e269730ba2f70d"

DEPENDS = "python3-pybind11 tensorrt-core tensorrt-plugins"

inherit setuptools3 cmake cuda

SRC_REPO = "github.com/NVIDIA/TensorRT.git;protocol=https"
SRCBRANCH = "master"
SRC_URI = "git://${SRC_REPO};branch=${SRCBRANCH} \
           file://0001-Fixups-for-cross-building-in-OE.patch \
           "
# 8.0.1 tag
SRCREV = "eb5de99b523c76c2f3ae997855ad86d3a1e86a31"

S = "${WORKDIR}/git"

OECMAKE_SOURCEPATH = "${S}/python"
DISTUTILS_SETUP_PATH = "${B}"

EXTRA_OECMAKE = "-DONNX_INC_DIR=${STAGING_INCDIR} -DPYBIND11_DIR=${STAGING_DIR_TARGET} \
                 -DTARGET_ARCHITECTURE=${HOST_ARCH} -DCMAKE_BUILD_TYPE=Release \
                 -DPY_INCLUDE=${STAGING_INCDIR}/${PYTHON_DIR}"

CXXFLAGS += "${CUDA_CXXFLAGS}"

do_configure() {
    cmake_do_configure
    TRT_MAJOR=$(awk '/^\#define NV_TENSORRT_MAJOR/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_MINOR=$(awk '/^\#define NV_TENSORRT_MINOR/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_PATCH=$(awk '/^\#define NV_TENSORRT_PATCH/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_BUILD=$(awk '/^\#define NV_TENSORRT_BUILD/ {print $3}' ${STAGING_INCDIR}/NvInferVersion.h)
    TRT_VERSION=${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}.${TRT_BUILD}
    TRT_MAJMINPATCH=${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}
    varsubst() {
        sed -e "s|\#\#TENSORRT_VERSION\#\#|${TRT_VERSION}|g" \
	    -e "s|\#\#TENSORRT_MAJMINPATCH\#\#|${TRT_MAJMINPATCH}|g" $1 >$2
    }

    rm -rf ${B}/tensorrt
    mkdir ${B}/tensorrt
    varsubst ${S}/python/packaging/setup.cfg ${B}/setup.cfg
    varsubst ${S}/python/packaging/setup.py ${B}/setup.py
    varsubst ${S}/python/packaging/tensorrt/__init__.py ${B}/tensorrt/__init__.py
    cp ${S}/python/packaging/LICENSE.txt ${B}/
}

do_compile() {
    cmake_do_compile
    distutils3_do_compile
}

do_install() {
    distutils3_do_install
}

RDEPENDS:${PN} = "python3-ctypes python3-numpy"

{'fraction_non_alphanumeric': 0.1686019507663725, 'fraction_numerical': 0.03274500696702276, 'mean_word_length': 4.377028714107365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1568900', 'n_tokens_mistral': 1924, 'n_tokens_neox': 1823, 'n_words': 217}