Skip to content
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

[protobuf] Fix the default proto file path #15246

Merged
merged 2 commits into from
Dec 28, 2020
Merged
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 ports/protobuf/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Source: protobuf
Version: 3.14.0
Port-Version: 1
Homepage: https://github.com/protocolbuffers/protobuf
Description: Protocol Buffers - Google's data interchange format

Expand Down
20 changes: 20 additions & 0 deletions ports/protobuf/fix-default-proto-file-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc
index f192ae6..22900ed 100644
--- a/src/google/protobuf/compiler/command_line_interface.cc
+++ b/src/google/protobuf/compiler/command_line_interface.cc
@@ -260,11 +260,15 @@ void AddDefaultProtoPaths(
return;
}
// Check if the upper level directory has an "include" subdirectory.
+ // change "'$/bin' is next to 'include'" assumption to "'$/bin/tools' is next to 'include'"
+ for (int i = 0; i < 2; i++)
+ {
pos = path.find_last_of("/\\");
if (pos == std::string::npos || pos == 0) {
return;
}
path = path.substr(0, pos);
+ }
if (IsInstalledProtoPath(path + "/include")) {
paths->push_back(
std::pair<std::string, std::string>("", path + "/include"));
1 change: 1 addition & 0 deletions ports/protobuf/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix-static-build.patch
fix-default-proto-file-path.patch
)

if(CMAKE_HOST_WIN32 AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND NOT VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
Expand Down