summarylogtreecommitdiffstats
path: root/030-tensorrt-fix-python.patch
blob: 26abd6f13f2211ac26b4d9712fa13d2250471a15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -58,7 +58,7 @@ find_path(PY_CONFIG_INCLUDE pyconfig.h HINTS ${PY_INCLUDE} PATH_SUFFIXES ${PY_TA
 # -------- GLOBAL COMPILE OPTIONS --------
 
 include_directories(${TENSORRT_ROOT}/include ${PROJECT_SOURCE_DIR}/include ${CUDA_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/docstrings ${ONNX_INC_DIR} ${PYBIND11_DIR}/include)
-link_directories(${TENSORRT_BUILD})
+link_directories(${TENSORRT_BUILD} $ENV{TRT_NONOSS_ROOT}/lib)
 set(CMAKE_CXX_FLAGS "-fvisibility=hidden -std=c++${CPP_STANDARD} -Wno-deprecated-declarations")
 
 # -------- START BUILD PROCESS --------
@@ -78,6 +78,9 @@ message(STATUS "PY_CONFIG_INCLUDE: ${PY_CONFIG_INCLUDE}")
 if (${CMAKE_BUILD_TYPE} STREQUAL Release)
     message(STATUS "Building in Release mode")
     set(TRT_LIBS nvinfer nvonnxparser nvparsers nvinfer_plugin)
+elseif (${CMAKE_BUILD_TYPE} STREQUAL None OR ${CMAKE_BUILD_TYPE} STREQUAL "")
+    message(STATUS "Building with the None build type")
+    set(TRT_LIBS nvinfer nvonnxparser nvparsers nvinfer_plugin)
 else()
     message(STATUS "Building in Debug mode")
     set(TRT_LIBS nvinfer_debug nvonnxparser_debug nvparsers_debug nvinfer_plugin_debug)
--- a/python/build.sh
+++ b/python/build.sh
@@ -26,21 +26,24 @@ pushd ${WHEEL_OUTPUT_DIR}
 
 # Generate tensorrt.so
 echo $(ls ${ROOT_PATH}/python/include)
-cmake .. -DCMAKE_BUILD_TYPE=Release \
+cmake .. -DCMAKE_BUILD_TYPE=None \
          -DTARGET=${TARGET} \
          -DPYTHON_MAJOR_VERSION=${PYTHON_MAJOR_VERSION} \
          -DPYTHON_MINOR_VERSION=${PYTHON_MINOR_VERSION} \
-         -DEXT_PATH=${EXT_PATH} \
-         -DCUDA_INCLUDE_DIRS=/usr/local/cuda/include \
-         -DTENSORRT_ROOT=${ROOT_PATH} \
-         -DTENSORRT_BUILD=${ROOT_PATH}/build/
-make -j12
+         -DEXT_PATH="$EXT_PATH" \
+         -DCUDA_INCLUDE_DIRS='/opt/cuda/include' \
+         -DTENSORRT_ROOT="$ROOT_PATH" \
+         -DTENSORRT_BUILD="${ROOT_PATH}/build/" \
+         -DPY_INCLUDE="/usr/include/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}" \
+         -DPY_CONFIG_INCLUDE="/usr/include/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}" \
+         -Wno-dev
+make
 
 # Generate wheel
-TRT_MAJOR=$(awk '/^\#define NV_TENSORRT_MAJOR/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
-TRT_MINOR=$(awk '/^\#define NV_TENSORRT_MINOR/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
-TRT_PATCH=$(awk '/^\#define NV_TENSORRT_PATCH/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
-TRT_BUILD=$(awk '/^\#define NV_TENSORRT_BUILD/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
+TRT_MAJOR=$(awk '/^#define NV_TENSORRT_MAJOR/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
+TRT_MINOR=$(awk '/^#define NV_TENSORRT_MINOR/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
+TRT_PATCH=$(awk '/^#define NV_TENSORRT_PATCH/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
+TRT_BUILD=$(awk '/^#define NV_TENSORRT_BUILD/ {print $3}' ${ROOT_PATH}/include/NvInferVersion.h)
 TRT_VERSION=${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}.${TRT_BUILD}
 TRT_MAJMINPATCH=${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}
 
@@ -48,8 +51,8 @@ echo "Generating python ${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION} bindings
 
 expand_vars_cp () {
     test -f ${1} || (echo "ERROR: File: ${1} does not exist!" && exit 1); \
-    sed -e "s|\#\#TENSORRT_VERSION\#\#|${TRT_VERSION}|g" \
-        -e "s|\#\#TENSORRT_MAJMINPATCH\#\#|${TRT_MAJMINPATCH}|g" \
+    sed -e "s|##TENSORRT_VERSION##|${TRT_VERSION}|g" \
+        -e "s|##TENSORRT_MAJMINPATCH##|${TRT_MAJMINPATCH}|g" \
         ${1} > ${2}
 }