Skip to content

Commit

Permalink
protobuf: fix deps problem, allow disabling install
Browse files Browse the repository at this point in the history
* Now dependency from abseil is correctly carried to 'upstream' project
  when building protobuf as subproject
* Allow disabling installation. This patch adds new option
  'should_install' and uses it as value for 'install' argument
  in all appropriate meson invocation. The intended use is to disable
  installing protobuf when it is bundled as subproject.
  • Loading branch information
Artem Serebriyskiy authored and neheb committed Feb 9, 2024
1 parent d58a7a7 commit 3d2e13e
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 254 deletions.
1 change: 1 addition & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -2551,6 +2551,7 @@
"protoc"
],
"versions": [
"25.2-2",
"25.2-1",
"3.21.12-5",
"3.21.12-4",
Expand Down
18 changes: 11 additions & 7 deletions subprojects/packagefiles/protobuf/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cc = meson.get_compiler('cpp')

is_shared = (get_option('default_library') != 'static')
is_msvc = (cc.get_argument_syntax() == 'msvc')
should_install = get_option('install')

if is_msvc
add_project_arguments(
Expand Down Expand Up @@ -109,7 +110,7 @@ libprotobuf_lite = library(
gnu_symbol_visibility: 'hidden',
version: meson.project_version(),
soversion: 25,
install: true,
install: should_install,
include_directories: incdir,
)
imp = is_shared ? ['-DPROTOBUF_USE_DLLS'] : []
Expand Down Expand Up @@ -208,13 +209,14 @@ libprotobuf = library(
gnu_symbol_visibility: 'hidden',
version: meson.project_version(),
soversion: 25,
install: true,
install: should_install,
include_directories: incdir,
)
protobuf_dep = declare_dependency(
compile_args: imp,
link_with: libprotobuf,
include_directories: incdir,
dependencies: deps,
)

libprotoc_src = files(
Expand Down Expand Up @@ -337,17 +339,19 @@ libprotoc = library(
dependencies: [protobuf_dep, deps],
version: meson.project_version(),
soversion: 25,
install: true,
install: should_install,
)
protoc_dep = declare_dependency(
compile_args: imp,
dependencies: protobuf_dep,
link_with: libprotoc,
)

pkg = import('pkgconfig')
pkg.generate(libprotobuf_lite, description: 'Google\'s Data Interchange Format')
pkg.generate(libprotobuf, description: 'Google\'s Data Interchange Format')
pkg.generate(libprotoc)
if should_install
pkg = import('pkgconfig')
pkg.generate(libprotobuf_lite, description: 'Google\'s Data Interchange Format')
pkg.generate(libprotobuf, description: 'Google\'s Data Interchange Format')
pkg.generate(libprotoc)
endif

subdir('src')
2 changes: 2 additions & 0 deletions subprojects/packagefiles/protobuf/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
option('install', type: 'boolean', value: true)

Loading

0 comments on commit 3d2e13e

Please sign in to comment.