@@ -1,10 +1,15 @@
# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB)
# Copyright (c) 2018, Mellanox Technologies. All rights reserved. See COPYING file
-function(rdma_cython_module PY_MODULE)
+function(rdma_cython_module PY_MODULE LINKER_FLAGS)
foreach(PYX_FILE ${ARGN})
get_filename_component(FILENAME ${PYX_FILE} NAME_WE)
- set(PYX "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}.pyx")
+ get_filename_component(DIR ${PYX_FILE} DIRECTORY)
+ if (DIR)
+ set(PYX "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/${FILENAME}.pyx")
+ else()
+ set(PYX "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}.pyx")
+ endif()
set(CFILE "${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}.c")
include_directories(${PYTHON_INCLUDE_DIRS})
add_custom_command(
@@ -20,7 +25,7 @@ function(rdma_cython_module PY_MODULE)
COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -fno-strict-aliasing -Wno-unused-function -Wno-redundant-decls -Wno-shadow -Wno-cast-function-type -Wno-implicit-fallthrough -Wno-unknown-warning -Wno-unknown-warning-option ${NO_VAR_TRACKING_FLAGS}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_PYTHON}/${PY_MODULE}"
PREFIX "")
- target_link_libraries(${SONAME} LINK_PRIVATE ${PYTHON_LIBRARIES} ibverbs)
+ target_link_libraries(${SONAME} LINK_PRIVATE ${PYTHON_LIBRARIES} ibverbs ${LINKER_FLAGS})
install(TARGETS ${SONAME}
DESTINATION ${CMAKE_INSTALL_PYTHON_ARCH_LIB}/${PY_MODULE})
endforeach()
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB)
# Copyright (c) 2019, Mellanox Technologies. All rights reserved. See COPYING file
-rdma_cython_module(pyverbs
+rdma_cython_module(pyverbs ""
addr.pyx
base.pyx
cq.pyx
@@ -20,3 +20,8 @@ rdma_python_module(pyverbs
pyverbs_error.py
utils.py
)
+
+# mlx5 provider is not built without coherent DMA, e.g. ARM32 build.
+if (HAVE_COHERENT_DMA)
+add_subdirectory(providers/mlx5)
+endif()
new file mode 100644
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB)
+# Copyright (c) 2019, Mellanox Technologies. All rights reserved. See COPYING file
+
+rdma_cython_module(pyverbs/providers/mlx5 mlx5
+ mlx5dv.pyx
+)
Adapt the building function to support subdirectories under pyverbs. Add the needed CMakeLists file to pyverbs/providers. Update pyverbs' CMakeLists to include the providers sub directory. Signed-off-by: Noa Osherovich <noaos@mellanox.com> --- buildlib/pyverbs_functions.cmake | 11 ++++++++--- pyverbs/CMakeLists.txt | 7 ++++++- pyverbs/providers/mlx5/CMakeLists.txt | 6 ++++++ 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 pyverbs/providers/mlx5/CMakeLists.txt