Skip to content

3.20.x #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 118 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
6c8bda8
Suppress warning for intentional circular require
ntkme Feb 27, 2022
aafcb92
kotlin core maven export
deannagarcia Feb 28, 2022
93b4fa6
Only exe extension for windows
deannagarcia Feb 28, 2022
c578f59
Merge pull request #9558 from protocolbuffers/exe-extensions
deannagarcia Feb 28, 2022
933239f
Update build files
deannagarcia Mar 1, 2022
14e445b
Stop passing generation options thru the graph.
thomasvl Feb 28, 2022
d904808
Remove the non prefix validation options from Options.
thomasvl Feb 28, 2022
76ba220
And an overload for ValidateObjCClassPrefixes().
thomasvl Feb 28, 2022
4b0871e
Merge pull request #9560 from protocolbuffers/ktJvmOut
deannagarcia Mar 1, 2022
020e4e3
Simplify imports of the WKTs within the library itself.
thomasvl Mar 1, 2022
2a001f7
Merge pull request #9556 from ntkme/ruby-suppress-warning
haberman Mar 1, 2022
1d13b60
cmake: Use linker version scripts (#9545)
Arfrever Mar 2, 2022
0ece18c
Merge tag 'refs/tags/sync-piper' into sync-stage
acozzette Mar 2, 2022
76398da
Sync from Piper @431959314
acozzette Mar 2, 2022
23b2fe6
Update CHANGES.txt
acozzette Mar 2, 2022
f7232f2
Replace EasyMock dependency with Mockito and re-pin Bazel deps
acozzette Mar 2, 2022
1c51f9f
Undo unintentional file list changes
acozzette Mar 2, 2022
5faa612
Reimplement the type sorter to avoid a ICE in gcc 4.8.2.
acozzette Mar 2, 2022
038b479
Merge pull request #9570 from acozzette/sync-stage
acozzette Mar 2, 2022
5f632be
[editors/emacs] Fix protobuf-mode definition (#9572)
Mar 3, 2022
b0f9799
Sync from Piper @432209397
acozzette Mar 3, 2022
615d214
Update CHANGES.txt
acozzette Mar 3, 2022
e29b4e3
Update Makefile.am with new Python files
acozzette Mar 3, 2022
bb4302e
Add a generation option to control use of forward declarations in hea…
thomasvl Feb 28, 2022
839f0f8
Add missing GSON dependency
acozzette Mar 3, 2022
f59a584
Add new unit test protos to setup.py
acozzette Mar 3, 2022
0a246e2
Merge pull request #9576 from acozzette/sync-stage
acozzette Mar 4, 2022
88a18db
Update protobuf version
acozzette Mar 4, 2022
388df00
Update tests.sh to locally install all Java packages, not just util
acozzette Mar 4, 2022
23e7cfd
Lower minimum CMake version to 3.5 (#9580)
acozzette Mar 4, 2022
aff1304
Update CHANGES.txt for 3.20.0 release (#9581)
acozzette Mar 4, 2022
349d74d
Updated PHP upb, and utf8_range for Ruby/PHP (#9585)
haberman Mar 5, 2022
f2002f6
adding php81 support to release notes (#9590)
brettmc Mar 6, 2022
92cdf87
[C#] fix parse failure for extensions with large field numbers (#9591)
homuler Mar 7, 2022
1cec803
CMake fixes (#9595)
Arfrever Mar 8, 2022
276add0
Add ruby_upb_alloc using xrealloc/xfree so Ruby GC is aware of alloca…
zhangskz Mar 8, 2022
24a0659
[Ruby] allow encode json options to be an object that responds to to_…
lukad Mar 8, 2022
357e716
Merge pull request #9588 from protocolbuffers/master
acozzette Mar 8, 2022
16dccd6
Updated Ruby to the latest upb. (#9589) (#9630)
haberman Mar 14, 2022
2a9f806
update python to 3
esorot Mar 14, 2022
e0cec17
Merge pull request #9632 from esorot/update-python-version
esorot Mar 15, 2022
ebfa0d3
Update protobuf version
esorot Mar 15, 2022
a613353
Merge pull request #9634 from esorot/3.20.x-202203152103
esorot Mar 15, 2022
523d94a
update PHP release to not fail on existing tag
esorot Mar 18, 2022
2099298
Merge pull request #9650 from esorot/php-release-fix
esorot Mar 18, 2022
dbb9619
Cherry-pick to get Ruby 3.1 support in protobuf 3.20.0 (#9657)
haberman Mar 21, 2022
bc799d7
Added missing files and fixed file roles. (#9672)
haberman Mar 24, 2022
25045e3
Update protobuf version
darly Mar 25, 2022
7f9f75f
Merge pull request #9679 from darly/3.20.x-202203251917
darly Mar 25, 2022
faa42e9
Revert "Use repo-relative labels wherever possible (#9187)" (#9696)
acozzette Mar 29, 2022
7fa212b
Fix NPE during encoding and add regression test for issue 9507.
JasonLunn Mar 16, 2022
31a6482
Implement `respond_to?` in RubyMessage (#9677)
JasonLunn Mar 28, 2022
e097b36
Merge pull request #9714 from JasonLunn/3.20.x
jorgbrown Apr 2, 2022
d24edbc
Update protobuf version
mkruskal-google Apr 4, 2022
5edc844
Merge pull request #9727 from mlocati/build-packaged-php-extension
mkruskal-google Apr 5, 2022
803e371
Update protobuf version
mkruskal-google Apr 6, 2022
7db4eca
Update changelogs for 3.20.1-rc1
mkruskal-google Apr 6, 2022
044cb7f
-DfailIfNoSpecifiedTests=false (#9753)
elharo Apr 7, 2022
26d11fd
-Dsurefire.failIfNoSpecifiedTests=false (#9761)
elharo Apr 7, 2022
acd24bc
Add disallowment of setting numpy singleton arrays and multi-dimensio…
zhangskz Apr 14, 2022
653de45
Disable the aarch64 build on macOS because it is broken. (#9816)
haberman Apr 20, 2022
6387f95
fix: move composer.json out of root to avoid confusion (#9819)
bshaffer Apr 20, 2022
296c1fd
Update protobuf version (#9820)
haberman Apr 20, 2022
616a7ef
Updated CHANGES.txt for 3.20.1 (#9826)
haberman Apr 21, 2022
634a568
Fixed PHP release script.
haberman Apr 21, 2022
21027a2
Merge pull request #9832 from haberman/php-dist
haberman Apr 22, 2022
6e9e603
Remove cuda.list from apt sources (#9896) (#9901)
acozzette May 3, 2022
d6ea7fe
Disabling broken mac php tests (#10218)
mkruskal-google Jul 6, 2022
b63fb56
Change composer download
deannagarcia Jul 6, 2022
bd6afa3
Update phpunit version
deannagarcia Jul 8, 2022
fb6f8da
Merge pull request #10225 from deannagarcia/3.20.x
deannagarcia Jul 8, 2022
50bdb17
Fix Kokoro tests to work on Monterey machines (#10474)
mkruskal-google Aug 29, 2022
7639a71
Add version file
deannagarcia Sep 6, 2022
a826282
Merge pull request #10505 from deannagarcia/3.20.x
deannagarcia Sep 6, 2022
c1a2d2e
Fix python release on macos (#10512)
mkruskal-google Sep 7, 2022
22c79e6
Update version.json
deannagarcia Sep 9, 2022
6439c5c
Merge pull request #10531 from protocolbuffers/deannagarcia-patch-7
deannagarcia Sep 12, 2022
b4c395a
Apply patch
deannagarcia Sep 13, 2022
ae718b3
Add missing includes
deannagarcia Sep 13, 2022
806d7e4
Merge pull request #10544 from deannagarcia/3.20.x
mkruskal-google Sep 13, 2022
820f83b
3.20.x 202209131133 (#10550)
mkruskal-google Sep 13, 2022
9bf54e4
3.20.x 202209141109 (#10570)
mkruskal-google Sep 14, 2022
17e4423
Update python/release.sh to handle delay between twine upload and pip…
zhangskz Jul 27, 2022
3f7e84f
Merge pull request #10573 from deannagarcia/3.20.x
deannagarcia Sep 14, 2022
d5d2b81
Remove osx-aarch_64
deannagarcia Sep 16, 2022
0973b7c
Fix spelling
deannagarcia Sep 16, 2022
661b490
Use local artifacts
deannagarcia Sep 16, 2022
274188f
Merge pull request #10601 from deannagarcia/3.20.x
deannagarcia Sep 16, 2022
ca680ef
Merge pull request #10602 from deannagarcia/codespell
deannagarcia Sep 16, 2022
139068b
Merge pull request #10607 from deannagarcia/buildZip20
deannagarcia Sep 16, 2022
ae6d69d
Refactoring Java parsing (3.20.x) (#10666)
mkruskal-google Sep 29, 2022
24b6503
Fix TextFormat parser (#10674)
mkruskal-google Sep 29, 2022
4d837c0
Updating version.json and repo version numbers to: 20.3
protobuf-team-bot Sep 29, 2022
f0e84d7
Updating version.json and repo version numbers to: 20.3
protobuf-team-bot Sep 29, 2022
fe271ab
Updating changelog
shaod2 Sep 29, 2022
483420a
Merge pull request #10678 from protocolbuffers/3.20.x-202209291741
shaod2 Sep 29, 2022
2dcbaea
Update version.json to: 20.4-dev
shaod2 Sep 29, 2022
88af24d
Merge branch '3.20.x' into 3.20.x-202209292242
shaod2 Sep 29, 2022
41fa3b3
Merge pull request #10681 from protocolbuffers/3.20.x-202209292242
shaod2 Sep 30, 2022
5ef5c76
Force uninstall protobuf
deannagarcia Oct 4, 2022
82e2060
Merge pull request #10713 from protocolbuffers/deannagarcia-patch-9
deannagarcia Oct 4, 2022
20e0519
Upgrade kokoro to Xcode 14
deannagarcia Oct 7, 2022
7c896ce
Merge pull request #10733 from protocolbuffers/deannagarcia-patch-12
deannagarcia Oct 7, 2022
9e2e7a8
3.20.x No longer define no_threadlocal on OpenBSD
brad0 Oct 9, 2022
8ed093d
Fix mac builds (#10753)
deannagarcia Oct 10, 2022
57786d1
Merge pull request #10744 from brad0/3.20_openbsd_platform_macros
fowles Oct 10, 2022
9419c52
pin tox to v3.27.1 (to fix kokoro)
ericsalo Dec 9, 2022
7ef0c27
Merge pull request #11233 from ericsalo/3.20.x
ericsalo Dec 9, 2022
5269783
cherry-pick: kokoro git config
protobuf-github-bot Dec 13, 2022
fb257cd
Merge pull request #11284 from esorot/3.20.x
esorot Dec 14, 2022
c182873
Point pyenv at homebrew's zlib (#11316)
mkruskal-google Dec 15, 2022
e03028f
Update iOS version
fowles Dec 15, 2022
7ce9c41
Merge pull request #11322 from protocolbuffers/fowles-patch-1
fowles Dec 16, 2022
797d917
Pin to bundler with ruby 2.5 support
deannagarcia Dec 28, 2022
8d5fded
Merge pull request #11418 from deannagarcia/3.20.x
deannagarcia Dec 28, 2022
53a1c5c
Java fixes for 21.x (#12036) (#12068)
googleberg Feb 27, 2023
011a45a
Remove ruby support
fowles Apr 27, 2023
5a3dac8
Merge pull request #12595 from protocolbuffers/test_ruby_3.20
fowles Apr 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
with:
check_filenames: true
skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal,./.github/workflows/codespell.yml
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin,sur"
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,falsy,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',ro,te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin,sur"
43 changes: 43 additions & 0 deletions .github/workflows/php-ext.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PHP extension

on:
- push
- pull_request

jobs:
build-php:
name: Build PHP extension
runs-on: ubuntu-latest
container: ${{ matrix.php-image }}
strategy:
matrix:
php-image:
- php:7.4-cli
- php:8.1-cli
steps:
- name: Install git
run: |
apt-get update -q
apt-get install -qy --no-install-recommends git
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Prepare source code
run: |
rm -rf "$GITHUB_WORKSPACE/php/ext/google/protobuf/third_party"
cp -r "$GITHUB_WORKSPACE/third_party" "$GITHUB_WORKSPACE/php/ext/google/protobuf"
cp "$GITHUB_WORKSPACE/LICENSE" "$GITHUB_WORKSPACE/php/ext/google/protobuf"
- name: Create package
run: |
cd /tmp
rm -rf protobuf-*.tgz
pecl package "$GITHUB_WORKSPACE/php/ext/google/protobuf/package.xml"
- name: Compile extension
run: |
cd /tmp
MAKE="make -j$(nproc)" pecl install protobuf-*.tgz
- name: Enable extension
run: docker-php-ext-enable protobuf
- name: Inspect extension
run: php --ri protobuf
89 changes: 81 additions & 8 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
2022-09-29 version 3.20.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby)


2022-09-27 version 3.20.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
Java
* Refactoring java full runtime to reuse sub-message builders and prepare to
migrate parsing logic from parse constructor to builder.
* Move proto wireformat parsing functionality from the private "parsing
constructor" to the Builder class.
* Change the Lite runtime to prefer merging from the wireformat into mutable
messages rather than building up a new immutable object before merging. This
way results in fewer allocations and copy operations.
* Make message-type extensions merge from wire-format instead of building up
instances and merging afterwards. This has much better performance.
* Fix TextFormat parser to build up recurring (but supposedly not repeated)
sub-messages directly from text rather than building a new sub-message and
merging the fully formed message into the existing field.

2022-09-13 version 3.20.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby)

C++
* Reduce memory consumption of MessageSet parsing

2022-04-05 version 3.20.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

PHP
* Fix building packaged PHP extension (#9727)
* Fixed composer.json to only advertise compatibility with PHP 7.0+. (#9819)

Ruby
* Disable the aarch64 build on macOS until it can be fixed. (#9816)

Other
* Fix versioning issues in 3.20.0

2022-03-04 version 3.20.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

Ruby
* Dropped Ruby 2.3 and 2.4 support for CI and releases. (#9311)
* Added Ruby 3.1 support for CI and releases (#9566).
* Message.decode/encode: Add recursion_limit option (#9218/#9486)
* Allocate with xrealloc()/xfree() so message allocation is visible to the
Ruby GC. In certain tests this leads to much lower memory usage due to more
frequent GC runs (#9586).
* Fix conversion of singleton classes in Ruby (#9342)
* Suppress warning for intentional circular require (#9556)
* JSON will now output shorter strings for double and float fields when possible
without losing precision.
* Encoding and decoding of binary format will now work properly on big-endian
Expand All @@ -10,36 +53,42 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
putting such values in unknown fields.

Java
* Revert "Standardize on Array copyOf" (#9400)
* Resolve more java field accessor name conflicts (#8198)
* Don't support map fields in DynamicMessage.Builder.{getFieldBuilder,getRepeatedFieldBuilder}
* Fix parseFrom to only throw InvalidProtocolBufferException
* InvalidProtocolBufferException now allows arbitrary wrapped Exception types.
* Fix bug in `FieldSet.Builder.mergeFrom`
* Flush CodedOutputStream also flushes underlying OutputStream
* When oneof case is the same and the field type is Message, merge the
subfield. (previously it was replaced.)’
* add @CheckReturnValue to some protobuf types
* Add @CheckReturnValue to some protobuf types
* Report original exceptions when parsing JSON
* Add more info to @deprecated javadoc for set/get/has methods
* Fix initialization bug in doc comment line numbers
* Fix comments for message set wire format.

Kotlin
* Add orNull extensions for optional message fields in Kotlin.
* Add test scope to kotlin-test for protobuf-kotlin-lite (#9518)
* Add orNull extensions for optional message fields.
* Add orNull extensions to all proto3 message fields.

Python
* Dropped support for Python < 3.7 (#9480)
* Protoc is now able to generate python stubs (.pyi) with --pyi_out
* Pin multibuild scripts to get manylinux1 wheels back (#9216)
* Fix type annotations of some Duration and Timestamp methods.
* Repeated field containers are now generic in field types and could be used
in type annotations.
* Protobuf python generated codes are simplified. Descriptors and message
classes' definitions are now dynamic created in internal/builder.py.
Insertion Points for messages classes are discarded.
* protoc is now able to generate python stub (.pyi) by --gen_pyi
* has_presence is added for FieldDescriptor in python
* Loosen indexing type requirements to allow valid __index__() implementations
rather than only PyLongObjects.
* Fix the deepcopy bug caused by not copying message_listener.
* Added python JSON parse recursion limit (default 100)
* path info is added for python JSON parse errors
* Path info is added for python JSON parse errors
* Pure python repeated scalar fields will not able to pickle. Convert to list
first.
* Timestamp.ToDatetime() now accepts an optional tzinfo parameter. If
Expand All @@ -50,6 +99,9 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Add "ensure_ascii" parameter to json_format.MessageToJson. This allows smaller
JSON serializations with UTF-8 or other non-ASCII encodings.
* Added experimental support for directly assigning numpy scalars and array.
* Improve the calculation of public_dependencies in DescriptorPool.
* [Breaking Change] Disallow setting fields to numpy singleton arrays or repeated fields to numpy
multi-dimensional arrays. Numpy arrays should be indexed or flattened explicitly before assignment.

Compiler
* Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)
Expand Down Expand Up @@ -80,17 +132,38 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Implement on demand register ArenaDtor for InlinedStringField

C++
* manually *struct Cord fields to work better with arenas.
* manually destruct map fields.
* Enable testing via CTest (#8737)
* Add option to use external GTest in CMake (#8736)
* CMake: Set correct sonames for libprotobuf-lite.so and libprotoc.so (#8635) (#9529)
* Add cmake option `protobuf_INSTALL` to not install files (#7123)
* CMake: Allow custom plugin options e.g. to generate mocks (#9105)
* CMake: Use linker version scripts (#9545)
* Manually *struct Cord fields to work better with arenas.
* Manually destruct map fields.
* Generate narrower code
* Fix https://github.com/protocolbuffers/protobuf/issues/9378 by removing
shadowed _cached_size_ field
* Remove GetPointer() and explicit nullptr defaults.
* add proto_h flag for speeding up large builds
* Add proto_h flag for speeding up large builds
* Add missing overload for reference wrapped fields.
* Add MergedDescriptorDatabase::FindAllFileNames()
* RepeatedField now defines an iterator type instead of using a pointer.
* Remove obsolete macros GOOGLE_PROTOBUF_HAS_ONEOF and GOOGLE_PROTOBUF_HAS_ARENAS.

PHP
* Fix: add missing reserved classnames (#9458)
* PHP 8.1 compatibility (#9370)

C#
* Fix trim warnings (#9182)
* Fixes NullReferenceException when accessing FieldDescriptor.IsPacked (#9430)
* Add ToProto() method to all descriptor classes (#9426)
* Add an option to preserve proto names in JsonFormatter (#6307)

Objective-C
* Add prefix_to_proto_package_mappings_path option. (#9498)
* Rename `proto_package_to_prefix_mappings_path` to `package_to_prefix_mappings_path`. (#9552)
* Add a generation option to control use of forward declarations in headers. (#9568)

2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

Expand Down
6 changes: 5 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ java_EXTRA_DIST=
java/core/src/main/java/com/google/protobuf/Internal.java \
java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \
java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java \
java/core/src/main/java/com/google/protobuf/Java8Compatibility.java \
java/core/src/main/java/com/google/protobuf/JavaType.java \
java/core/src/main/java/com/google/protobuf/LazyField.java \
java/core/src/main/java/com/google/protobuf/LazyFieldLite.java \
Expand Down Expand Up @@ -815,10 +816,10 @@ objectivec_EXTRA_DIST= \
Protobuf.podspec

php_EXTRA_DIST= \
composer.json \
php/README.md \
php/REFCOUNTING.md \
php/composer.json \
php/composer.json.dist \
php/ext/google/protobuf/arena.c \
php/ext/google/protobuf/arena.h \
php/ext/google/protobuf/array.c \
Expand Down Expand Up @@ -1037,7 +1038,10 @@ python_EXTRA_DIST= \
python/google/protobuf/internal/factory_test2.proto \
python/google/protobuf/internal/file_options_test.proto \
python/google/protobuf/internal/generator_test.py \
python/google/protobuf/internal/import_test.py \
python/google/protobuf/internal/import_test_package/__init__.py \
python/google/protobuf/internal/import_test_package/import_public.proto \
python/google/protobuf/internal/import_test_package/import_public_nested.proto \
python/google/protobuf/internal/import_test_package/inner.proto \
python/google/protobuf/internal/import_test_package/outer.proto \
python/google/protobuf/internal/json_format_test.py \
Expand Down
2 changes: 1 addition & 1 deletion Protobuf-C++.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
s.version = '3.19.4'
s.version = '3.20.3'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = 'BSD-3-Clause'
Expand Down
2 changes: 1 addition & 1 deletion Protobuf.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
s.version = '3.19.4'
s.version = '3.20.3'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = 'BSD-3-Clause'
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ $(benchmarks_protoc_outputs_proto2_header): protoc_middleman2

initialize_submodule:
oldpwd=`pwd`
cd $(top_srcdir) && git submodule update --init -r third_party/benchmark && \
cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make
cd $(top_srcdir) && git submodule update --init -r third_party/benchmark && cd third_party/benchmark \
&& cmake -DCMAKE_BUILD_TYPE=Release && make
cd $$oldpwd
touch initialize_submodule

Expand Down
28 changes: 26 additions & 2 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Minimum CMake required
cmake_minimum_required(VERSION 3.1.3)
cmake_minimum_required(VERSION 3.5)

if(protobuf_VERBOSE)
message(STATUS "Protocol Buffers Configuring...")
Expand Down Expand Up @@ -127,6 +127,30 @@ if (protobuf_DISABLE_RTTI)
add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
endif()

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map
"{
global:
main;
local:
*;
};")
# CheckLinkerFlag module available in CMake >=3.18.
if(${CMAKE_VERSION} VERSION_GREATER 3.18 OR ${CMAKE_VERSION} VERSION_EQUAL 3.18)
include(CheckLinkerFlag)
check_linker_flag(CXX -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map protobuf_HAVE_LD_VERSION_SCRIPT)
else()
include(CheckCXXSourceCompiles)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map)
check_cxx_source_compiles("
int main() {
return 0;
}
" protobuf_HAVE_LD_VERSION_SCRIPT)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endif()
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map)

find_package(Threads REQUIRED)

set(_protobuf_FIND_ZLIB)
Expand Down Expand Up @@ -182,7 +206,7 @@ else (protobuf_BUILD_SHARED_LIBS)
# Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags
# making programmatic control difficult. Prefer the functionality in newer
# CMake versions when available.
if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15)
if(${CMAKE_VERSION} VERSION_GREATER 3.15 OR ${CMAKE_VERSION} VERSION_EQUAL 3.15)
if (protobuf_MSVC_STATIC_RUNTIME)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
else()
Expand Down
17 changes: 13 additions & 4 deletions cmake/libprotobuf-lite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,21 @@ endif()

add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC}
${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${libprotobuf_lite_rc_files})
target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_HAVE_LD_VERSION_SCRIPT)
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_source_dir}/src/libprotobuf-lite.map)
elseif(protobuf_BUILD_SHARED_LIBS)
target_link_libraries(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_source_dir}/src/libprotobuf-lite.map)
endif()
set_target_properties(libprotobuf-lite PROPERTIES
LINK_DEPENDS ${protobuf_source_dir}/src/libprotobuf-lite.map)
endif()
target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf-lite atomic)
target_link_libraries(libprotobuf-lite PRIVATE atomic)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf-lite log)
target_link_libraries(libprotobuf-lite PRIVATE log)
endif()
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src)
if(protobuf_BUILD_SHARED_LIBS)
Expand All @@ -108,7 +117,7 @@ if(protobuf_BUILD_SHARED_LIBS)
endif()
set_target_properties(libprotobuf-lite PROPERTIES
VERSION ${protobuf_VERSION}
SOVERSION 30
SOVERSION 31
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
19 changes: 14 additions & 5 deletions cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,24 @@ endif()

add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files})
target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_HAVE_LD_VERSION_SCRIPT)
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_source_dir}/src/libprotobuf.map)
elseif(protobuf_BUILD_SHARED_LIBS)
target_link_libraries(libprotobuf PRIVATE -Wl,--version-script=${protobuf_source_dir}/src/libprotobuf.map)
endif()
set_target_properties(libprotobuf PROPERTIES
LINK_DEPENDS ${protobuf_source_dir}/src/libprotobuf.map)
endif()
target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_WITH_ZLIB)
target_link_libraries(libprotobuf ${ZLIB_LIBRARIES})
target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES})
endif()
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf atomic)
target_link_libraries(libprotobuf PRIVATE atomic)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf log)
target_link_libraries(libprotobuf PRIVATE log)
endif()
target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src)
if(protobuf_BUILD_SHARED_LIBS)
Expand All @@ -125,7 +134,7 @@ if(protobuf_BUILD_SHARED_LIBS)
endif()
set_target_properties(libprotobuf PROPERTIES
VERSION ${protobuf_VERSION}
SOVERSION 30
SOVERSION 31
OUTPUT_NAME ${LIB_PREFIX}protobuf
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf ALIAS libprotobuf)
Loading