coryan commented on a change in pull request #11261: URL: https://github.com/apache/arrow/pull/11261#discussion_r717942315
########## File path: cpp/cmake_modules/ThirdpartyToolchain.cmake ########## @@ -2369,6 +2369,593 @@ endmacro() # ---------------------------------------------------------------------- # Dependencies for Arrow Flight RPC +macro(build_absl_once) + if(NOT TARGET absl_ep) + message(STATUS "Building Abseil-cpp from source") + set(ABSL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/absl_ep-install") + set(ABSL_CMAKE_ARGS + "${EP_COMMON_CMAKE_ARGS}" + -DABSL_RUN_TESTS=OFF + -DCMAKE_CXX_STANDARD=11 + -DCMAKE_INSTALL_LIBDIR=lib + "-DCMAKE_INSTALL_PREFIX=${ABSL_PREFIX}") + set(ABSL_BUILD_BYPRODUCTS) + set(ABSL_LIBRARIES) + + # Abseil produces the following libraries, each is fairly small, but there + # are (as you can see), many of them. We need to add the libraries first, + # and then describe how they depend on each other. The list can be + # refreshed using: + # ls -1 $PREFIX/lib/libabsl_*.a | sed -e 's/.*libabsl_//' -e 's/.a$//' + set(_ABSL_LIBS + bad_any_cast_impl + bad_optional_access + bad_variant_access + base + city + civil_time + cord + debugging_internal + demangle_internal + examine_stack + exponential_biased + failure_signal_handler + flags + flags_commandlineflag + flags_commandlineflag_internal + flags_config + flags_internal + flags_marshalling + flags_parse + flags_private_handle_accessor + flags_program_name + flags_reflection + flags_usage + flags_usage_internal + graphcycles_internal + hash + hashtablez_sampler + int128 + leak_check + leak_check_disable + log_severity + malloc_internal + periodic_sampler + random_distributions + random_internal_distribution_test_util + random_internal_platform + random_internal_pool_urbg + random_internal_randen + random_internal_randen_hwaes + random_internal_randen_hwaes_impl + random_internal_randen_slow + random_internal_seed_material + random_seed_gen_exception + random_seed_sequences + raw_hash_set + raw_logging_internal + scoped_set_env + spinlock_wait + stacktrace + status + statusor + strerror + str_format_internal + strings + strings_internal + symbolize + synchronization + throw_delegate + time + time_zone + wyhash) + # Abseil creates a number of header-only targets, which are needed to resolve dependencies. + # The list can be refreshed using: + # comm -13 <(ls -l $PREFIX/lib/libabsl_*.a | sed -e 's/.*libabsl_//' -e 's/.a$//' | sort -u) \ + # <(ls -1 $PREFIX/lib/pkgconfig/absl_*.pc | sed -e 's/.*absl_//' -e 's/.pc$//' | sort -u) + set(_ABSL_INTERFACE_LIBS + algorithm + algorithm_container + any + atomic_hook + bad_any_cast + base_internal + bind_front + bits + btree + cleanup + cleanup_internal + compare + compressed_tuple + config + container_common + container_memory + core_headers + counting_allocator + debugging + dynamic_annotations + endian + errno_saver + fast_type_id + fixed_array + flags_path_util + flat_hash_map + flat_hash_set + function_ref + hash_function_defaults + hash_policy_traits + hashtable_debug + hashtable_debug_hooks + have_sse + inlined_vector + inlined_vector_internal + kernel_timeout_internal + layout + memory + meta + node_hash_map + node_hash_policy + node_hash_set + numeric + numeric_representation + optional + pretty_function + random_bit_gen_ref + random_internal_distribution_caller + random_internal_fastmath + random_internal_fast_uniform_bits + random_internal_generate_real + random_internal_iostream_state_saver + random_internal_mock_helpers + random_internal_nonsecure_base + random_internal_pcg_engine + random_internal_randen_engine + random_internal_salted_seed_seq + random_internal_traits + random_internal_uniform_helper + random_internal_wide_multiply + random_random + raw_hash_map + span + str_format + type_traits + utility + variant) + + foreach(_ABSL_LIB ${_ABSL_LIBS}) + set(_ABSL_STATIC_LIBRARY + "${ABSL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}absl_${_ABSL_LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + add_library(absl::${_ABSL_LIB} STATIC IMPORTED) + set_target_properties(absl::${_ABSL_LIB} PROPERTIES IMPORTED_LOCATION + ${_ABSL_STATIC_LIBRARY}) + list(APPEND ABSL_BUILD_BYPRODUCTS ${_ABSL_STATIC_LIBRARY}) + endforeach() + foreach(_ABSL_LIB ${_ABSL_INTERFACE_LIBS}) + add_library(absl::${_ABSL_LIB} INTERFACE IMPORTED) + set_target_properties(absl::${_ABSL_LIB} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${ABSL_PREFIX}/include") + endforeach() + + # Extracted the dependency information using the Abseil pkg-config files: + # grep Requires $PREFIX/pkgconfig/absl_*.pc | \ + # sed -e 's;.*/absl_;set_target_properties(absl::;' \ + # -e 's/.pc:Requires:/ PROPERTIES INTERFACE_LINK_LIBRARIES "/' \ + # -e 's/ = 20210324,//g' \ + # -e 's/ = 20210324//g' \ + # -e 's/ absl_/;absl::/g' \ + # -e 's/$/")/' -e 's/";/"/' | \ + # grep -v '"")' + set_target_properties(absl::algorithm_container + PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::algorithm;absl::core_headers;absl::meta") + set_target_properties(absl::algorithm PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::config") + set_target_properties(absl::any + PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::bad_any_cast;absl::config;absl::core_headers;absl::fast_type_id;absl::type_traits;absl::utility" + ) + set_target_properties(absl::atomic_hook PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::config;absl::core_headers") + set_target_properties(absl::bad_any_cast_impl + PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::config;absl::raw_logging_internal") + set_target_properties(absl::bad_any_cast + PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::bad_any_cast_impl;absl::config") + set_target_properties(absl::bad_optional_access + PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::config;absl::raw_logging_internal") + set_target_properties(absl::bad_variant_access + PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::config;absl::raw_logging_internal") + set_target_properties(absl::base_internal PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::config;absl::type_traits") + set_target_properties(absl::base + PROPERTIES INTERFACE_LINK_LIBRARIES + "absl::atomic_hook;absl::base_internal;absl::config;absl::core_headers;absl::dynamic_annotations;absl::log_severity;absl::raw_logging_internal;absl::spinlock_wait;absl::type_traits" Review comment: Thanks, that is a good idea. Let me test that locally while the other builds run. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org