@@ -42,9 +42,9 @@ function (psp_build_message message)
4242 set (BUILD_MESSAGE "${BUILD_MESSAGE} \n ${message} " )
4343endfunction ()
4444
45- ###############################
46- # Helper to grab dependencies #
47- ###############################
45+ ###################################################
46+ # Helper to grab dependencies from remote sources #
47+ ###################################################
4848function (psp_build_dep name cmake_file )
4949 if (EXISTS ${CMAKE_BINARY_DIR} /${name} -build)
5050 psp_build_message ("${Cyan} Dependency found - not rebuilding - ${CMAKE_BINARY_DIR} /${name} -build${ColorReset} " )
@@ -69,7 +69,7 @@ function (psp_build_dep name cmake_file)
6969 endif ()
7070
7171 if (${name} STREQUAL arrow)
72- # Overwrite arrow's CMakeLists with our custom, minimal one
72+ # Overwrite arrow's CMakeLists with our custom, minimal CMakeLists.
7373 configure_file (${PSP_CMAKE_MODULE_PATH} /arrow/CMakeLists.txt ${CMAKE_BINARY_DIR} /arrow-src/cpp/ COPYONLY )
7474 configure_file (${PSP_CMAKE_MODULE_PATH} /arrow/config.h ${CMAKE_BINARY_DIR} /arrow-src/cpp/src/arrow/util/ COPYONLY )
7575 add_subdirectory (${CMAKE_BINARY_DIR} /arrow-src/cpp/
@@ -222,9 +222,6 @@ if (PSP_WASM_BUILD)
222222 # Include this docker-only directory.
223223 include_directories ("/boost_includes" )
224224
225- # Build Rapidjson as it is used in the minimal arrow to be built later.
226- psp_build_dep ("rapidjson" "${PSP_CMAKE_MODULE_PATH} /rapidjson.txt.in" )
227-
228225 set (EXTENDED_FLAGS " \
229226 --bind \
230227 --source-map-base ./build/ \
@@ -315,15 +312,20 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
315312 endif ()
316313 endif ()
317314
315+ # Boost is a system dependency and must be present and built on the system.
318316 find_package (Boost REQUIRED )
317+
319318 if (NOT Boost_FOUND)
320319 message (FATAL_ERROR "${Red} Boost could not be located${ColorReset} " )
321320 else ()
322321 psp_build_message ("${Cyan} Found Boost: `Boost_INCLUDE_DIRS`: ${Boost_INCLUDE_DIRS} , `Boost_LIBRARY_DIRS` - ${Boost_LIBRARY_DIRS} ${ColorReset} " )
323322 include_directories ( ${Boost_INCLUDE_DIRS} )
324323 endif ()
325324
325+ # TBB is a dependency that we can build as part of our build process, so it
326+ # does not necessarily have to be present before Perspective is built.
326327 find_package (TBB )
328+
327329 if (NOT TBB_FOUND)
328330 psp_build_message ("${Red} TBB could not be located - building TBB from external source ${ColorReset} " )
329331 psp_build_dep ("tbb" "${PSP_CMAKE_MODULE_PATH} /TBB.txt.in" )
@@ -415,17 +417,6 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
415417 psp_build_message ("${Cyan} Numpy found: ${PYTHON_NUMPY_INCLUDE_DIR}${ColorReset} " )
416418 include_directories ( ${PYTHON_NUMPY_INCLUDE_DIR} )
417419 endif ()
418-
419- find_package (PyArrow REQUIRED )
420-
421- if (NOT PYTHON_PYARROW_FOUND)
422- message (FATAL_ERROR "${Red} PyArrow could not be located${ColorReset} " )
423- else ()
424- psp_build_message ("${Cyan} PyArrow found: PYTHON_PYARROW_INCLUDE_DIR - ${PYTHON_PYARROW_INCLUDE_DIR}${ColorReset} " )
425- psp_build_message ("${Cyan} Using pre-built ${PYTHON_PYARROW_PYTHON_SHARED_LIBRARY} ${PYTHON_PYARROW_ARROW_SHARED_LIBRARY} from: ${PYTHON_PYARROW_LIBRARY_DIR}${ColorReset} " )
426- include_directories (${PYTHON_PYARROW_INCLUDE_DIR} )
427- link_directories (${PYTHON_PYARROW_LIBRARY_DIR} )
428- endif ()
429420 #####################
430421 endif ()
431422endif ()
@@ -435,21 +426,22 @@ psp_build_dep("date" "${PSP_CMAKE_MODULE_PATH}/date.txt.in")
435426psp_build_dep ("hopscotch" "${PSP_CMAKE_MODULE_PATH} /hopscotch.txt.in" )
436427psp_build_dep ("ordered-map" "${PSP_CMAKE_MODULE_PATH} /ordered-map.txt.in" )
437428
438- # For WASM/CPP build, build minimal arrow from source
439- if (NOT PSP_PYTHON_BUILD)
440- # build arrow + dependencies from source for Emscripten and C++
441- message ("${Cyan} Building minimal Apache Arrow${ColorReset} " )
429+ # Build minimal arrow for both Emscripten and Python
430+ message ("${Cyan} Building minimal Apache Arrow${ColorReset} " )
442431
443- psp_build_dep ("double-conversion" "${PSP_CMAKE_MODULE_PATH} /double-conversion.txt.in" )
444- psp_build_dep ("arrow" "${PSP_CMAKE_MODULE_PATH} /arrow.txt.in" )
432+ # Build arrow dependencies
433+ psp_build_dep ("rapidjson" "${PSP_CMAKE_MODULE_PATH} /rapidjson.txt.in" )
434+ psp_build_dep ("double-conversion" "${PSP_CMAKE_MODULE_PATH} /double-conversion.txt.in" )
445435
446- find_package (Flatbuffers )
447- if (NOT FLATBUFFERS_FOUND)
448- message (FATAL_ERROR "${Red} Flatbuffers could not be located${ColorReset} " )
449- else ()
450- psp_build_message ("${Cyan} Found Flatbuffers in ${FLATBUFFERS_INCLUDE_DIR}${ColorReset} " )
451- include_directories ( ${FLATBUFFERS_INCLUDE_DIR} )
452- endif ()
436+ # Build minimal arrow itself
437+ psp_build_dep ("arrow" "${PSP_CMAKE_MODULE_PATH} /arrow.txt.in" )
438+
439+ find_package (Flatbuffers )
440+ if (NOT FLATBUFFERS_FOUND)
441+ message (FATAL_ERROR "${Red} Flatbuffers could not be located${ColorReset} " )
442+ else ()
443+ psp_build_message ("${Cyan} Found Flatbuffers in ${FLATBUFFERS_INCLUDE_DIR}${ColorReset} " )
444+ include_directories ( ${FLATBUFFERS_INCLUDE_DIR} )
453445endif ()
454446
455447#####################
@@ -635,25 +627,12 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
635627
636628 # .dll not importable
637629 set_property (TARGET binding PROPERTY SUFFIX .pyd )
638- elseif (MACOS OR NOT MANYLINUX)
639- target_compile_options (binding PRIVATE -Wdeprecated-declarations )
640-
641- # Add a relative path to search for PyArrow - when Perspective is
642- # installed from a wheel, PyArrow may not be in the same directory
643- # as the PyArrow which was used to build the wheel.
644- #
645- # Assuming that both Pyarrow and Perspective are installed in
646- # `site-packages`, the relative search path should be able to pick
647- # up pyarrow. This is only enabled for *nix (non-manylinux), as `auditwheel`
648- # will not delocate libarrow properly if it is in the rpath.
649- set_property (TARGET psp PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${module_origin_path} ${module_origin_path} ../../pyarrow/ ${PYTHON_PYARROW_LIBRARY_DIR} ${PSP_PYTHON_ARROWINSTALLDIR} )
650- set_property (TARGET binding PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${module_origin_path} ${module_origin_path} ../../pyarrow/ ${PYTHON_PYARROW_LIBRARY_DIR} ${PSP_PYTHON_ARROWINSTALLDIR} )
651630 else ()
652631 target_compile_options (binding PRIVATE -Wdeprecated-declarations )
653632 endif ()
654633
655- target_link_libraries (psp ${PYTHON_PYARROW_LIBRARIES} )
656- target_link_libraries (binding ${PYTHON_PYARROW_LIBRARIES} )
634+ target_link_libraries (psp arrow )
635+ target_link_libraries (binding arrow )
657636
658637 target_link_libraries (psp tbb )
659638 target_link_libraries (binding tbb )
@@ -669,7 +648,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
669648
670649 if (WIN32 )
671650 # inline arrow dlls
672- file (GLOB ARROW_DLLS "${PYTHON_PYARROW_LIBRARY_DIR} /*.dll" )
651+ # file(GLOB ARROW_DLLS "${PYTHON_PYARROW_LIBRARY_DIR}/*.dll")
673652
674653 add_custom_command (TARGET binding POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${ARROW_DLLS} ${PSP_PYTHON_SRC} /table/ )
675654 if (NOT TBB_FOUND)
0 commit comments