@@ -59,69 +59,11 @@ function(psp_build_message message)
5959 set (BUILD_MESSAGE "${BUILD_MESSAGE} \n ${message} " )
6060endfunction ()
6161
62- # ##################################################
63- # Helper to grab dependencies from remote sources #
64- # ##################################################
65- function (psp_build_dep name cmake_file)
66- if (EXISTS ${CMAKE_BINARY_DIR} /${name} -build )
67- psp_build_message("${Cyan} Dependency found - not rebuilding - ${CMAKE_BINARY_DIR} /${name} -build${ColorReset} " )
68- else ()
69- configure_file (${cmake_file} ${name} -download/CMakeLists.txt)
70-
71- execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " .
72- RESULT_VARIABLE result
73- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} /${name} -download)
74-
75- if (result)
76- message (FATAL_ERROR "CMake step for ${name} failed: ${result} " )
77- endif ()
78-
79- execute_process (COMMAND ${CMAKE_COMMAND} --build .
80- RESULT_VARIABLE result
81- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} /${name} -download)
82-
83- if (result)
84- message (FATAL_ERROR "Build step for ${name} failed: ${result} " )
85- endif ()
86- endif ()
87-
88- if (${name} STREQUAL arrow)
89- # Overwrite arrow's CMakeLists with our custom, minimal CMakeLists.
90- configure_file (${PSP_CMAKE_MODULE_PATH} /${name} /CMakeLists.txt ${CMAKE_BINARY_DIR} /${name} -src/cpp/ COPYONLY )
91- configure_file (${PSP_CMAKE_MODULE_PATH} /${name} /config.h ${CMAKE_BINARY_DIR} /${name} -src/cpp/src/arrow/util/ COPYONLY )
92- add_subdirectory (${CMAKE_BINARY_DIR} /${name} -src/cpp/
93- ${CMAKE_BINARY_DIR} /${name} -build
94- EXCLUDE_FROM_ALL )
95-
96- include_directories (${CMAKE_BINARY_DIR} /${name} -src/cpp/src/)
97- elseif (${name} STREQUAL exprtk)
98- # no cmakelists - just include the header
99- include_directories (${CMAKE_BINARY_DIR} /${name} -src)
100- elseif (${name} STREQUAL re2)
101- # Overwrite re2's CMakeLists with our custom CMakeLists.
102- configure_file (${PSP_CMAKE_MODULE_PATH} /${name} /CMakeLists.txt ${CMAKE_BINARY_DIR} /${name} -src/ COPYONLY )
103- include_directories (${CMAKE_BINARY_DIR} /${name} -src)
104-
105- add_subdirectory (${CMAKE_BINARY_DIR} /${name} -src
106- ${CMAKE_BINARY_DIR} /${name} -build
107- EXCLUDE_FROM_ALL )
108- else ()
109- add_subdirectory (${CMAKE_BINARY_DIR} /${name} -src
110- ${CMAKE_BINARY_DIR} /${name} -build
111- EXCLUDE_FROM_ALL )
112-
113- include_directories (${CMAKE_BINARY_DIR} /${name} -src/extras/${name} /include )
114- include_directories (${CMAKE_BINARY_DIR} /${name} -src/include )
115- include_directories (${CMAKE_BINARY_DIR} /${name} -src)
116- endif ()
117- endfunction ()
118-
119- # #############################
120-
12162# ######################
12263# BUILD CONFIGURATION #
12364# ######################
12465find_package (Color)
66+ find_package (InstallDependency)
12567
12668# OPTIONS
12769option (CMAKE_BUILD_TYPE "Release/Debug build" RELEASE)
@@ -391,29 +333,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
391333 psp_build_message("${Cyan} Using Python ${Python_VERSION} , \n Python_INCLUDE_DIRS: ${Python_INCLUDE_DIRS} , \n Python_LIBRARIES: ${Python_LIBRARIES} , \n Python_EXECUTABLE: ${Python_EXECUTABLE} ${ColorReset} " )
392334 include_directories (${Python_INCLUDE_DIRS} )
393335
394- if (MACOS)
395- # on mac, use the vanilla pybind11 finder
396- find_package (pybind11)
397-
398- if (pybind11_FOUND)
399- # Found PyBind installed by Homebrew
400- set (PYTHON_PYBIND_FOUND pybind11_FOUND)
401- else ()
402- # Check if pip installed PyBind is available
403- find_package (Pybind)
404- endif ()
405- else ()
406- # On Linux/Docker, look for pip installed PyBind only
407- find_package (Pybind)
408- endif ()
409-
410- if (NOT PYTHON_PYBIND_FOUND)
411- psp_build_message("${Red} PyBind11 could not be located - building from external source${ColorReset} " )
412- psp_build_dep("pybind11" "${PSP_CMAKE_MODULE_PATH} /Pybind.txt.in" )
413- else ()
414- psp_build_message("${Cyan} Found PyBind11 in ${PYTHON_PYBIND_INCLUDE_DIR}${ColorReset} " )
415- include_directories (${PYTHON_PYBIND_INCLUDE_DIR} )
416- endif ()
336+ psp_build_dep("pybind11" "${PSP_CMAKE_MODULE_PATH} /Pybind.txt.in" )
417337
418338 find_package (NumPy)
419339
@@ -439,47 +359,18 @@ message("${Cyan}Building minimal Apache Arrow${ColorReset}")
439359# Build arrow dependencies
440360psp_build_dep("rapidjson" "${PSP_CMAKE_MODULE_PATH} /rapidjson.txt.in" )
441361psp_build_dep("double-conversion" "${PSP_CMAKE_MODULE_PATH} /double-conversion.txt.in" )
442-
443- # FIXME: this is a hack to get Flatbuffers working on Azure Win64 by making the
444- # headers accessible. The actual flatc executable is installed using
445- # Chocolatey for our Azure Windows job.
446- find_package (Flatbuffers)
447-
448- if (NOT FLATBUFFERS_FOUND)
449- psp_build_message("${Cyan} Could not find Flatbuffers${ColorReset} " )
450- psp_build_dep("flatbuffers" "${PSP_CMAKE_MODULE_PATH} /flatbuffers.txt.in" )
451- else ()
452- psp_build_message("${Cyan} Found Flatbuffers in ${FLATBUFFERS_INCLUDE_DIR}${ColorReset} " )
453- include_directories (${FLATBUFFERS_INCLUDE_DIR} )
454- endif ()
362+ psp_build_dep("flatbuffers" "${PSP_CMAKE_MODULE_PATH} /flatbuffers.txt.in" )
455363
456364# Build minimal arrow itself
457365psp_build_dep("arrow" "${PSP_CMAKE_MODULE_PATH} /arrow.txt.in" )
458366
459367# Build re2 as our regex library
460- find_package (re2)
461-
462- if (NOT re2_FOUND)
463- psp_build_message("${Cyan} Could not find Re2${ColorReset} " )
464-
465- # this is a workaround for some re2-specific weirdness
466- add_definitions (-DTARGET_OS_OSX=1)
467- psp_build_dep("re2" "${PSP_CMAKE_MODULE_PATH} /re2.txt.in" )
468- else ()
469- psp_build_message("${Cyan} Found re2 in ${RE2_INCLUDE_DIR}${ColorReset} " )
470- include_directories (${RE2_INCLUDE_DIR} )
471- endif ()
368+ # this is a workaround for some re2-specific weirdness
369+ add_definitions (-DTARGET_OS_OSX=1)
370+ psp_build_dep("re2" "${PSP_CMAKE_MODULE_PATH} /re2.txt.in" )
472371
473372# Build exprtk for expression parsing
474- find_package (exprtk)
475-
476- if (NOT exprtk_FOUND)
477- psp_build_message("${Cyan} Could not find exprtk${ColorReset} " )
478- psp_build_dep("exprtk" "${PSP_CMAKE_MODULE_PATH} /exprtk.txt.in" )
479- else ()
480- psp_build_message("${Cyan} Found exprtk in ${EXPRTK_INCLUDE_DIR}${ColorReset} " )
481- include_directories (${EXPRTK_INCLUDE_DIR} )
482- endif ()
373+ psp_build_dep("exprtk" "${PSP_CMAKE_MODULE_PATH} /exprtk.txt.in" )
483374
484375# ####################
485376set (CMAKE_C_FLAGS_RELEASE " \
@@ -689,10 +580,6 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
689580 set_property (TARGET psp PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${module_origin_path} )
690581 set_property (TARGET binding PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${module_origin_path} )
691582
692- target_compile_options (arrow PRIVATE -fvisibility=hidden)
693- target_compile_options (flatbuffers PRIVATE -fvisibility=hidden)
694- target_compile_options (double-conversion PRIVATE -fvisibility=hidden)
695- target_compile_options (re2 PRIVATE -fvisibility=hidden)
696583 target_compile_options (psp PRIVATE -fvisibility=hidden)
697584 target_compile_options (binding PRIVATE -fvisibility=hidden)
698585 else ()
0 commit comments