aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-07-14 12:45:04 -0700
committerGitHub <noreply@github.com>2017-07-14 12:45:04 -0700
commit2055a9cd4490861aa7ce9e1af23c0232f97552c9 (patch)
tree90a84757959e03a3cc7cc52b190a82db3c7dfb39
parent6950aeb6378adb47ff467a79d58ae8d4b5abe9cb (diff)
parent294b56c593c70107fcb6829bd66c03ee10c0ca71 (diff)
downloadvcpkg-2055a9cd4490861aa7ce9e1af23c0232f97552c9.tar.gz
vcpkg-2055a9cd4490861aa7ce9e1af23c0232f97552c9.zip
Merge pull request #1377 from FinancedHydra/fix-uwp-protobuf
Disable protobuf compiler on UWP
-rw-r--r--ports/protobuf/001-add-compiler-flag.patch65
-rw-r--r--ports/protobuf/portfile.cmake10
2 files changed, 75 insertions, 0 deletions
diff --git a/ports/protobuf/001-add-compiler-flag.patch b/ports/protobuf/001-add-compiler-flag.patch
new file mode 100644
index 000000000..aec510f44
--- /dev/null
+++ b/ports/protobuf/001-add-compiler-flag.patch
@@ -0,0 +1,65 @@
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index 7618ba21..bd92b09d 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -165,8 +165,11 @@ endif (protobuf_UNICODE)
+
+ include(libprotobuf-lite.cmake)
+ include(libprotobuf.cmake)
+-include(libprotoc.cmake)
+-include(protoc.cmake)
++
++if(protobuf_BUILD_COMPILER)
++ include(libprotoc.cmake)
++ include(protoc.cmake)
++endif()
+
+ if (protobuf_BUILD_TESTS)
+ include(tests.cmake)
+diff --git a/cmake/install.cmake b/cmake/install.cmake
+index 28dc90dc..52c1f721 100644
+--- a/cmake/install.cmake
++++ b/cmake/install.cmake
+@@ -1,9 +1,12 @@
+ include(GNUInstallDirs)
+
++set(LIBRARIES_TO_SET_DEST libprotobuf-lite libprotobuf)
++if(protobuf_BUILD_COMPILER)
++ list(APPEND LIBRARIES_TO_SET_DEST libprotoc)
++endif()
++
+ foreach(_library
+- libprotobuf-lite
+- libprotobuf
+- libprotoc)
++ ${LIBRARIES_TO_SET_DEST})
+ set_property(TARGET ${_library}
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+ $<BUILD_INTERFACE:${protobuf_source_dir}/src>
+@@ -14,8 +17,10 @@ foreach(_library
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
+ endforeach()
+
+-install(TARGETS protoc EXPORT protobuf-targets
+- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
++if(protobuf_BUILD_COMPILER)
++ install(TARGETS protoc EXPORT protobuf-targets
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
++endif()
+
+ file(STRINGS extract_includes.bat.in _extract_strings
+ REGEX "^copy")
+@@ -94,7 +99,12 @@ configure_file(protobuf-options.cmake
+ ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
+
+ # Allows the build directory to be used as a find directory.
+-export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
++set(FIND_DIRS libprotobuf-lite libprotobuf)
++if(protobuf_BUILD_COMPILER)
++ list(APPEND FIND_DIRS libprotoc protoc)
++endif()
++
++export(TARGETS ${FIND_DIRS}
+ NAMESPACE protobuf::
+ FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
+ )
diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake
index 07b7ea3aa..fa81e0542 100644
--- a/ports/protobuf/portfile.cmake
+++ b/ports/protobuf/portfile.cmake
@@ -20,14 +20,23 @@ vcpkg_extract_source_archive(${ARCHIVE_FILE})
# Patch to fix the missing export of fixed_address_empty_string,
# see https://github.com/google/protobuf/pull/3216
+# Add a flag that can be set to disable the protobuf compiler
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-fix-missing-export.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/001-add-compiler-flag.patch"
)
vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${TOOL_PATH})
+# Disable the protobuf compiler when targeting UWP
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ set(protobuf_BUILD_COMPILER OFF)
+else()
+ set(protobuf_BUILD_COMPILER ON)
+endif()
+
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(protobuf_BUILD_SHARED_LIBS ON)
else()
@@ -47,6 +56,7 @@ vcpkg_configure_cmake(
-Dprotobuf_MSVC_STATIC_RUNTIME=${protobuf_MSVC_STATIC_RUNTIME}
-Dprotobuf_WITH_ZLIB=ON
-Dprotobuf_BUILD_TESTS=OFF
+ -Dprotobuf_BUILD_COMPILER=${protobuf_BUILD_COMPILER}
-DCMAKE_INSTALL_CMAKEDIR=share/protobuf
)