Skip to content

Commit

Permalink
[C++] Remove serial dependency on jemalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Jan 11, 2024
1 parent 30c4e15 commit 5e4cd25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 0 additions & 2 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,6 @@ macro(build_jemalloc)
target_link_libraries(jemalloc::jemalloc INTERFACE Threads::Threads)
target_include_directories(jemalloc::jemalloc BEFORE
INTERFACE "${JEMALLOC_INCLUDE_DIR}")
add_dependencies(jemalloc::jemalloc jemalloc_ep)

list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc)

Expand Down Expand Up @@ -2142,7 +2141,6 @@ if(ARROW_MIMALLOC)
if(WIN32)
target_link_libraries(mimalloc::mimalloc INTERFACE "bcrypt.lib" "psapi.lib")
endif()
add_dependencies(mimalloc::mimalloc mimalloc_ep)
add_dependencies(toolchain mimalloc_ep)

list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc)
Expand Down
22 changes: 8 additions & 14 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,31 +351,25 @@ set(ARROW_TESTING_SRCS
testing/util.cc)

# Add dependencies for third-party allocators.
# If possible we only want memory_pool.cc to wait for allocators to finish building,
# If possible we only want memory_pool{_jemalloc}.cc to wait for allocators to finish building,
# but that only works with Ninja
# (see https://gitlab.kitware.com/cmake/cmake/issues/19677)

set(_allocator_dependencies "") # Empty list
if(jemalloc_VENDORED)
list(APPEND _allocator_dependencies jemalloc_ep)
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
set_source_files_properties(memory_pool_jemalloc.cc PROPERTIES OBJECT_DEPENDS jemalloc_ep)
else()
add_dependencies(arrow_dependencies jemalloc_ep)
endif()
endif()
if(mimalloc_VENDORED)
list(APPEND _allocator_dependencies mimalloc_ep)
endif()

if(_allocator_dependencies)
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
set_source_files_properties(memory_pool.cc PROPERTIES OBJECT_DEPENDS
"${_allocator_dependencies}")
set_source_files_properties(memory_pool.cc PROPERTIES OBJECT_DEPENDS mimalloc_ep)
else()
add_dependencies(arrow_dependencies ${_allocator_dependencies})
add_dependencies(arrow_dependencies mimalloc_ep)
endif()
set_source_files_properties(memory_pool.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON
SKIP_UNITY_BUILD_INCLUSION ON)
endif()

unset(_allocator_dependencies)

if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set_property(SOURCE util/io_util.cc
APPEND_STRING
Expand Down

0 comments on commit 5e4cd25

Please sign in to comment.