Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support linking to Arrow::python instead of Arrow::arrow_shared #295

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ option(HICTK_ENABLE_FUZZY_TESTING "Build fuzzy tests" OFF)
option(HICTK_BUILD_EXAMPLES "Build examples" OFF)
option(HICTK_BUILD_BENCHMARKS "Build benchmarks" OFF)
option(HICTK_WITH_ARROW "Build with arrow support" ON)
option(HICTK_WITH_PYARROW_UNSAFE "Build with arrow support but link to libarrow_python instead of libarrow" OFF)
option(HICTK_WITH_ARROW_SHARED "Force dynamic linking to Arrow libs" OFF)
option(HICTK_WITH_EIGEN "Build with Eigen3 support" ON)
option(HICTK_BUILD_TOOLS "Build cli tools" ON)
Expand All @@ -163,14 +164,19 @@ if(HICTK_WITH_EIGEN)
target_compile_definitions(hictk_project_options INTERFACE HICTK_WITH_EIGEN)
endif()

if(HICTK_WITH_ARROW)
target_compile_definitions(hictk_project_options INTERFACE HICTK_WITH_ARROW)
if(BUILD_SHARED_LIBS)
set(HICTK_WITH_ARROW_SHARED ON CACHE BOOL "Force dynamic linking to Arrow libs" FORCE)
endif()

if(BUILD_SHARED_LIBS)
if(HICTK_WITH_PYARROW_UNSAFE)
set(HICTK_WITH_ARROW ON CACHE BOOL "Build with arrow support" FORCE)
set(HICTK_WITH_ARROW_SHARED ON CACHE BOOL "Force dynamic linking to Arrow libs" FORCE)
endif()

if(HICTK_WITH_ARROW)
target_compile_definitions(hictk_project_options INTERFACE HICTK_WITH_ARROW)
endif()

add_subdirectory(src)

if(HICTK_ENABLE_TESTING)
Expand Down
16 changes: 12 additions & 4 deletions src/libhictk/transformers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
# SPDX-License-Identifier: MIT

if(HICTK_WITH_ARROW)
find_package(Arrow REQUIRED QUIET)
if(HICTK_WITH_PYARROW_UNSAFE)
find_package(Pyarrow REQUIRED QUIET)
else()
find_package(Arrow REQUIRED QUIET)
endif()
endif()

find_package(spdlog REQUIRED QUIET)
Expand Down Expand Up @@ -33,8 +37,12 @@ target_link_libraries(

target_link_system_libraries(transformers INTERFACE spdlog::spdlog_header_only)

if(HICTK_WITH_ARROW_SHARED)
target_link_system_libraries(transformers INTERFACE "$<$<BOOL:${HICTK_WITH_ARROW}>:Arrow::arrow_shared>")
if(HICTK_WITH_PYARROW_UNSAFE)
target_link_system_libraries(transformers INTERFACE Arrow::python)
else()
target_link_system_libraries(transformers INTERFACE "$<$<BOOL:${HICTK_WITH_ARROW}>:Arrow::arrow_static>")
if(HICTK_WITH_ARROW_SHARED)
target_link_system_libraries(transformers INTERFACE "$<$<BOOL:${HICTK_WITH_ARROW}>:Arrow::arrow_shared>")
else()
target_link_system_libraries(transformers INTERFACE "$<$<BOOL:${HICTK_WITH_ARROW}>:Arrow::arrow_static>")
endif()
endif()
Loading