Skip to content

Commit d458a43

Browse files
committed
Add back grpc fix for ar -M for bundling dependencies together
1 parent 1144f25 commit d458a43

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3279,14 +3279,33 @@ function(build_grpc)
32793279
endforeach()
32803280
endif()
32813281

3282+
# ar -M rejects with the "libgrpc++.a" filename because "+" is a line
3283+
# continuation character in MRI scripts, so we have to create a copy of the
3284+
# static lib with a different name that we will bundle later
3285+
set(GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR
3286+
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}grpcpp${CMAKE_STATIC_LIBRARY_SUFFIX}"
3287+
)
3288+
add_custom_command(OUTPUT ${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}
3289+
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gRPC::grpc++>
3290+
${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}
3291+
DEPENDS gRPC::grpc++)
3292+
add_library(gRPC::grpcpp_for_bundling STATIC IMPORTED)
3293+
set_target_properties(gRPC::grpcpp_for_bundling
3294+
PROPERTIES IMPORTED_LOCATION
3295+
"${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}")
3296+
3297+
set_source_files_properties("${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}" PROPERTIES GENERATED
3298+
TRUE)
3299+
add_custom_target(grpc_copy_grpc++ ALL DEPENDS "${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}")
3300+
add_dependencies(gRPC::grpcpp_for_bundling grpc_copy_grpc++)
3301+
32823302
# Add gRPC libraries to bundled static libs.
32833303
list(APPEND
32843304
ARROW_BUNDLED_STATIC_LIBS
32853305
gRPC::address_sorting
32863306
gRPC::gpr
32873307
gRPC::grpc
3288-
gRPC::grpc++
3289-
gRPC::grpc++_reflection
3308+
gRPC::grpcpp_for_bundling
32903309
gRPC::upb)
32913310
set(ARROW_BUNDLED_STATIC_LIBS
32923311
"${ARROW_BUNDLED_STATIC_LIBS}"

0 commit comments

Comments
 (0)