From 2c2eaf32816a1bb6ac937651b8c2150918facd6f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 10 Jun 2026 05:24:12 +0000 Subject: [PATCH 1/4] deps: vendor Abseil and update re2 to 2025-11-05 re2 was pinned to c9cba76 (~2023-06-01), the last release before re2 migrated its codebase onto Abseil. Our in-tree build compiles re2's sources directly rather than through its own CMake, so we couldn't move past that version without providing Abseil. Vendor abseil-cpp (20250512.1, the version re2 2025-11-05 declares in its MODULE.bazel) as a submodule and build it via add_subdirectory, like the other CMake-based dependencies (rubberband, libremidi). re2 is bumped to 2025-11-05 and now links the Abseil targets listed in its own ABSL_DEPS. stringpiece.cc is dropped (removed upstream; re2::StringPiece is now an alias for absl::string_view). --- .gitmodules | 3 +++ 3rdparty/abseil-cpp | 1 + 3rdparty/re2 | 2 +- cmake/OssiaDeps.cmake | 2 ++ cmake/deps/abseil.cmake | 30 ++++++++++++++++++++++++++++++ cmake/deps/re2.cmake | 22 +++++++++++++++++++++- 6 files changed, 58 insertions(+), 2 deletions(-) create mode 160000 3rdparty/abseil-cpp create mode 100644 cmake/deps/abseil.cmake diff --git a/.gitmodules b/.gitmodules index 9c346b9a0a3..b8303966b35 100644 --- a/.gitmodules +++ b/.gitmodules @@ -127,3 +127,6 @@ [submodule "3rdparty/rapidhash"] path = 3rdparty/rapidhash url = https://github.com/Nicoshev/rapidhash +[submodule "3rdparty/abseil-cpp"] + path = 3rdparty/abseil-cpp + url = https://github.com/abseil/abseil-cpp diff --git a/3rdparty/abseil-cpp b/3rdparty/abseil-cpp new file mode 160000 index 00000000000..76bb24329e8 --- /dev/null +++ b/3rdparty/abseil-cpp @@ -0,0 +1 @@ +Subproject commit 76bb24329e8bf5f39704eb10d21b9a80befa7c81 diff --git a/3rdparty/re2 b/3rdparty/re2 index c9cba76063c..927f5d53caf 160000 --- a/3rdparty/re2 +++ b/3rdparty/re2 @@ -1 +1 @@ -Subproject commit c9cba76063cf4235c1a15dd14a24a4ef8d623761 +Subproject commit 927f5d53caf8111721e734cf24724686bb745f55 diff --git a/cmake/OssiaDeps.cmake b/cmake/OssiaDeps.cmake index ae7cedf48ac..3b5f3de885f 100644 --- a/cmake/OssiaDeps.cmake +++ b/cmake/OssiaDeps.cmake @@ -3,6 +3,7 @@ find_package(Git) if(Git_FOUND AND OSSIA_SUBMODULE_AUTOUPDATE) message(STATUS "Update general libossia dependencies :") set(OSSIA_SUBMODULES + abseil-cpp concurrentqueue compile-time-regular-expressions Flicks @@ -85,6 +86,7 @@ if(Git_FOUND AND OSSIA_SUBMODULE_AUTOUPDATE) endif() # Download various dependencies +include(deps/abseil) include(deps/boost) include(deps/concurrentqueue) include(deps/ctre) diff --git a/cmake/deps/abseil.cmake b/cmake/deps/abseil.cmake new file mode 100644 index 00000000000..00c5d6ae739 --- /dev/null +++ b/cmake/deps/abseil.cmake @@ -0,0 +1,30 @@ +if(OSSIA_USE_SYSTEM_LIBRARIES) + find_package(absl CONFIG GLOBAL QUIET) +endif() + +# Abseil is pulled in as a dependency of re2 (see deps/re2.cmake). +# We build the in-tree copy through its own CMake build, like the other +# add_subdirectory-based dependencies (rubberband, libremidi, ...). +if(NOT TARGET absl::strings) + block() + set(BUILD_SHARED_LIBS 0) + set(BUILD_TESTING 0) + set(ABSL_BUILD_TESTING OFF CACHE INTERNAL "") + set(ABSL_PROPAGATE_CXX_STD ON CACHE INTERNAL "") + # Treat Abseil's headers as system headers so that re2 (and ossia) do not + # get flooded with warnings coming from them. + set(ABSL_USE_SYSTEM_INCLUDES ON CACHE INTERNAL "") + + # When we install our static dependencies, re2 links Abseil publicly, so its + # targets must be installable/exportable too. + if(OSSIA_INSTALL_STATIC_DEPENDENCIES) + set(ABSL_ENABLE_INSTALL ON CACHE INTERNAL "") + endif() + + add_subdirectory("${OSSIA_3RDPARTY_FOLDER}/abseil-cpp" EXCLUDE_FROM_ALL) + endblock() +endif() + +if(TARGET absl::strings) + set(OSSIA_HAS_ABSEIL 1 CACHE INTERNAL "") +endif() diff --git a/cmake/deps/re2.cmake b/cmake/deps/re2.cmake index a3b5724944e..2948f41e880 100644 --- a/cmake/deps/re2.cmake +++ b/cmake/deps/re2.cmake @@ -32,7 +32,6 @@ else() ${OSSIA_3RDPARTY_FOLDER}/re2/re2/regexp.cc ${OSSIA_3RDPARTY_FOLDER}/re2/re2/set.cc ${OSSIA_3RDPARTY_FOLDER}/re2/re2/simplify.cc - ${OSSIA_3RDPARTY_FOLDER}/re2/re2/stringpiece.cc ${OSSIA_3RDPARTY_FOLDER}/re2/re2/tostring.cc ${OSSIA_3RDPARTY_FOLDER}/re2/re2/unicode_casefold.cc ${OSSIA_3RDPARTY_FOLDER}/re2/re2/unicode_groups.cc @@ -55,6 +54,27 @@ else() target_include_directories(re2 SYSTEM PUBLIC $) + # Since 2023-07-01, re2 depends on Abseil (see deps/abseil.cmake which is + # included before this file). This is the set of targets listed in re2's own + # CMakeLists.txt (ABSL_DEPS). + target_link_libraries(re2 PUBLIC + absl::absl_check + absl::absl_log + absl::base + absl::core_headers + absl::fixed_array + absl::flags + absl::flat_hash_map + absl::flat_hash_set + absl::hash + absl::inlined_vector + absl::optional + absl::span + absl::str_format + absl::strings + absl::synchronization + ) + if(UNIX) target_link_libraries(re2 PUBLIC Threads::Threads) endif() From 9eb0995bf079456e5b6ba6a967753ea4d92b8fb0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 10 Jun 2026 08:24:20 +0000 Subject: [PATCH 2/4] deps: rename span target to ossia_span to avoid Abseil clash When ABSL_ENABLE_INSTALL is ON (static-dependency installs), Abseil drops its absl_ prefix and registers a bare "span" target (alias absl::span), which collided with libossia's own imported "span" target and broke all OSSIA_STATIC configure runs. Rename the backing target to ossia_span and keep the span::span alias that consumers actually use. --- cmake/deps/span.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/deps/span.cmake b/cmake/deps/span.cmake index 180ea3f2399..2816bbce181 100644 --- a/cmake/deps/span.cmake +++ b/cmake/deps/span.cmake @@ -2,8 +2,12 @@ if(OSSIA_USE_SYSTEM_LIBRARIES) find_package(span CONFIG GLOBAL) endif() +# NB: the backing target is named "ossia_span" rather than "span" to avoid a +# clash with Abseil, which registers an un-prefixed "span" target (alias +# absl::span) when ABSL_ENABLE_INSTALL is ON (see deps/abseil.cmake). Consumers +# use the span::span alias. if(NOT TARGET span::span) - add_library(span INTERFACE IMPORTED GLOBAL) - add_library(span::span ALIAS span) - target_include_directories(span INTERFACE "$") + add_library(ossia_span INTERFACE IMPORTED GLOBAL) + add_library(span::span ALIAS ossia_span) + target_include_directories(ossia_span INTERFACE "$") endif() From b88123fa8b4699d1dde43db5fe510b7f784bdb36 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 10 Jun 2026 08:35:26 +0000 Subject: [PATCH 3/4] deps: make static install of re2/Abseil export-consistent The static matrix (OSSIA_STATIC -> OSSIA_INSTALL_STATIC_DEPENDENCIES) failed at CMake generate time: export called with target "re2" which requires target "strings" that is not in any export set. Three fixes: - re2.cmake: drop the build-tree export(EXPORT re2-exports). re2 links Abseil publicly and Abseil only ships install(EXPORT) rules, not a build-tree export(), so the build-tree export of re2 cannot be generated. Only the installed re2 export is consumed (ossiaConfig.cmake.in). - abseil.cmake: don't add the Abseil subdir with EXCLUDE_FROM_ALL when installing static dependencies - CMake skips install() rules of such subdirs, so Abseil's libs/headers/config were never installed, leaving the installed re2 export dangling. - ossiaConfig.cmake.in: find_dependency(absl) before including the re2 export so downstream static consumers resolve absl::*. --- cmake/deps/abseil.cmake | 12 ++++++++++-- cmake/deps/re2.cmake | 5 ++++- cmake/ossiaConfig.cmake.in | 3 +++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cmake/deps/abseil.cmake b/cmake/deps/abseil.cmake index 00c5d6ae739..ebf83fe74b3 100644 --- a/cmake/deps/abseil.cmake +++ b/cmake/deps/abseil.cmake @@ -19,9 +19,17 @@ if(NOT TARGET absl::strings) # targets must be installable/exportable too. if(OSSIA_INSTALL_STATIC_DEPENDENCIES) set(ABSL_ENABLE_INSTALL ON CACHE INTERNAL "") - endif() - add_subdirectory("${OSSIA_3RDPARTY_FOLDER}/abseil-cpp" EXCLUDE_FROM_ALL) + # NB: no EXCLUDE_FROM_ALL here. CMake skips the install() rules of a + # subdirectory added with EXCLUDE_FROM_ALL, so Abseil's libraries, + # headers and CMake package (abslConfig / abslTargets) would never be + # installed - leaving the installed re2 export (which links Abseil + # publicly) dangling for downstream consumers. Building all of Abseil is + # acceptable here as this branch is only taken for static packaging builds. + add_subdirectory("${OSSIA_3RDPARTY_FOLDER}/abseil-cpp") + else() + add_subdirectory("${OSSIA_3RDPARTY_FOLDER}/abseil-cpp" EXCLUDE_FROM_ALL) + endif() endblock() endif() diff --git a/cmake/deps/re2.cmake b/cmake/deps/re2.cmake index 2948f41e880..06f7b2c64b9 100644 --- a/cmake/deps/re2.cmake +++ b/cmake/deps/re2.cmake @@ -88,7 +88,10 @@ else() install(EXPORT re2-exports DESTINATION lib/cmake/re2) - export(EXPORT re2-exports) + # NB: no build-tree export() here. re2 links Abseil publicly and Abseil only + # provides install(EXPORT) rules, not a build-tree export(), so a build-tree + # export() of re2 fails at generate time ("target ... not in any export + # set"). Only the installed re2 export is consumed (see ossiaConfig.cmake.in). endif() endif() diff --git a/cmake/ossiaConfig.cmake.in b/cmake/ossiaConfig.cmake.in index ab5da7532bc..75c7fba2f9a 100644 --- a/cmake/ossiaConfig.cmake.in +++ b/cmake/ossiaConfig.cmake.in @@ -7,6 +7,9 @@ find_dependency(Boost 1.83 REQUIRED) if(@OSSIA_STATIC@) if(EXISTS "${OSSIA_CMAKE_DIR}/../re2/re2-exports.cmake") + # re2 links Abseil publicly, so its targets must be resolved before the re2 + # export (which references absl::*) is pulled in. + find_dependency(absl) include("${OSSIA_CMAKE_DIR}/../re2/re2-exports.cmake") endif() endif() From 4f126a61de1fc602d64435e95c6628bcbc197a80 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 10 Jun 2026 08:46:27 +0000 Subject: [PATCH 4/4] deps: match Abseil's MSVC runtime to ossia's Abseil's CMakeLists overrides CMAKE_MSVC_RUNTIME_LIBRARY from its own ABSL_MSVC_STATIC_RUNTIME option (default OFF -> /MD dynamic), ignoring the runtime selected by the enclosing build. Static ossia builds (Max/PD/Python/ Unity) force the static /MT runtime, so Abseil's /MD objects fail to link: absl_*.lib(...) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' Set ABSL_MSVC_STATIC_RUNTIME to mirror CMAKE_MSVC_RUNTIME_LIBRARY so the two agree. --- cmake/deps/abseil.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/deps/abseil.cmake b/cmake/deps/abseil.cmake index ebf83fe74b3..bfa14ebebee 100644 --- a/cmake/deps/abseil.cmake +++ b/cmake/deps/abseil.cmake @@ -15,6 +15,17 @@ if(NOT TARGET absl::strings) # get flooded with warnings coming from them. set(ABSL_USE_SYSTEM_INCLUDES ON CACHE INTERNAL "") + # Abseil's CMakeLists forcibly overrides CMAKE_MSVC_RUNTIME_LIBRARY from its + # own ABSL_MSVC_STATIC_RUNTIME option (default OFF -> /MD), ignoring what the + # rest of the build selected. Static ossia builds (Max/PD/Python/Unity, ...) + # use the static /MT runtime, which then mismatches Abseil's /MD at link + # time. Mirror ossia's choice so the runtimes agree. + if(MSVC AND CMAKE_MSVC_RUNTIME_LIBRARY AND NOT CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL") + set(ABSL_MSVC_STATIC_RUNTIME ON CACHE INTERNAL "") + else() + set(ABSL_MSVC_STATIC_RUNTIME OFF CACHE INTERNAL "") + endif() + # When we install our static dependencies, re2 links Abseil publicly, so its # targets must be installable/exportable too. if(OSSIA_INSTALL_STATIC_DEPENDENCIES)