aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Schmitt <contact@jbob.io>2017-06-30 13:59:23 -0700
committerJoe Schmitt <contact@jbob.io>2017-06-30 13:59:23 -0700
commit997107adb7feed450f9f5ce5ae0fb344541e6d54 (patch)
tree8b788727a0fdd240e93449bd2bf716c50d28725c
parent753702bf2a448d95e1f89c3fef6520ba900d5d63 (diff)
downloadvcpkg-997107adb7feed450f9f5ce5ae0fb344541e6d54.tar.gz
vcpkg-997107adb7feed450f9f5ce5ae0fb344541e6d54.zip
Disable protobuf compiler on UWP
-rw-r--r--ports/protobuf/001-add-compiler-flag.patch99
-rw-r--r--ports/protobuf/portfile.cmake10
2 files changed, 109 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..766b1b5d8
--- /dev/null
+++ b/ports/protobuf/001-add-compiler-flag.patch
@@ -0,0 +1,99 @@
+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..44e4939c 100644
+--- a/cmake/install.cmake
++++ b/cmake/install.cmake
+@@ -1,21 +1,38 @@
+ include(GNUInstallDirs)
+
+-foreach(_library
+- libprotobuf-lite
+- libprotobuf
+- libprotoc)
+- set_property(TARGET ${_library}
+- PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+- $<BUILD_INTERFACE:${protobuf_source_dir}/src>
+- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
+- install(TARGETS ${_library} EXPORT protobuf-targets
+- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
+- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
+- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
+-endforeach()
++if(protobuf_BUILD_COMPILER)
++ foreach(_library
++ libprotobuf-lite
++ libprotobuf
++ libprotoc)
++ set_property(TARGET ${_library}
++ PROPERTY INTERFACE_INCLUDE_DIRECTORIES
++ $<BUILD_INTERFACE:${protobuf_source_dir}/src>
++ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
++ install(TARGETS ${_library} EXPORT protobuf-targets
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
++ endforeach()
++else()
++ foreach(_library
++ libprotobuf-lite
++ libprotobuf)
++ set_property(TARGET ${_library}
++ PROPERTY INTERFACE_INCLUDE_DIRECTORIES
++ $<BUILD_INTERFACE:${protobuf_source_dir}/src>
++ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
++ install(TARGETS ${_library} EXPORT protobuf-targets
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
++ endforeach()
++endif()
+
+-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,10 +111,18 @@ 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
+- NAMESPACE protobuf::
+- FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
+-)
++if(protobuf_BUILD_COMPILER)
++ export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
++ NAMESPACE protobuf::
++ FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
++ )
++else()
++ export(TARGETS libprotobuf-lite libprotobuf
++ NAMESPACE protobuf::
++ FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
++ )
++endif()
++
+
+ install(EXPORT protobuf-targets
+ DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake
index 852086ff5..4347adeff 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
)