Skip to content

Commit

Permalink
pkg-config: Make ibverbs into a Requires.prviate
Browse files Browse the repository at this point in the history
It is a private dependency, so it is not necessary to depend on it for
shared builds, and we should use a pkg-config depenency not just a loose
library include so that (future) static linking does the right thing.

Signed-off-by: Luca Boccassi <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
bluca authored and jgunthorpe committed Sep 7, 2018
1 parent ef036b9 commit 58859b3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions buildlib/rdma_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,10 @@ function(rdma_finalize_libs)
endfunction()

# Generate a pkg-config file
function(rdma_pkg_config PC_LIB_NAME PC_LIB_PRIVATE PC_INCLUDE_PRIVATE PC_REQUIRES)
function(rdma_pkg_config PC_LIB_NAME PC_REQUIRES_PRIVATE PC_LIB_PRIVATE)
set(PC_LIB_NAME "${PC_LIB_NAME}")
set(PC_LIB_PRIVATE "${PC_LIB_PRIVATE}")
set(PC_INCLUDE_PRIVATE "${PC_INCLUDE_PRIVATE}")
set(PC_REQUIRES "${PC_REQUIRES}")
set(PC_REQUIRES_PRIVATE "${PC_REQUIRES_PRIVATE}")
get_target_property(PC_VERSION ${PC_LIB_NAME} VERSION)

# With IN_PLACE=1 the install step is not ran, so generate the file in the build dir
Expand Down
6 changes: 3 additions & 3 deletions buildlib/template.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name: lib@PC_LIB_NAME@
Description: RDMA Core Userspace Library
URL: https://github.com/linux-rdma/rdma-core
Version: @PC_VERSION@
Libs: -L${libdir} -l@PC_LIB_NAME@ @PC_RPATH@
Libs.private: @PC_LIB_PRIVATE@
Cflags: -I${includedir} @PC_INCLUDE_PRIVATE@
Requires: @PC_REQUIRES@
Libs: -L${libdir} -l@PC_LIB_NAME@ @PC_RPATH@
Requires.private: @PC_REQUIRES_PRIVATE@
Cflags: -I${includedir}
2 changes: 1 addition & 1 deletion libibumad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ rdma_library(ibumad libibumad.map
umad_str.c
)

rdma_pkg_config("ibumad" "" "" "libibverbs")
rdma_pkg_config("ibumad" "" "")
2 changes: 1 addition & 1 deletion libibverbs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ target_link_libraries(ibverbs LINK_PRIVATE
kern-abi
)

rdma_pkg_config("ibverbs" "${CMAKE_THREAD_LIBS_INIT}" "" "")
rdma_pkg_config("ibverbs" "" "${CMAKE_THREAD_LIBS_INIT}")
2 changes: 1 addition & 1 deletion librdmacm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ install(TARGETS rspreload DESTINATION "${CMAKE_INSTALL_LIBDIR}/rsocket/")
rdma_install_symlink("librspreload.so" "${CMAKE_INSTALL_LIBDIR}/rsocket/librspreload.so.1")
rdma_install_symlink("librspreload.so" "${CMAKE_INSTALL_LIBDIR}/rsocket/librspreload.so.1.0.0")

rdma_pkg_config("rdmacm" "" "" "libibverbs")
rdma_pkg_config("rdmacm" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")
2 changes: 1 addition & 1 deletion providers/mlx4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ publish_headers(infiniband

install(FILES "mlx4.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/")

rdma_pkg_config("mlx4" "${CMAKE_THREAD_LIBS_INIT}" "" "")
rdma_pkg_config("mlx4" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")
2 changes: 1 addition & 1 deletion providers/mlx5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ publish_headers(infiniband
mlx5dv.h
)

rdma_pkg_config("mlx5" "${CMAKE_THREAD_LIBS_INIT}" "" "")
rdma_pkg_config("mlx5" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")

0 comments on commit 58859b3

Please sign in to comment.