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


##########
python/CMakeLists.txt:
##########
@@ -265,11 +246,77 @@ message(STATUS "NumPy include dir: ${NUMPY_INCLUDE_DIRS}")
 
 include(UseCython)
 
-# PyArrow C++
+# Arrow C++ and set default PyArrow build options
 include(GNUInstallDirs)
-
 find_package(Arrow REQUIRED)
 
+macro(define_option name description arrow_option)
+  set("PYARROW_${name}"
+      "AUTO"
+      CACHE STRING ${description})
+
+  if("${PYARROW_${name}}" STREQUAL "AUTO")
+    # by default, first check if env variable exists, otherwise use Arrow C++ 
config
+    set(env_variable "PYARROW_WITH_${name}")
+    if(DEFINED ENV{${env_variable}})
+      message(STATUS "Env variable is defined: 
${env_variable}=$ENV{${env_variable}}")
+      if($ENV{${env_variable}})
+        set("PYARROW_BUILD_${name}" ON)
+        message(STATUS "Setting ${name} to ON through env variable")
+      else()
+        set("PYARROW_BUILD_${name}" OFF)
+        message(STATUS "Setting ${name} to OFF through env variable")
+      endif()
+    else()
+      if(${arrow_option})
+        set("PYARROW_BUILD_${name}" ON)
+        message(STATUS "Setting ${name} to ON through Arrow C++ config")
+      else()
+        set("PYARROW_BUILD_${name}" OFF)
+        message(STATUS "Setting ${name} to OFF through Arrow C++ config")
+      endif()
+    endif()
+  else()
+    if("${PYARROW_${name}}")
+      set("PYARROW_BUILD_${name}" ON)
+      message(STATUS "Setting ${name} to ON through CMake option")
+    else()
+      set("PYARROW_BUILD_${name}" OFF)
+      message(STATUS "Setting ${name} to OFF through CMake option")
+    endif()
+  endif()
+endmacro()
+
+define_option(ACERO "Build the PyArrow Acero integration" ARROW_ACERO)
+define_option(CUDA "Build the PyArrow CUDA support" ARROW_CUDA)
+define_option(DATASET "Build the PyArrow Dataset integration"{ARROW_DATASET)

Review Comment:
   ```suggestion
   define_option(DATASET "Build the PyArrow Dataset integration" ARROW_DATASET)
   ```



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