Blob Blame History Raw
--- apache-arrow-4.0.1/cpp/thirdparty/versions.txt.orig	2021-08-24 17:49:59.451872173 -0400
+++ apache-arrow-4.0.1/cpp/thirdparty/versions.txt	2021-08-24 17:50:08.734720962 -0400
@@ -36,7 +36,7 @@
 ARROW_GBENCHMARK_BUILD_VERSION=v1.5.2
 ARROW_GFLAGS_BUILD_VERSION=v2.2.2
 ARROW_GLOG_BUILD_VERSION=v0.4.0
-ARROW_GRPC_BUILD_VERSION=v1.35.0
+ARROW_GRPC_BUILD_VERSION=v1.26.0
 ARROW_GTEST_BUILD_VERSION=1.10.0
 ARROW_JEMALLOC_BUILD_VERSION=5.2.1
 ARROW_LZ4_BUILD_VERSION=v1.9.3
--- apache-arrow-4.0.1/cpp/cmake_modules/ThirdpartyToolchain.cmake.orig	2021-05-18 23:53:20.000000000 -0400
+++ apache-arrow-4.0.1/cpp/cmake_modules/ThirdpartyToolchain.cmake	2021-09-16 07:20:52.776270833 -0400
@@ -1104,8 +1104,8 @@
   set(GLOG_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
   set(GLOG_CMAKE_C_FLAGS "${EP_C_FLAGS} -fPIC")
   if(Threads::Threads)
-    set(GLOG_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread")
-    set(GLOG_CMAKE_C_FLAGS "${EP_C_FLAGS} -fPIC -pthread")
+    set(GLOG_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread -lpthread")
+    set(GLOG_CMAKE_C_FLAGS "${EP_C_FLAGS} -fPIC -pthread -lpthread")
   endif()
 
   if(APPLE)
@@ -1920,29 +1920,82 @@
 endif()
 
 macro(build_xsimd)
-  message(STATUS "Building xsimd from source")
-  set(XSIMD_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/xsimd_ep/src/xsimd_ep-install")
-  set(XSIMD_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${XSIMD_PREFIX}")
+  message(STATUS "Building xsimdxx from source")
+  set(ZSTD_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/xsimd_ep-install")
+
+  set(XSIMD_CMAKE_ARGS
+      ${EP_COMMON_TOOLCHAIN}
+      "-DCMAKE_INSTALL_PREFIX=${XSIMD_PREFIX}"
+      -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+      -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
+      -DXSIMD_BUILD_PROGRAMS=off
+      -DXSIMD_BUILD_SHARED=off
+      -DXSIMD_BUILD_STATIC=on
+      -DXSIMD_MULTITHREAD_SUPPORT=off)
+
+  if(MSVC)
+    set(XSIMD_STATIC_LIB "${XSIMD_PREFIX}/${CMAKE_INSTALL_LIBDIR}/xsimd_static.lib")
+    if(ARROW_USE_STATIC_CRT)
+      set(XSIMD_CMAKE_ARGS ${XSIMD_CMAKE_ARGS} "-DXSIMD_USE_STATIC_RUNTIME=on")
+    endif()
+  else()
+    # Only pass our C flags on Unix as on MSVC it leads to a
+    # "incompatible command-line options" error
+    set(XSIMD_CMAKE_ARGS
+        ${XSIMD_CMAKE_ARGS}
+        -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+        -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+        -DCMAKE_C_FLAGS=${EP_C_FLAGS}
+        -DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS})
+  endif()
+
+  if(CMAKE_VERSION VERSION_LESS 3.7)
+    message(FATAL_ERROR "Building xsimd using ExternalProject requires at least CMake 3.7")
+  endif()
 
   externalproject_add(xsimd_ep
                       ${EP_LOG_OPTIONS}
-                      PREFIX "${CMAKE_BINARY_DIR}"
+                      CMAKE_ARGS ${XSIMD_CMAKE_ARGS}
+                      SOURCE_SUBDIR "build/cmake"
+                      INSTALL_DIR ${XSIMD_PREFIX}
                       URL ${XSIMD_SOURCE_URL}
-                      CMAKE_ARGS ${XSIMD_CMAKE_ARGS})
+                      BUILD_BYPRODUCTS "${XSIMD_STATIC_LIB}")
 
-  set(XSIMD_INCLUDE_DIR "${XSIMD_PREFIX}/include")
+  file(MAKE_DIRECTORY "${XSIMD_PREFIX}/include")
+
+  add_library(xsimd::libxsimd STATIC IMPORTED)
+  set_target_properties(xsimd::libxsimd
+                        PROPERTIES IMPORTED_LOCATION "${XSIMD_STATIC_LIB}"
+                                   INTERFACE_INCLUDE_DIRECTORIES "${XSIMD_PREFIX}/include")
 
   add_dependencies(toolchain xsimd_ep)
-  add_dependencies(toolchain-tests xsimd_ep)
+  add_dependencies(xsimd::libxsimd xsimd_ep)
 
-  set(XSIMD_VENDORED TRUE)
+  list(APPEND ARROW_BUNDLED_STATIC_LIBS xsimd::libxsimd)
 endmacro()
 
-if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE")
-   OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE"))
-  set(xsimd_SOURCE "BUNDLED")
+if(ARROW_WITH_XSIMD)
   resolve_dependency(xsimd)
+
+  if(TARGET xsimd::libxsimd)
+    set(ARROW_XSIMD_LIBXSIMD xsimd::libxsimd)
+  else()
+    # "SYSTEM" source will prioritize cmake config, which exports
+    # xsimd::libxsimd_{static,shared}
+    if(ARROW_XSIMD_USE_SHARED)
+      if(TARGET xsimd::libxsimd_shared)
+        set(ARROW_XSIMD_LIBXSIMD xsimd::libxsimd_shared)
+      endif()
+    else()
+      if(TARGET xsimd::libxsimd_static)
+        set(ARROW_XSIMD_LIBXSIMD xsimd::libxsimd_static)
+      endif()
+    endif()
+  endif()
+
   # TODO: Don't use global includes but rather target_include_directories
+  get_target_property(XSIMD_INCLUDE_DIR ${ARROW_XSIMD_LIBXSIMD}
+                      INTERFACE_INCLUDE_DIRECTORIES)
   include_directories(SYSTEM ${XSIMD_INCLUDE_DIR})
 endif()
 
@@ -2612,12 +2665,7 @@
 endmacro()
 
 if(ARROW_WITH_GRPC)
-  set(ARROW_GRPC_REQUIRED_VERSION "1.17.0")
-  resolve_dependency(gRPC
-                     HAVE_ALT
-                     TRUE
-                     REQUIRED_VERSION
-                     ${ARROW_GRPC_REQUIRED_VERSION})
+  resolve_dependency(gRPC REQUIRED_VERSION 1.17.0)
 
   # TODO: Don't use global includes but rather target_include_directories
   get_target_property(GRPC_INCLUDE_DIR gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES)
--- apache-arrow-4.0.1/cpp/CMakeLists.txt.orig	2021-08-26 14:32:40.450321244 -0400
+++ apache-arrow-4.0.1/cpp/CMakeLists.txt	2021-08-26 14:33:52.822138398 -0400
@@ -751,6 +751,12 @@
   endif()
 endif()
 
+if(ARROW_WITH_XSIMD)
+  if(xsimd_SOURCE STREQUAL "SYSTEM")
+    list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS xsimd::xsimd)
+  endif()
+endif()
+
 add_custom_target(arrow_dependencies)
 add_custom_target(arrow_benchmark_dependencies)
 add_custom_target(arrow_test_dependencies)