Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3346,6 +3346,7 @@
"protoc"
],
"versions": [
"25.2-4",
"25.2-3",
"25.2-2",
"25.2-1",
Expand Down
39 changes: 37 additions & 2 deletions subprojects/packagefiles/protobuf/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'default_library=static',
'cpp_std=c++17',
],
meson_version: '>=0.63.0',

Check notice on line 15 in subprojects/packagefiles/protobuf/meson.build

View workflow job for this annotation

GitHub Actions / Ubuntu (x86_64)

Minimum Meson version is 0.63.0

0.38.0: default_options arg in dependency 0.46.0: meson.override_find_program, pkgconfig.generate optional positional argument 0.48.0: gnu_symbol_visibility arg in library 0.49.0: compiler.get_argument_syntax 0.63.0: preserve_path arg in install_headers, cpp_std in subproject default_options
)

cc = meson.get_compiler('cpp')
Expand All @@ -37,6 +37,39 @@
default_options: ['cpp_std=c++17'],
)

if meson.version().version_compare('>=1.7.0')
atomic_dep = dependency(
'atomic',
required: false,
)
else
atomic_dep = cc.find_library(
'atomic',
required: false,
)
endif

# Make reasonable effort (volatile) to prevent the compiler from optimizing the atomic away without using tested
# functionality.
if not cc.links(
'''
#include <atomic>
#include <cstdint>

int main() {
volatile std::atomic<std::uint64_t> testvar;
// The line below will lead to
// undefined reference to `__atomic_fetch_add_8'
// on armv6l to give an example.
volatile auto unused = testvar.fetch_add(0);
}
''',
name: 'Check if libatomic is required',
dependencies: atomic_dep,
)
error('Host machine cannot handle atomics!')
endif

deps = [
dependency('absl_base'),
dependency('absl_cord'),
Expand All @@ -58,6 +91,7 @@
'dbghelp',
required: host_machine.system() == 'windows',
),
atomic_dep,
]

incdir = include_directories('src')
Expand Down Expand Up @@ -136,6 +170,7 @@
compile_args: imp,
link_with: libprotobuf_lite,
include_directories: incdir,
dependencies: atomic_dep,
)

libprotobuf_src = files(
Expand Down Expand Up @@ -218,8 +253,8 @@
'src/google/protobuf/wrappers.pb.cc',
)
libprotobuf_linker_args = (is_msvc ? [
'/export:??$MergeFrom@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@RepeatedPtrFieldBase@internal@protobuf@google@@QEAAXAEBV0123@@Z',
] : []
'/export:??$MergeFrom@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@RepeatedPtrFieldBase@internal@protobuf@google@@QEAAXAEBV0123@@Z',
] : []
)
libprotobuf = library(
'protobuf',
Expand Down
Loading