Skip to content

Commit

Permalink
ARROW-17579: [Python] PYARROW_CXXFLAGS ignored? (apache#14074)
Browse files Browse the repository at this point in the history
This PR adds:
- `PYARROW_CXXFLAGS` variable to PyArrow C++ and Pyarrow cmake builds (both defined in `setup.py`)
- a common flags section to `pyarrow/src/CMakeLists.txt` where `CXX_COMMON_FLAGS` and `PYARROW_CXXFLAGS` are added to the `CMAKE_CXX_FLAGS` variable.

Other flags defined in Arrow C++ should be included in PyArrow C++ and PyArrow with `include(SetupCxxFlags)`.

I am not sure if additional flags that are defined in PyArrow, see: https://github.com/apache/arrow/blob/43670af02f0913580fd20e26006fd550d6fdf2da/python/CMakeLists.txt#L134-L174 are needed in PyArrow C++ as they were not used when PyArrow C++ was included in Arrow C++?
cc @pitrou 

Authored-by: Alenka Frim <[email protected]>
Signed-off-by: Alenka Frim <[email protected]>
  • Loading branch information
AlenkaF authored Sep 14, 2022
1 parent 81f3945 commit 9c628b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/pyarrow/_compute.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2613,7 +2613,7 @@ def register_scalar_function(func, function_name, function_doc, in_types,
raise TypeError(
"in_types must be a dictionary of DataType")

c_arity = CArity(num_args, func_spec.varargs)
c_arity = CArity(<int> num_args, func_spec.varargs)

if "summary" not in function_doc:
raise ValueError("Function doc must contain a summary")
Expand Down
4 changes: 4 additions & 0 deletions python/pyarrow/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Needed compiler flags
include(SetupCxxFlags)

# Add common flags
set(CMAKE_CXX_FLAGS "${CXX_COMMON_FLAGS} ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PYARROW_CXXFLAGS}")

message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")

Expand Down
10 changes: 6 additions & 4 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ def _run_cmake_pyarrow_cpp(self, pyarrow_cpp_home):
'-DCMAKE_BUILD_TYPE=' + str(self.build_type.lower()),
'-DCMAKE_INSTALL_LIBDIR=lib',
'-DCMAKE_INSTALL_PREFIX=' + str(pyarrow_cpp_home),
'-DPYTHON_EXECUTABLE=' + str(sys.executable),
'-DPython3_EXECUTABLE=' + str(sys.executable),
'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DPython3_EXECUTABLE=' + sys.executable,
'-DPYARROW_CXXFLAGS=' + str(self.cmake_cxxflags),
]

# Check for specific options
Expand Down Expand Up @@ -337,9 +338,10 @@ def _run_cmake(self, pyarrow_cpp_home):
static_lib_option = ''

cmake_options = [
'-DPYTHON_EXECUTABLE=%s' % sys.executable,
'-DPython3_EXECUTABLE=%s' % sys.executable,
'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DPython3_EXECUTABLE=' + sys.executable,
'-DPYARROW_CPP_HOME=' + str(pyarrow_cpp_home),
'-DPYARROW_CXXFLAGS=' + str(self.cmake_cxxflags),
static_lib_option,
]

Expand Down

0 comments on commit 9c628b7

Please sign in to comment.