kou commented on code in PR #51244:
URL: https://github.com/apache/arrow/pull/51244#discussion_r4022968375


##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -3256,6 +3261,65 @@ if(ARROW_WITH_BZ2)
   endif()
 endif()
 
+# ----------------------------------------------------------------------
+# uriparser library
+
+macro(build_uriparser)
+  message(STATUS "Building uriparser from source")
+  set(URIPARSER_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/uriparser_ep-install")
+  if(MSVC)
+    set(URIPARSER_STATIC_LIB "${URIPARSER_PREFIX}/lib/uriparser.lib")
+  else()
+    set(URIPARSER_STATIC_LIB
+        
"${URIPARSER_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}uriparser${CMAKE_STATIC_LIBRARY_SUFFIX}"
+    )
+  endif()
+
+  set(URIPARSER_CMAKE_ARGS
+      ${EP_COMMON_CMAKE_ARGS}
+      -DBUILD_SHARED_LIBS=OFF
+      -DCMAKE_INSTALL_LIBDIR=lib
+      "-DCMAKE_INSTALL_PREFIX=${URIPARSER_PREFIX}"
+      -DURIPARSER_BUILD_DOCS=OFF
+      -DURIPARSER_BUILD_TESTS=OFF
+      -DURIPARSER_BUILD_TOOLS=OFF
+      # Arrow only uses the char (not wchar_t) flavor of the API.
+      -DURIPARSER_BUILD_WCHAR_T=OFF)
+
+  if(MSVC AND ARROW_USE_STATIC_CRT)
+    list(APPEND URIPARSER_CMAKE_ARGS -DURIPARSER_MSVC_STATIC_CRT=ON)
+  endif()
+
+  externalproject_add(uriparser_ep
+                      ${EP_COMMON_OPTIONS}
+                      CMAKE_ARGS ${URIPARSER_CMAKE_ARGS}
+                      INSTALL_DIR ${URIPARSER_PREFIX}
+                      URL ${ARROW_URIPARSER_SOURCE_URL}
+                      URL_HASH 
"SHA256=${ARROW_URIPARSER_BUILD_SHA256_CHECKSUM}"
+                      BUILD_BYPRODUCTS "${URIPARSER_STATIC_LIB}")
+
+  file(MAKE_DIRECTORY "${URIPARSER_PREFIX}/include")
+  add_library(uriparser::uriparser STATIC IMPORTED)
+  set_target_properties(uriparser::uriparser
+                        PROPERTIES IMPORTED_LOCATION "${URIPARSER_STATIC_LIB}"
+                                   INTERFACE_COMPILE_DEFINITIONS 
"URI_STATIC_BUILD")
+  target_include_directories(uriparser::uriparser BEFORE
+                             INTERFACE "${URIPARSER_PREFIX}/include")
+
+  add_dependencies(uriparser::uriparser uriparser_ep)
+
+  list(PREPEND ARROW_BUNDLED_STATIC_LIBS uriparser::uriparser)
+endmacro()
+
+# uriparser is mandatory: arrow::util::Uri is part of core Arrow.
+resolve_dependency(uriparser
+                   HAVE_ALT
+                   TRUE
+                   REQUIRED_VERSION
+                   "1.0.2"

Review Comment:
   No. I think that Ubuntu 22.04 ships the oldest uriparser in our supported 
(CI checked) platforms. If we don't require 1.0.2 or later features, I want to 
accept older versions in supported platforms such as Ubuntu 22.04:
   
   ```suggestion
                      "0.9.6"
   ```
   
   If we accept older versions, we can reduce our CI time because we don't need 
to build bundled uriparser.



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