Skip to content

Commit

Permalink
Fixes ONNX parser Python bindings
Browse files Browse the repository at this point in the history
Signed-off-by: pranavm <[email protected]>
  • Loading branch information
pranavm-nvidia committed Feb 22, 2021
1 parent 13f7441 commit ff1e154
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 565 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ build/
*.nvmk
*.sln
*.vcxproj
externals/
272 changes: 0 additions & 272 deletions include/NvOnnxParser.h

This file was deleted.

2 changes: 1 addition & 1 deletion parsers/onnx
22 changes: 18 additions & 4 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,39 @@ set(PY_MODULE_NAME tensorrt)

set_ifndef(TENSORRT_ROOT ../)
# Convert to an absolute path.
set_ifndef(ONNX_INC_DIR ${TENSORRT_ROOT}/parsers/)
set_ifndef(ONNX_INC_DIR ${TENSORRT_ROOT}/parsers/onnx/)
set_ifndef(PYBIND11_DIR ${EXT_PATH}/pybind11/)

# Source Files
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)

# Find headers
find_path(PY_INCLUDE Python.h HINTS ${EXT_PATH}/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION} PATH_SUFFIXES include)
find_path(PY_INCLUDE Python.h
HINTS ${EXT_PATH}/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}
PATH_SUFFIXES include
)

set(PY_TARGET_DIR ${TARGET_ARCHITECTURE}-linux-gnu)
if (${TARGET_ARCHITECTURE} STREQUAL ppc64le)
set(PY_TARGET_DIR powerpc64le-linux-gnu)
endif()
find_path(PY_CONFIG_INCLUDE pyconfig.h HINTS ${PY_INCLUDE} PATH_SUFFIXES ${PY_TARGET_DIR}/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION})

find_path(PY_CONFIG_INCLUDE pyconfig.h
HINTS ${PY_INCLUDE}
PATH_SUFFIXES ${PY_TARGET_DIR}/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}
)

# -------- GLOBAL COMPILE OPTIONS --------

# Add include directories
include_directories(${TENSORRT_ROOT}/include ${PROJECT_SOURCE_DIR}/include ${CUDA_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/docstrings ${ONNX_INC_DIR} ${PYBIND11_DIR}/include)
include_directories(${TENSORRT_ROOT}/include
${PROJECT_SOURCE_DIR}/include
${CUDA_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/docstrings
${ONNX_INC_DIR}
${PYBIND11_DIR}/include
)

# And lib directories.
link_directories(${TENSORRT_BUILD})
# Enable link-time optimizations
Expand Down
Loading

0 comments on commit ff1e154

Please sign in to comment.