Skip to content

Commit 0e9ce78

Browse files
committed
Add PYARROW_BUILD_PLASMA CMake option, make plasma build work like parquet build
Change-Id: I5714057702bc6c1c993401e42a8e324d928e3ee6
1 parent f72279b commit 0e9ce78

File tree

3 files changed

+40
-22
lines changed

3 files changed

+40
-22
lines changed

python/CMakeLists.txt

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
5151
option(PYARROW_BUILD_PARQUET
5252
"Build the PyArrow Parquet integration"
5353
OFF)
54+
option(PYARROW_BUILD_PLASMA
55+
"Build the PyArrow Plasma integration"
56+
OFF)
5457
option(PYARROW_BUNDLE_ARROW_CPP
5558
"Bundle the Arrow C++ libraries"
5659
OFF)
@@ -157,12 +160,6 @@ include_directories(SYSTEM
157160
find_package(Arrow REQUIRED)
158161
include_directories(SYSTEM ${ARROW_INCLUDE_DIR})
159162

160-
## Plasma
161-
find_package(Plasma)
162-
if (PLASMA_FOUND)
163-
include_directories(SYSTEM ${PLASMA_INCLUDE_DIR})
164-
endif()
165-
166163
function(bundle_arrow_lib library_path)
167164
get_filename_component(LIBRARY_DIR ${${library_path}} DIRECTORY)
168165
get_filename_component(LIBRARY_NAME ${${library_path}} NAME_WE)
@@ -195,9 +192,6 @@ if (PYARROW_BUNDLE_ARROW_CPP)
195192
file(COPY ${ARROW_INCLUDE_DIR}/arrow DESTINATION ${BUILD_OUTPUT_ROOT_DIRECTORY}/include)
196193
bundle_arrow_lib(ARROW_SHARED_LIB)
197194
bundle_arrow_lib(ARROW_PYTHON_SHARED_LIB)
198-
if (PLASMA_FOUND)
199-
bundle_arrow_lib(PLASMA_SHARED_LIB)
200-
endif()
201195
endif()
202196

203197
if (MSVC)
@@ -224,14 +218,9 @@ set(CYTHON_EXTENSIONS
224218
lib
225219
)
226220

227-
if (PLASMA_FOUND)
228-
set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} plasma)
229-
endif()
230-
231221
set(LINK_LIBS
232222
arrow_shared
233223
arrow_python_shared
234-
${PLASMA_SHARED_LIB}
235224
)
236225

237226
if (PYARROW_BUILD_PARQUET)
@@ -284,6 +273,29 @@ if (PYARROW_BUILD_PARQUET)
284273
_parquet)
285274
endif()
286275

276+
## Plasma
277+
if (PYARROW_BUILD_PLASMA)
278+
find_package(Plasma)
279+
280+
if(NOT PLASMA_FOUND)
281+
message(FATAL_ERROR "Unable to locate Plasma libraries")
282+
endif()
283+
284+
include_directories(SYSTEM ${PLASMA_INCLUDE_DIR})
285+
ADD_THIRDPARTY_LIB(libplasma
286+
SHARED_LIB ${PLASMA_SHARED_LIB})
287+
288+
if (PYARROW_BUNDLE_ARROW_CPP)
289+
bundle_arrow_lib(PLASMA_SHARED_LIB)
290+
endif()
291+
set(LINK_LIBS
292+
${LINK_LIBS}
293+
libplasma_shared)
294+
295+
set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} plasma)
296+
file(COPY ${PLASMA_EXECUTABLE} DESTINATION ${BUILD_OUTPUT_ROOT_DIRECTORY})
297+
endif()
298+
287299
############################################################
288300
# Setup and build Cython modules
289301
############################################################
@@ -330,7 +342,3 @@ foreach(module ${CYTHON_EXTENSIONS})
330342

331343
target_link_libraries(${module_name} ${LINK_LIBS})
332344
endforeach(module)
333-
334-
if (PLASMA_FOUND)
335-
file(COPY ${PLASMA_EXECUTABLE} DESTINATION ${BUILD_OUTPUT_ROOT_DIRECTORY})
336-
endif()

python/cmake_modules/FindParquet.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ if(PARQUET_HOME)
6060
PATHS ${PARQUET_HOME} NO_DEFAULT_PATH
6161
PATH_SUFFIXES "lib")
6262
get_filename_component(PARQUET_LIBS ${PARQUET_LIBRARIES} PATH )
63+
set(PARQUET_ABI_VERSION "1.0.0")
64+
set(PARQUET_SO_VERSION "1")
6365
else()
6466
pkg_check_modules(PARQUET parquet)
6567
if (PARQUET_FOUND)

python/setup.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,18 @@ def _run_cmake(self):
143143
if self.with_parquet:
144144
cmake_options.append('-DPYARROW_BUILD_PARQUET=on')
145145

146+
if self.with_plasma:
147+
cmake_options.append('-DPYARROW_BUILD_PLASMA=on')
148+
146149
if self.bundle_arrow_cpp:
147150
cmake_options.append('-DPYARROW_BUNDLE_ARROW_CPP=ON')
148151
# ARROW-1090: work around CMake rough edges
149152
if 'ARROW_HOME' in os.environ and sys.platform != 'win32':
150-
os.environ['PKG_CONFIG_PATH'] = pjoin(os.environ['ARROW_HOME'], 'lib', 'pkgconfig')
153+
pkg_config = pjoin(os.environ['ARROW_HOME'], 'lib',
154+
'pkgconfig')
155+
os.environ['PKG_CONFIG_PATH'] = pkg_config
151156
del os.environ['ARROW_HOME']
152157

153-
154158
cmake_options.append('-DCMAKE_BUILD_TYPE={0}'
155159
.format(self.build_type.lower()))
156160

@@ -243,7 +247,8 @@ def move_lib(lib_name):
243247
print(pjoin(build_prefix, 'include'), pjoin(build_lib, 'pyarrow'))
244248
if os.path.exists(pjoin(build_lib, 'pyarrow', 'include')):
245249
shutil.rmtree(pjoin(build_lib, 'pyarrow', 'include'))
246-
shutil.move(pjoin(build_prefix, 'include'), pjoin(build_lib, 'pyarrow'))
250+
shutil.move(pjoin(build_prefix, 'include'),
251+
pjoin(build_lib, 'pyarrow'))
247252
move_lib("arrow")
248253
move_lib("arrow_python")
249254
if self.with_plasma:
@@ -280,7 +285,9 @@ def move_lib(lib_name):
280285
if self.with_plasma:
281286
build_py = self.get_finalized_command('build_py')
282287
source = os.path.join(self.build_type, "plasma_store")
283-
target = os.path.join(build_lib, build_py.get_package_dir('pyarrow'), "plasma_store")
288+
target = os.path.join(build_lib,
289+
build_py.get_package_dir('pyarrow'),
290+
"plasma_store")
284291
shutil.move(source, target)
285292

286293
os.chdir(saved_cwd)
@@ -350,6 +357,7 @@ def get_outputs(self):
350357
language-bindings for structure manipulation. It also provides IPC
351358
and common algorithm implementations."""
352359

360+
353361
class BinaryDistribution(Distribution):
354362
def has_ext_modules(foo):
355363
return True

0 commit comments

Comments
 (0)