diff options
| author | Curtis J Bezault <curtbezault@gmail.com> | 2019-04-23 17:05:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-23 17:05:47 -0500 |
| commit | 10283463215417ec006543c4aa5ced65c449061b (patch) | |
| tree | 3f4cd9a02d66f93969b50c1ea7d80bc462463a6e | |
| parent | f439ffed30f8bd0ff12a0c32d283e43a084f3901 (diff) | |
| parent | 49c282da3284bbf14d161c2d6275098b2e4121f2 (diff) | |
| download | vcpkg-10283463215417ec006543c4aa5ced65c449061b.tar.gz vcpkg-10283463215417ec006543c4aa5ced65c449061b.zip | |
Merge pull request #6165 from xuhongxu96/grpc-static-linux
[grpc] Supported static linking in Linux
| -rw-r--r-- | ports/grpc/00001-fix-uwp.patch (renamed from ports/grpc/fix-uwp.patch) | 0 | ||||
| -rw-r--r-- | ports/grpc/00002-static-linking-in-linux.patch | 16 | ||||
| -rw-r--r-- | ports/grpc/CONTROL | 2 | ||||
| -rw-r--r-- | ports/grpc/portfile.cmake | 11 |
4 files changed, 27 insertions, 2 deletions
diff --git a/ports/grpc/fix-uwp.patch b/ports/grpc/00001-fix-uwp.patch index 1811fdf92..1811fdf92 100644 --- a/ports/grpc/fix-uwp.patch +++ b/ports/grpc/00001-fix-uwp.patch diff --git a/ports/grpc/00002-static-linking-in-linux.patch b/ports/grpc/00002-static-linking-in-linux.patch new file mode 100644 index 000000000..4c004d16b --- /dev/null +++ b/ports/grpc/00002-static-linking-in-linux.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3839e22..91720a9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -99,6 +99,11 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+
+ add_definitions(-DPB_FIELD_32BIT)
+
++if (gRPC_STATIC_LINKING)
++ # Force to static link
++ set(CMAKE_EXE_LINKER_FLAGS "-Bstatic")
++endif()
++
+ if (MSVC)
+ include(cmake/msvc_static_runtime.cmake)
+ add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)
diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL index f1b1d9798..025227d09 100644 --- a/ports/grpc/CONTROL +++ b/ports/grpc/CONTROL @@ -1,4 +1,4 @@ Source: grpc -Version: 1.19.1 +Version: 1.19.1-1 Build-Depends: zlib, openssl, protobuf, c-ares (!uwp) Description: An RPC library and framework diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index 355f9a179..e11586258 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -14,7 +14,9 @@ vcpkg_from_github( REF v1.19.1 SHA512 4bb127d946fc16887fd4cf75215f0bc9f6d17dbd36fc4f1b191a64914f96c49dddb41f1b6c72fd24ea0a40f242b4398248f32fcb1fe9a764367be1c2edda9142 HEAD_REF master - PATCHES fix-uwp.patch + PATCHES + 00001-fix-uwp.patch + 00002-static-linking-in-linux.patch ) if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") @@ -29,6 +31,12 @@ else() set(gRPC_MSVC_STATIC_RUNTIME OFF) endif() +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(gRPC_STATIC_LINKING ON) +else() + set(gRPC_STATIC_LINKING OFF) +endif() + if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") set(cares_CARES_PROVIDER OFF) else() @@ -41,6 +49,7 @@ vcpkg_configure_cmake( OPTIONS -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF + -DgRPC_STATIC_LINKING=${gRPC_STATIC_LINKING} -DgRPC_MSVC_STATIC_RUNTIME=${gRPC_MSVC_STATIC_RUNTIME} -DgRPC_ZLIB_PROVIDER=package -DgRPC_SSL_PROVIDER=package |
