Statically link arrow libraries when building numbuf (#53)

* Fix numbuf compilation on Linux

* Statically link arrow libraries when building numbuf.

* Last fixes.
This commit is contained in:
Philipp Moritz
2016-11-21 02:14:13 -08:00
committed by Robert Nishihara
parent 9ed56c23db
commit da6bcfcc70
2 changed files with 12 additions and 24 deletions
+11 -23
View File
@@ -82,21 +82,12 @@ endif()
set(ARROW_DIR "${CMAKE_SOURCE_DIR}/thirdparty/arrow/"
CACHE STRING "Path of the arrow source directory")
if(APPLE)
set(ARROW_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow.dylib"
CACHE STRING "Path to libarrow.dylib (needs to be changed if arrow is build in debug mode)")
set(ARROW_IO_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow_io.dylib"
CACHE STRING "Path to libarrow_io.dylib (needs to be changed if arrow is build in debug mode)")
set(ARROW_IPC_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow_ipc.dylib"
CACHE STRING "Path to libarrow_ipc.dylib (needs to be changed if arrow is build in debug mode)")
else()
set(ARROW_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow.so"
CACHE STRING "Path to libarrow.so (needs to be changed if arrow is build in debug mode)")
set(ARROW_IO_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow_io.so"
CACHE STRING "Path to libarrow_io.so (needs to be changed if arrow is build in debug mode)")
set(ARROW_IPC_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow_ipc.so"
CACHE STRING "Path to libarrow_ipc.so (needs to be changed if arrow is build in debug mode)")
endif()
set(ARROW_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow.a"
CACHE STRING "Path to libarrow.a (needs to be changed if arrow is build in debug mode)")
set(ARROW_IO_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow_io.a"
CACHE STRING "Path to libarrow_io.a (needs to be changed if arrow is build in debug mode)")
set(ARROW_IPC_LIB "${CMAKE_SOURCE_DIR}/thirdparty/arrow/cpp/build/release/libarrow_ipc.a"
CACHE STRING "Path to libarrow_ipc.a (needs to be changed if arrow is build in debug mode)")
include_directories("${ARROW_DIR}/cpp/src/")
include_directories("cpp/src/")
@@ -116,15 +107,12 @@ get_filename_component(PYTHON_SHARED_LIBRARY ${PYTHON_LIBRARIES} NAME)
if(APPLE)
add_custom_command(TARGET numbuf
POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change ${PYTHON_SHARED_LIBRARY} ${PYTHON_LIBRARIES} libnumbuf.so)
add_custom_command(TARGET numbuf
POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "@rpath/libarrow.dylib" "@loader_path/libarrow.dylib" libnumbuf.so)
add_custom_command(TARGET numbuf
POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "@rpath/libarrow_io.dylib" "@loader_path/libarrow_io.dylib" libnumbuf.so)
add_custom_command(TARGET numbuf
POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "@rpath/libarrow_ipc.dylib" "@loader_path/libarrow_ipc.dylib" libnumbuf.so)
endif(APPLE)
target_link_libraries(numbuf ${ARROW_LIB} ${ARROW_IO_LIB} ${ARROW_IPC_LIB} ${PYTHON_LIBRARIES})
if(APPLE)
target_link_libraries(numbuf ${ARROW_LIB} ${ARROW_IO_LIB} ${ARROW_IPC_LIB} ${PYTHON_LIBRARIES})
else()
target_link_libraries(numbuf -Wl,--whole-archive ${ARROW_LIB} -Wl,--no-whole-archive ${ARROW_IO_LIB} ${ARROW_IPC_LIB} ${PYTHON_LIBRARIES})
endif()
install(TARGETS numbuf DESTINATION ${CMAKE_SOURCE_DIR}/numbuf/)
install(FILES ${ARROW_LIB} ${ARROW_IO_LIB} ${ARROW_IPC_LIB} DESTINATION ${CMAKE_SOURCE_DIR}/numbuf/)
+1 -1
View File
@@ -7,4 +7,4 @@ TP_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
git clone https://github.com/pcmoritz/arrow.git "$TP_DIR/arrow"
cd "$TP_DIR/arrow"
git checkout 58bd7bedc63d66d5898297bab25b54dfb67665db
git checkout c88bd70c13cf16c07b840623cb466aa98d535be0