Skip to content

Commit

Permalink
add patches to enable shared windows builds of test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed May 8, 2023
1 parent 8165954 commit eb312bd
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 33 deletions.
3 changes: 3 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ source:
# backport https://github.com/abseil/abseil-cpp/commit/807763a7f57dcf0ba4af7c3b218013e8f525e811
# to be able to install TESTONLY libraries
- patches/0008-CMake-Install-TESTONLY-libraries-and-their-dependenc.patch
- patches/0009-add-some-necessary-source-files-to-ABSL_INTERNAL_TES.patch
- patches/0010-update-ABSL_CC_TEST_LINKOPTS-when-using-shared-build.patch
- patches/0011-make-CordzHandle-and-relevant-internal-state-use-ABS.patch

build:
number: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From d59eb9046823f39006350a508e30bac815b63383 Mon Sep 17 00:00:00 2001
From: Francesco Biscani <[email protected]>
Date: Sat, 21 Sep 2019 15:05:46 +0200
Subject: [PATCH 1/8] patch out the build issue on clang4 osx
Subject: [PATCH 01/11] patch out the build issue on clang4 osx

---
absl/time/internal/cctz/include/cctz/civil_time_detail.h | 4 ++++
Expand All @@ -22,6 +22,3 @@ index a5b084e6..0a9a4389 100644
#include <cstdint>
#include <limits>
#include <ostream>
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c8bd75a96ecb2bd528399829692307a03985da0b Mon Sep 17 00:00:00 2001
From: Francesco Biscani <[email protected]>
Date: Sat, 21 Sep 2019 21:39:26 +0200
Subject: [PATCH 2/8] fix for linking to the CoreFoundation framework on OSX
Subject: [PATCH 02/11] fix for linking to the CoreFoundation framework on OSX

---
absl/time/CMakeLists.txt | 6 ++++--
Expand All @@ -26,6 +26,3 @@ index 7b720540..cfed46a4 100644
# Internal-only target, do not depend on directly.
absl_cc_library(
NAME
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From dfbac02988c119967037c53a0f78f03bdf01e1c8 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <[email protected]>
Date: Thu, 30 Jul 2020 13:01:32 +0200
Subject: [PATCH 3/8] remove "-ignore:4221" from ABSL_MSVC_LINKOPTS
Subject: [PATCH 03/11] remove "-ignore:4221" from ABSL_MSVC_LINKOPTS

see also https://github.com/microsoft/vcpkg/issues/13945
---
Expand Down Expand Up @@ -40,6 +40,3 @@ index e6e11949..09ac7618 100644
# "HWAES" is an abbreviation for "hardware AES" (AES - Advanced Encryption
# Standard). These flags are used for detecting whether or not the target
# architecture has hardware support for AES instructions which can be used
--
2.38.1.windows.1

5 changes: 1 addition & 4 deletions recipe/patches/0004-add-missing-osx-workaround.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From b6c0b4ffa8aa2ed4146e2c9ca9b0406e2da4f1d3 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Fri, 1 Jul 2022 13:37:17 +0200
Subject: [PATCH 4/8] add missing osx workaround
Subject: [PATCH 04/11] add missing osx workaround

---
absl/debugging/internal/examine_stack.cc | 4 ++++
Expand All @@ -22,6 +22,3 @@ index 57863228..91862aed 100644
#if defined(__linux__) || defined(__APPLE__)
#include <sys/ucontext.h>
#endif
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From d6480ef5044ab0cb548dcae070327481a9da46c9 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Tue, 7 Feb 2023 13:01:27 +1100
Subject: [PATCH 5/8] fix some missing ABSL_INTERNAL_DLL_TARGETS for shared
Subject: [PATCH 05/11] fix some missing ABSL_INTERNAL_DLL_TARGETS for shared
builds

---
Expand Down Expand Up @@ -54,6 +54,3 @@ index c4a41e6d..c4c92359 100644
"random_internal_mock_overload_set"
"scoped_mock_log"
)
--
2.38.1.windows.1

5 changes: 1 addition & 4 deletions recipe/patches/0006-default-dll-import-for-windows.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From d062fa3db9557ec227a40af6c40727249499022f Mon Sep 17 00:00:00 2001
From: Mark Harfouche <[email protected]>
Date: Sun, 11 Sep 2022 10:32:19 -0400
Subject: [PATCH 6/8] default dll import for windows
Subject: [PATCH 06/11] default dll import for windows

---
absl/base/config.h | 5 ++---
Expand All @@ -24,6 +24,3 @@ index e35d2e48..391da4de 100644
#endif
#else
#define ABSL_DLL
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From dd56821ac6927441e33387072b8dc3c3569644a4 Mon Sep 17 00:00:00 2001
From: Silvio Traversaro <[email protected]>
Date: Wed, 15 Feb 2023 15:55:54 +0100
Subject: [PATCH 7/8] Fix ABSL_PROPAGATE_CXX_STD cmake option
Subject: [PATCH 07/11] Fix ABSL_PROPAGATE_CXX_STD cmake option

---
CMake/AbseilDll.cmake | 6 +++---
Expand Down Expand Up @@ -31,6 +31,3 @@ index c4c92359..1aecd926 100644
endif()

