[PATCH rdma-core 3/4] pyverbs: Add providers to cmake build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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

diff --git a/buildlib/pyverbs_functions.cmake b/buildlib/pyverbs_functions.cmake
index 8ea5dc0df7de..4c255054fe94 100644
--- a/buildlib/pyverbs_functions.cmake
+++ b/buildlib/pyverbs_functions.cmake
@@ -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()
diff --git a/pyverbs/CMakeLists.txt b/pyverbs/CMakeLists.txt
index 90293982b280..7bbb5fc841c0 100755
--- a/pyverbs/CMakeLists.txt
+++ b/pyverbs/CMakeLists.txt
@@ -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()
diff --git a/pyverbs/providers/mlx5/CMakeLists.txt b/pyverbs/providers/mlx5/CMakeLists.txt
new file mode 100644
index 000000000000..f6536de8a932
--- /dev/null
+++ b/pyverbs/providers/mlx5/CMakeLists.txt
@@ -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
+)
-- 
2.21.0





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux