cyb70289 commented on code in PR #12881:
URL: https://github.com/apache/arrow/pull/12881#discussion_r851915756


##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -4513,6 +4523,83 @@ if(ARROW_S3)
   endif()
 endif()
 
+# ----------------------------------------------------------------------
+# ucx - communication framework for modern, high-bandwidth and low-latency 
networks
+
+macro(build_ucx)
+  message(STATUS "Building UCX from source")
+
+  set(UCX_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/ucx_ep-install")
+
+  # link with static ucx libraries leads to test failures, use shared libs 
instead
+  set(UCX_SHARED_LIB_UCP 
"${UCX_PREFIX}/lib/libucp${CMAKE_SHARED_LIBRARY_SUFFIX}")
+  set(UCX_SHARED_LIB_UCT 
"${UCX_PREFIX}/lib/libuct${CMAKE_SHARED_LIBRARY_SUFFIX}")
+  set(UCX_SHARED_LIB_UCS 
"${UCX_PREFIX}/lib/libucs${CMAKE_SHARED_LIBRARY_SUFFIX}")
+  set(UCX_SHARED_LIB_UCM 
"${UCX_PREFIX}/lib/libucm${CMAKE_SHARED_LIBRARY_SUFFIX}")
+
+  set(UCX_CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure)
+  list(APPEND
+       UCX_CONFIGURE_COMMAND
+       "CC=${CMAKE_C_COMPILER}"
+       "CXX=${CMAKE_CXX_COMPILER}"
+       "CFLAGS=${EP_C_FLAGS}"
+       "CXXFLAGS=${EP_CXX_FLAGS}"
+       "--prefix=${UCX_PREFIX}"
+       "--enable-mt"
+       "--enable-shared")
+  if(${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG")
+    list(APPEND
+         UCX_CONFIGURE_COMMAND
+         "--enable-profiling"
+         "--enable-frame-pointer"
+         "--enable-stats"
+         "--enable-fault-injection"
+         "--enable-debug-data")
+  else()
+    list(APPEND
+         UCX_CONFIGURE_COMMAND
+         "--disable-logging"
+         "--disable-debug"
+         "--disable-assertions"
+         "--disable-params-check")
+  endif()
+  set(UCX_BUILD_COMMAND ${MAKE} ${MAKE_BUILD_ARGS})
+  externalproject_add(ucx_ep
+                      ${EP_LOG_OPTIONS}
+                      URL ${ARROW_UCX_SOURCE_URL}
+                      URL_HASH "SHA256=${ARROW_UCX_BUILD_SHA256_CHECKSUM}"
+                      CONFIGURE_COMMAND ${UCX_CONFIGURE_COMMAND}
+                      BUILD_IN_SOURCE 1
+                      BUILD_COMMAND ${UCX_BUILD_COMMAND}
+                      BUILD_BYPRODUCTS "${UCX_SHARED_LIB_UCP}" 
"${UCX_SHARED_LIB_UCT}"
+                                       "${UCX_SHARED_LIB_UCS}" 
"${UCX_SHARED_LIB_UCM}"
+                      INSTALL_COMMAND ${MAKE} install)
+
+  # ucx cmake module sets UCX_INCLUDE_DIRS
+  set(UCX_INCLUDE_DIRS "${UCX_PREFIX}/include")
+
+  add_library(ucx::ucp SHARED IMPORTED)

Review Comment:
   Is it possible to use the installed cmake modules, not adding libraries by 
ourselves?
   The ucx cmake modules are created after configure/build/install, looks it's 
too late to be used by our cmake?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to