merge(3p/absl): subtree merge of Abseil up to e19260f
... notably, this includes Abseil's own StatusOr type, which conflicted with our implementation (that was taken from TensorFlow). Change-Id: Ie7d6764b64055caaeb8dc7b6b9d066291e6b538f
This commit is contained in:
parent
cc27324d02
commit
082c006c04
854 changed files with 11260 additions and 5296 deletions
8
third_party/abseil_cpp/CMake/AbseilDll.cmake
vendored
8
third_party/abseil_cpp/CMake/AbseilDll.cmake
vendored
|
|
@ -8,7 +8,6 @@ set(ABSL_INTERNAL_DLL_FILES
|
|||
"base/casts.h"
|
||||
"base/config.h"
|
||||
"base/const_init.h"
|
||||
"base/dynamic_annotations.cc"
|
||||
"base/dynamic_annotations.h"
|
||||
"base/internal/atomic_hook.h"
|
||||
"base/internal/bits.h"
|
||||
|
|
@ -139,7 +138,6 @@ set(ABSL_INTERNAL_DLL_FILES
|
|||
"random/internal/distribution_caller.h"
|
||||
"random/internal/fastmath.h"
|
||||
"random/internal/fast_uniform_bits.h"
|
||||
"random/internal/gaussian_distribution_gentables.cc"
|
||||
"random/internal/generate_real.h"
|
||||
"random/internal/iostream_state_saver.h"
|
||||
"random/internal/mock_helpers.h"
|
||||
|
|
@ -176,8 +174,12 @@ set(ABSL_INTERNAL_DLL_FILES
|
|||
"random/uniform_int_distribution.h"
|
||||
"random/uniform_real_distribution.h"
|
||||
"random/zipf_distribution.h"
|
||||
"status/internal/status_internal.h"
|
||||
"status/internal/statusor_internal.h"
|
||||
"status/status.h"
|
||||
"status/status.cc"
|
||||
"status/statusor.h"
|
||||
"status/statusor.cc"
|
||||
"status/status_payload_printer.h"
|
||||
"status/status_payload_printer.cc"
|
||||
"strings/ascii.cc"
|
||||
|
|
@ -194,6 +196,7 @@ set(ABSL_INTERNAL_DLL_FILES
|
|||
"strings/internal/charconv_parse.cc"
|
||||
"strings/internal/charconv_parse.h"
|
||||
"strings/internal/stl_type_traits.h"
|
||||
"strings/internal/string_constant.h"
|
||||
"strings/match.cc"
|
||||
"strings/match.h"
|
||||
"strings/numbers.cc"
|
||||
|
|
@ -248,6 +251,7 @@ set(ABSL_INTERNAL_DLL_FILES
|
|||
"synchronization/notification.h"
|
||||
"synchronization/internal/create_thread_identity.cc"
|
||||
"synchronization/internal/create_thread_identity.h"
|
||||
"synchronization/internal/futex.h"
|
||||
"synchronization/internal/graphcycles.cc"
|
||||
"synchronization/internal/graphcycles.h"
|
||||
"synchronization/internal/kernel_timeout.h"
|
||||
|
|
|
|||
53
third_party/abseil_cpp/CMake/AbseilHelpers.cmake
vendored
53
third_party/abseil_cpp/CMake/AbseilHelpers.cmake
vendored
|
|
@ -23,7 +23,9 @@ include(AbseilInstallDirs)
|
|||
# project that sets
|
||||
# set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
# For example, Visual Studio supports folders.
|
||||
set(ABSL_IDE_FOLDER Abseil)
|
||||
if(NOT DEFINED ABSL_IDE_FOLDER)
|
||||
set(ABSL_IDE_FOLDER Abseil)
|
||||
endif()
|
||||
|
||||
# absl_cc_library()
|
||||
#
|
||||
|
|
@ -120,7 +122,11 @@ function(absl_cc_library)
|
|||
# 4. "static" -- This target does not depend on the DLL and should be built
|
||||
# statically.
|
||||
if (${ABSL_BUILD_DLL})
|
||||
absl_internal_dll_contains(TARGET ${_NAME} OUTPUT _in_dll)
|
||||
if(ABSL_ENABLE_INSTALL)
|
||||
absl_internal_dll_contains(TARGET ${_NAME} OUTPUT _in_dll)
|
||||
else()
|
||||
absl_internal_dll_contains(TARGET ${ABSL_CC_LIB_NAME} OUTPUT _in_dll)
|
||||
endif()
|
||||
if (${_in_dll})
|
||||
# This target should be replaced by the DLL
|
||||
set(_build_type "dll")
|
||||
|
|
@ -135,6 +141,47 @@ function(absl_cc_library)
|
|||
set(_build_type "static")
|
||||
endif()
|
||||
|
||||
# Generate a pkg-config file for every library:
|
||||
if(${_build_type} STREQUAL "static" OR ${_build_type} STREQUAL "shared")
|
||||
if(NOT ABSL_CC_LIB_TESTONLY)
|
||||
if(absl_VERSION)
|
||||
set(PC_VERSION "${absl_VERSION}")
|
||||
else()
|
||||
set(PC_VERSION "head")
|
||||
endif()
|
||||
foreach(dep ${ABSL_CC_LIB_DEPS})
|
||||
if(${dep} MATCHES "^absl::(.*)")
|
||||
set(PC_DEPS "${PC_DEPS} absl_${CMAKE_MATCH_1} = ${PC_VERSION}")
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(cflag ${ABSL_CC_LIB_COPTS})
|
||||
if(${cflag} MATCHES "^(-Wno|/wd)")
|
||||
# These flags are needed to suppress warnings that might fire in our headers.
|
||||
set(PC_CFLAGS "${PC_CFLAGS} ${cflag}")
|
||||
elseif(${cflag} MATCHES "^(-W|/w[1234eo])")
|
||||
# Don't impose our warnings on others.
|
||||
else()
|
||||
set(PC_CFLAGS "${PC_CFLAGS} ${cflag}")
|
||||
endif()
|
||||
endforeach()
|
||||
FILE(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc" CONTENT "\
|
||||
prefix=${CMAKE_INSTALL_PREFIX}\n\
|
||||
exec_prefix=\${prefix}\n\
|
||||
libdir=\${prefix}/lib\n\
|
||||
includedir=\${prefix}/include\n\
|
||||
\n\
|
||||
Name: absl_${_NAME}\n\
|
||||
Description: Abseil ${_NAME} library\n\
|
||||
URL: https://abseil.io/\n\
|
||||
Version: ${PC_VERSION}\n\
|
||||
Requires.private:${PC_DEPS}\n\
|
||||
Libs: -L\${libdir} $<JOIN:${ABSL_CC_LIB_LINKOPTS}, > $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-labsl_${_NAME}>\n\
|
||||
Cflags: -I\${includedir}${PC_CFLAGS}\n")
|
||||
INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ABSL_CC_LIB_IS_INTERFACE)
|
||||
if(${_build_type} STREQUAL "dll_dep")
|
||||
# This target depends on the DLL. When adding dependencies to this target,
|
||||
|
|
@ -213,6 +260,8 @@ function(absl_cc_library)
|
|||
if(ABSL_ENABLE_INSTALL)
|
||||
set_target_properties(${_NAME} PROPERTIES
|
||||
OUTPUT_NAME "absl_${_NAME}"
|
||||
# TODO(b/173696973): Figure out how to set SOVERSION for LTS releases.
|
||||
SOVERSION 0
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ if(absl_VERSION)
|
|||
set(ABSL_SUBDIR "${PROJECT_NAME}_${PROJECT_VERSION}")
|
||||
set(ABSL_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}/${ABSL_SUBDIR}")
|
||||
set(ABSL_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${ABSL_SUBDIR}")
|
||||
set(ABSL_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/{ABSL_SUBDIR}")
|
||||
set(ABSL_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${ABSL_SUBDIR}")
|
||||
set(ABSL_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${ABSL_SUBDIR}")
|
||||
else()
|
||||
set(ABSL_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}")
|
||||
set(ABSL_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||
set(ABSL_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(ABSL_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -3,24 +3,12 @@ cmake_minimum_required(VERSION 2.8.2)
|
|||
project(googletest-external NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
if(${ABSL_USE_GOOGLETEST_HEAD})
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${absl_gtest_src_dir}"
|
||||
BINARY_DIR "${absl_gtest_build_dir}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
else()
|
||||
ExternalProject_Add(googletest
|
||||
SOURCE_DIR "${absl_gtest_src_dir}"
|
||||
BINARY_DIR "${absl_gtest_build_dir}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
ExternalProject_Add(googletest
|
||||
URL "${absl_gtest_download_url}" # May be empty
|
||||
SOURCE_DIR "${absl_gtest_src_dir}"
|
||||
BINARY_DIR "${absl_gtest_build_dir}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
|
|
|||
|
|
@ -118,6 +118,24 @@ if ! grep absl::strings "${libdir}/cmake/${absl_subdir}/abslTargets.cmake"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
pushd "${HOME}"
|
||||
cat > hello-abseil.cc << EOF
|
||||
#include <cstdlib>
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
absl::PrintF("Hello Abseil!\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
EOF
|
||||
export PKG_CONFIG_PATH="${install_dir}/${libdir}/pkgconfig"
|
||||
pc_args=($(pkg-config --cflags --libs --static absl_str_format))
|
||||
g++ -static -o hello-abseil hello-abseil.cc "${pc_args[@]}"
|
||||
hello="$(./hello-abseil)"
|
||||
[[ "${hello}" == "Hello Abseil!" ]]
|
||||
popd
|
||||
|
||||
uninstall_absl
|
||||
popd
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue