Commit a69b0ae5 by Mike Kruskal Committed by Copybara-Service

Separate DLL export/import for test helpers dll, and fix typo.

The DLL export issue isn't a problem currently, since we don't explicitly export any symbols from the test dll.  This will be an issue in the future though.  Additionally, there was a typo in absl_internal_test_dll_contains that caused abseil_test_dll to be empty (and therefore not create a lib file).

PiperOrigin-RevId: 504555797
Change-Id: Ic7b50bcbe704f7c8fd44028071abcf5d6babb2cf
parent f1d16576
...@@ -654,7 +654,7 @@ function(absl_internal_test_dll_contains) ...@@ -654,7 +654,7 @@ function(absl_internal_test_dll_contains)
STRING(REGEX REPLACE "^absl::" "" _target ${ABSL_INTERNAL_TEST_DLL_TARGET}) STRING(REGEX REPLACE "^absl::" "" _target ${ABSL_INTERNAL_TEST_DLL_TARGET})
list(FIND list(FIND
ABSL_INTERNA_TEST_DLL_TARGETS ABSL_INTERNAL_TEST_DLL_TARGETS
"${_target}" "${_target}"
_index) _index)
...@@ -703,14 +703,18 @@ function(absl_make_dll) ...@@ -703,14 +703,18 @@ function(absl_make_dll)
set(_dll "abseil_test_dll") set(_dll "abseil_test_dll")
set(_dll_files ${ABSL_INTERNAL_TEST_DLL_FILES}) set(_dll_files ${ABSL_INTERNAL_TEST_DLL_FILES})
set(_dll_libs "abseil_dll" "GTest::gtest" "GTest::gmock") set(_dll_libs "abseil_dll" "GTest::gtest" "GTest::gmock")
set(_dll_compile_definiations "GTEST_LINKED_AS_SHARED_LIBRARY=1") set(_dll_compile_definitions "GTEST_LINKED_AS_SHARED_LIBRARY=1")
set(_dll_includes ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}) set(_dll_includes ${absl_gtest_src_dir}/googletest/include ${absl_gtest_src_dir}/googlemock/include)
set(_dll_consume "ABSL_CONSUME_TEST_DLL")
set(_dll_build "ABSL_BUILD_TEST_DLL")
else() else()
set(_dll "abseil_dll") set(_dll "abseil_dll")
set(_dll_files ${ABSL_INTERNAL_DLL_FILES}) set(_dll_files ${ABSL_INTERNAL_DLL_FILES})
set(_dll_libs "") set(_dll_libs "")
set(_dll_compile_definiations "") set(_dll_compile_definitions "")
set(_dll_includes "") set(_dll_includes "")
set(_dll_consume "ABSL_CONSUME_DLL")
set(_dll_build "ABSL_BUILD_DLL")
endif() endif()
add_library( add_library(
...@@ -762,7 +766,7 @@ Name: ${_dll}\n\ ...@@ -762,7 +766,7 @@ Name: ${_dll}\n\
Description: Abseil DLL library\n\ Description: Abseil DLL library\n\
URL: https://abseil.io/\n\ URL: https://abseil.io/\n\
Version: ${absl_VERSION}\n\ Version: ${absl_VERSION}\n\
Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-labseil_dll>\n\ Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-l${_dll}>\n\
Cflags: -I\${includedir}${PC_CFLAGS}\n") Cflags: -I\${includedir}${PC_CFLAGS}\n")
INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/${_dll}.pc" INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/${_dll}.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
...@@ -770,13 +774,13 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n") ...@@ -770,13 +774,13 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
target_compile_definitions( target_compile_definitions(
${_dll} ${_dll}
PUBLIC PUBLIC
GTEST_LINKED_AS_SHARED_LIBRARY=1 ${_dll_compile_definitions}
PRIVATE PRIVATE
ABSL_BUILD_DLL ${_dll_build}
NOMINMAX NOMINMAX
INTERFACE INTERFACE
${ABSL_CC_LIB_DEFINES} ${ABSL_CC_LIB_DEFINES}
ABSL_CONSUME_DLL ${_dll_consume}
) )
if(ABSL_PROPAGATE_CXX_STD) if(ABSL_PROPAGATE_CXX_STD)
......
...@@ -414,7 +414,7 @@ function(absl_cc_test) ...@@ -414,7 +414,7 @@ function(absl_cc_test)
target_sources(${_NAME} PRIVATE ${ABSL_CC_TEST_SRCS}) target_sources(${_NAME} PRIVATE ${ABSL_CC_TEST_SRCS})
target_include_directories(${_NAME} target_include_directories(${_NAME}
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} PUBLIC ${ABSL_COMMON_INCLUDE_DIRS}
PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} PRIVATE ${absl_gtest_src_dir}/googletest/include ${absl_gtest_src_dir}/googlemock/include
) )
if (${ABSL_BUILD_DLL}) if (${ABSL_BUILD_DLL})
...@@ -422,6 +422,7 @@ function(absl_cc_test) ...@@ -422,6 +422,7 @@ function(absl_cc_test)
PUBLIC PUBLIC
${ABSL_CC_TEST_DEFINES} ${ABSL_CC_TEST_DEFINES}
ABSL_CONSUME_DLL ABSL_CONSUME_DLL
ABSL_CONSUME_TEST_DLL
GTEST_LINKED_AS_SHARED_LIBRARY=1 GTEST_LINKED_AS_SHARED_LIBRARY=1
) )
......
...@@ -759,6 +759,18 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || ...@@ -759,6 +759,18 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#define ABSL_DLL #define ABSL_DLL
#endif // defined(_MSC_VER) #endif // defined(_MSC_VER)
#if defined(_MSC_VER)
#if defined(ABSL_BUILD_TEST_DLL)
#define ABSL_TEST_DLL __declspec(dllexport)
#elif defined(ABSL_CONSUME_TEST_DLL)
#define ABSL_TEST_DLL __declspec(dllimport)
#else
#define ABSL_TEST_DLL
#endif
#else
#define ABSL_TEST_DLL
#endif // defined(_MSC_VER)
// ABSL_HAVE_MEMORY_SANITIZER // ABSL_HAVE_MEMORY_SANITIZER
// //
// MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of // MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment