Skip to content

Commit 856c811

Browse files
authored
Update ProtoBuf to 33.0 and apply build patch (#1926)
* Update to Protocol Buffers v32.1 * Enable build of libupb * Enable ProtoBuf verbose mode * Disable Protobuf verbose mode * Address git warnings * Update ProtoBuf to v33.0 * Apply ProtoBuf Atomic patch * Fix patch directory location
1 parent c0355a0 commit 856c811

File tree

6 files changed

+43
-8
lines changed

6 files changed

+43
-8
lines changed

.github/workflows/debian.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
uses: actions/checkout@v5
5454
with:
5555
submodules: recursive
56+
fetch-depth: 0 # Ensures all tags are fetched
5657

5758
- name: 🔧 Prepare
5859
shell: bash
@@ -85,9 +86,11 @@ jobs:
8586
-e LANG="C.UTF-8" \
8687
-e LC_ALL="C.UTF-8" \
8788
ghcr.io/hyperion-project/debian:${{ env.DOCKER_TAG }} \
88-
/bin/bash -c "cmake --preset linux-${{ env.BUILD_TYPE }} ${{ steps.dependencies.outputs.cmakeArgs }} -DPLATFORM=${{ matrix.os.platform }} ${{ env.CPACK_SYSTEM_PROCESSOR }} &&
89-
cmake --build --preset linux-${{ env.BUILD_TYPE }} --target package &&
90-
cp /source/build/Hyperion-* /deploy/ 2>/dev/null"
89+
/bin/bash -c "
90+
git config --global --add safe.directory /source &&
91+
cmake --preset linux-${{ env.BUILD_TYPE }} ${{ steps.dependencies.outputs.cmakeArgs }} -DPLATFORM=${{ matrix.os.platform }} ${{ env.CPACK_SYSTEM_PROCESSOR }} &&
92+
cmake --build --preset linux-${{ env.BUILD_TYPE }} --target package &&
93+
cp /source/build/Hyperion-* /deploy/ 2>/dev/null"
9194
env:
9295
DOCKER_TAG: ${{ inputs.codename == 'bullseye' && matrix.os.architecture[0] == 'armv6' && inputs.codename || format('{0}-qt6', inputs.codename) }}
9396
BUILD_TYPE: ${{ inputs.event_name == 'pull_request' && 'debug' || 'release' }}

.github/workflows/macos.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ jobs:
4242
- name: ⬇ Checkout
4343
uses: actions/checkout@v5
4444
with:
45-
submodules: recursive
45+
submodules: recursive
46+
fetch-depth: 0 # Ensures all tags are fetched
4647

4748
- name: 🔧 Prepare
4849
shell: bash

.github/workflows/windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
uses: actions/checkout@v5
4444
with:
4545
submodules: recursive
46+
fetch-depth: 0 # Ensures all tags are fetched
4647

4748
- name: 🔧 Prepare
4849
shell: bash

dependencies/CMakeLists.txt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ if(ENABLE_PROTOBUF_SERVER)
424424
endif()
425425

426426
if(NOT USE_SYSTEM_PROTO_LIBS)
427+
428+
# Enable ProtoBuf verbose mode
429+
set(protobuf_VERBOSE OFF CACHE BOOL "Build protobuf verbose")
430+
427431
# Build Protobuf as static library
428432
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Build protobuf shared")
429433

@@ -433,8 +437,11 @@ if(ENABLE_PROTOBUF_SERVER)
433437
# Disable build of Protobuf with zlib support
434438
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib support")
435439

436-
# Disable build of libupb
437-
set(protobuf_BUILD_LIBUPB OFF CACHE BOOL "Build libupb")
440+
# Enable build of libupb
441+
set(protobuf_BUILD_LIBUPB ON CACHE BOOL "Build libupb")
442+
443+
# Force all dependencies to be downloaded from GitHub
444+
set(protobuf_FORCE_FETCH_DEPENDENCIES ON CACHE INTERNAL "Force all dependencies to be downloaded from GitHub")
438445

439446
# Build abeil (3rd party sub-module) with C++ version requirements
440447
set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Build abseil-cpp with C++ version requirements propagated")
@@ -458,8 +465,15 @@ if(ENABLE_PROTOBUF_SERVER)
458465
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protobuf libraries and protoc compiler")
459466
endif()
460467

468+
include(FetchContent)
469+
461470
# Add Protobuf directory to the build
462-
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf")
471+
FetchContent_Declare(
472+
protobuf
473+
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf"
474+
PATCH_COMMAND git apply "${CMAKE_CURRENT_SOURCE_DIR}/patch/protobuf/atomic.diff"
475+
)
476+
FetchContent_MakeAvailable(protobuf)
463477

464478
if(CMAKE_CROSSCOMPILING)
465479
if(IMPORT_PROTOC)
@@ -472,6 +486,7 @@ if(ENABLE_PROTOBUF_SERVER)
472486
PREFIX ${CMAKE_BINARY_DIR}/dependencies/external/protoc-host
473487
BUILD_ALWAYS OFF
474488
DOWNLOAD_COMMAND ""
489+
PATCH_COMMAND git apply "${CMAKE_CURRENT_SOURCE_DIR}/patch/protobuf/atomic.diff"
475490
INSTALL_COMMAND ""
476491
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf
477492
CMAKE_ARGS -Dprotobuf_BUILD_LIBPROTOC:BOOL=OFF

dependencies/external/protobuf

Submodule protobuf updated 1979 files
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/cmake/protobuf-configure-target.cmake b/cmake/protobuf-configure-target.cmake
2+
index c67c57056..171e0a8f0 100644
3+
--- a/cmake/protobuf-configure-target.cmake
4+
+++ b/cmake/protobuf-configure-target.cmake
5+
@@ -7,8 +7,8 @@
6+
7+
# Refactors configuration options set on all Protobuf targets
8+
function(protobuf_configure_target target)
9+
- if(protobuf_LINK_LIBATOMIC)
10+
- target_link_libraries(libprotobuf PRIVATE atomic)
11+
+ if(protobuf_LINK_LIBATOMIC AND "${target}" STREQUAL "libprotobuf")
12+
+ target_link_libraries("${target}" PRIVATE atomic)
13+
endif()
14+
15+
target_compile_features("${target}" PUBLIC cxx_std_17)

0 commit comments

Comments
 (0)