Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libraries to link with Tajo #282

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,40 @@ message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")

message(STATUS "Building for SAI Spec ${SAI_VER_MAJOR}.${SAI_VER_MINOR}.${SAI_VER_RELEASE}")

if(SAI_TAJO_IMPL)
list(APPEND CMAKE_LIBRARY_PATH /usr/lib64 /opt/grpc/lib /opt/sdk_build/klish/.libs)

# Find libnl-3 and libnl-genl-3 libraries only if SAI_TAJO_IMPL is set
find_library(LIBNL3 NAMES nl-3)
find_library(LIBNL_GENL3 NAMES nl-genl-3)

# Print paths for debugging
message(STATUS "LIBNL3 found at: ${LIBNL3}")
message(STATUS "LIBNL_GENL3 found at: ${LIBNL_GENL3}")

# Check if both libraries were found; if not, show an error
if(NOT LIBNL3 OR NOT LIBNL_GENL3)
message(FATAL_ERROR "Required libnl libraries not found!")
endif()

# Locate grpc, absl_synchronization, and protobuf libraries
find_library(GRPC NAMES grpc++)
find_library(ABSL_SYNCHRONIZATION NAMES absl_synchronization)
find_library(PROTOBUF NAMES protobuf)

# Print paths for verification
message(STATUS "GRPC found at: ${GRPC}")
message(STATUS "ABSL_SYNCHRONIZATION found at: ${ABSL_SYNCHRONIZATION}")
message(STATUS "PROTOBUF found at: ${PROTOBUF}")

# Check if all required libraries are found
if(NOT GRPC OR NOT ABSL_SYNCHRONIZATION OR NOT PROTOBUF)
message(FATAL_ERROR "One or more grpc/absl/protobuf libraries were not found!")
endif()

endif()


set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake"
${CMAKE_MODULE_PATH})
Expand Down
10 changes: 10 additions & 0 deletions cmake/AgentHwSaiHwTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ function(BUILD_SAI_TEST SAI_IMPL_NAME SAI_IMPL_ARG)
${LIBGMOCK_LIBRARIES}
)

if(SAI_TAJO_IMPL)
target_link_libraries(sai_test-${SAI_IMPL_NAME}
${GRPC}
${ABSL_SYNCHRONIZATION}
${PROTOBUF}
${LIBNL3}
${LIBNL_GENL3}
)
endif()

if (SAI_BRCM_IMPL)
target_link_libraries(sai_test-${SAI_IMPL_NAME}
${YAML}
Expand Down
10 changes: 10 additions & 0 deletions cmake/AgentSaiLinkTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ function(BUILD_SAI_LINK_TEST SAI_IMPL_NAME SAI_IMPL_ARG)
${LIBGMOCK_LIBRARIES}
)

if(SAI_TAJO_IMPL)
target_link_libraries(sai_link_test-${SAI_IMPL_NAME}
${GRPC}
${ABSL_SYNCHRONIZATION}
${PROTOBUF}
${LIBNL3}
${LIBNL_GENL3}
)
endif()

set_target_properties(sai_link_test-${SAI_IMPL_NAME}
PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
Expand Down
11 changes: 11 additions & 0 deletions cmake/AgentTestAgentHwTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ function(BUILD_SAI_AGENT_HW_TEST SAI_IMPL_NAME SAI_IMPL_ARG)
-Wl,--no-whole-archive
)

if(SAI_TAJO_IMPL)
# Link libraries only under TAJO_SAI_SDK
target_link_libraries(sai_agent_hw_test-${SAI_IMPL_NAME}
${GRPC}
${ABSL_SYNCHRONIZATION}
${PROTOBUF}
${LIBNL3}
${LIBNL_GENL3}
)
endif()

set_target_properties(sai_agent_hw_test-${SAI_IMPL_NAME}
PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
Expand Down
Loading