install(TARGETS ${_dll} EXPORT ${PROJECT_NAME}Targets
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
From 4ed51580e60f87f0cdd2024b407aa6688f65c5ef Mon Sep 17 00:00:00 2001
From: Derek Mauro <[email protected]>
Date: Thu, 2 Mar 2023 17:32:02 -0800
Subject: [PATCH 8/8] CMake: Install TESTONLY libraries and their dependencies
when they are built
Subject: [PATCH 08/11] CMake: Install TESTONLY libraries and their
dependencies when they are built

https://github.com/abseil/abseil-cpp/issues/1407

Expand Down Expand Up @@ -136,6 +136,3 @@ index 6d059e7e..f452a676 100644
install(TARGETS ${_NAME} EXPORT ${PROJECT_NAME}Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From bfac9193f2b18fb585747df39c27ff94d3fce01d Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Sun, 7 May 2023 18:24:46 +1100
Subject: [PATCH 09/11] add some necessary source files to
ABSL_INTERNAL_TEST_DLL_FILES

---
CMake/AbseilDll.cmake | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake
index 1aecd926..26078596 100644
--- a/CMake/AbseilDll.cmake
+++ b/CMake/AbseilDll.cmake
@@ -584,6 +584,10 @@ set(ABSL_INTERNAL_TEST_DLL_FILES
"hash/hash_testing.h"
"log/scoped_mock_log.cc"
"log/scoped_mock_log.h"
+ "random/internal/chi_square.cc"
+ "random/internal/chi_square.h"
+ "random/internal/distribution_test_util.cc"
+ "random/internal/distribution_test_util.h"
"random/internal/mock_helpers.h"
"random/internal/mock_overload_set.h"
"random/mocking_bit_gen.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From dd5375ee269b6431c029efd1dae91525cb891492 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Sun, 7 May 2023 20:26:19 +1100
Subject: [PATCH 10/11] update ABSL_CC_TEST_LINKOPTS when using shared build

---
CMake/AbseilHelpers.cmake | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index f452a676..89f6ba9a 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -427,6 +427,10 @@ function(absl_cc_test)
DEPS ${ABSL_CC_TEST_DEPS}
OUTPUT ABSL_CC_TEST_DEPS
)
+ absl_internal_dll_targets(
+ DEPS ${ABSL_CC_TEST_LINKOPTS}
+ OUTPUT ABSL_CC_TEST_LINKOPTS
+ )
else()
target_compile_definitions(${_NAME}
PUBLIC
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 783fdeef3098ba22153507abe0f706505c667897 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Mon, 8 May 2023 11:15:46 +1100
Subject: [PATCH 11/11] make CordzHandle and relevant internal state use
ABSL_DLL

---
absl/strings/internal/cord_internal.cc | 2 +-
absl/strings/internal/cord_internal.h | 2 +-
absl/strings/internal/cordz_handle.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/absl/strings/internal/cord_internal.cc b/absl/strings/internal/cord_internal.cc
index b6b06cfa..f2842511 100644
--- a/absl/strings/internal/cord_internal.cc
+++ b/absl/strings/internal/cord_internal.cc
@@ -33,7 +33,7 @@ ABSL_CONST_INIT std::atomic<bool> cord_ring_buffer_enabled(
kCordEnableRingBufferDefault);
ABSL_CONST_INIT std::atomic<bool> shallow_subcords_enabled(
kCordShallowSubcordsDefault);
-ABSL_CONST_INIT std::atomic<bool> cord_btree_exhaustive_validation(false);
+ABSL_CONST_INIT ABSL_DLL std::atomic<bool> cord_btree_exhaustive_validation(false);

void LogFatalNodeType(CordRep* rep) {
ABSL_INTERNAL_LOG(FATAL, absl::StrCat("Unexpected node type: ",
diff --git a/absl/strings/internal/cord_internal.h b/absl/strings/internal/cord_internal.h
index 63a81f4f..796d4de9 100644
--- a/absl/strings/internal/cord_internal.h
+++ b/absl/strings/internal/cord_internal.h
@@ -73,7 +73,7 @@ extern std::atomic<bool> shallow_subcords_enabled;
// in debug assertions, and code that calls `IsValid()` explicitly. By default,
// assertions should be relatively cheap and AssertValid() can easily lead to
// O(n^2) complexity as recursive / full tree validation is O(n).
-extern std::atomic<bool> cord_btree_exhaustive_validation;
+ABSL_DLL extern std::atomic<bool> cord_btree_exhaustive_validation;

inline void enable_cord_ring_buffer(bool enable) {
cord_ring_buffer_enabled.store(enable, std::memory_order_relaxed);
diff --git a/absl/strings/internal/cordz_handle.h b/absl/strings/internal/cordz_handle.h
index 3c800b43..c4ac7cb8 100644
--- a/absl/strings/internal/cordz_handle.h
+++ b/absl/strings/internal/cordz_handle.h
@@ -34,7 +34,7 @@ namespace cord_internal {
// has gained visibility into a CordzInfo object, that CordzInfo object will not
// be deleted prematurely. This allows the profiler to inspect all CordzInfo
// objects that are alive without needing to hold a global lock.
-class CordzHandle {
+class ABSL_DLL CordzHandle {
public:
CordzHandle() : CordzHandle(false) {}

0 comments on commit eb312bd

Please sign in to comment.