diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-03-11 23:41:51 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-03-11 23:42:54 -0700 |
| commit | 9f9778ccff48981a691bf34f30ecc4bf2efd5ac1 (patch) | |
| tree | 10ec609d13836ddc266345f441bae6f9e824056a /ports/protobuf | |
| parent | ece289b9a6466dca885fd2555ed783d70dcad9bf (diff) | |
| download | vcpkg-9f9778ccff48981a691bf34f30ecc4bf2efd5ac1.tar.gz vcpkg-9f9778ccff48981a691bf34f30ecc4bf2efd5ac1.zip | |
[many ports] Improve behavior on Linux and general cleanup
Diffstat (limited to 'ports/protobuf')
| -rw-r--r-- | ports/protobuf/CONTROL | 2 | ||||
| -rw-r--r-- | ports/protobuf/js-embed.patch | 25 | ||||
| -rw-r--r-- | ports/protobuf/portfile.cmake | 30 |
3 files changed, 44 insertions, 13 deletions
diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL index 0cf5b4334..86fecafc5 100644 --- a/ports/protobuf/CONTROL +++ b/ports/protobuf/CONTROL @@ -1,5 +1,5 @@ Source: protobuf -Version: 3.5.1 +Version: 3.5.1-1 Description: Protocol Buffers - Google's data interchange format Feature: zlib diff --git a/ports/protobuf/js-embed.patch b/ports/protobuf/js-embed.patch new file mode 100644 index 000000000..df20fe030 --- /dev/null +++ b/ports/protobuf/js-embed.patch @@ -0,0 +1,25 @@ +diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
+index 107c1c5..233bcf6 100644
+--- a/cmake/libprotoc.cmake
++++ b/cmake/libprotoc.cmake
+@@ -73,7 +73,7 @@ set(libprotoc_files
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc
+- ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
++ ${CMAKE_CURRENT_BINARY_DIR}/well_known_types_embed.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
+@@ -210,9 +210,9 @@ set(js_well_known_types_sources
+ )
+ add_executable(js_embed ${protobuf_source_dir}/src/google/protobuf/compiler/js/embed.cc)
+ add_custom_command(
+- OUTPUT ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
++ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/well_known_types_embed.cc
+ DEPENDS js_embed ${js_well_known_types_sources}
+- COMMAND js_embed ${js_well_known_types_sources} > ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc
++ COMMAND "$<TARGET_FILE:js_embed>" ${js_well_known_types_sources} > ${CMAKE_CURRENT_BINARY_DIR}/well_known_types_embed.cc
+ )
+
+ add_library(libprotoc ${protobuf_SHARED_OR_STATIC}
diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake index 197a61446..b8cb43f93 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -8,14 +8,7 @@ vcpkg_download_distfile(ARCHIVE_FILE FILENAME "protobuf-cpp-${PROTOBUF_VERSION}.tar.gz" SHA512 195ccb210229e0a1080dcdb0a1d87b2e421ad55f6b036c56db3183bd50a942c75b4cc84e6af8a10ad88022a247781a06f609a145a461dfbb8f04051b7dd714b3 ) -vcpkg_download_distfile(TOOL_ARCHIVE_FILE - URLS "https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-win32.zip" - FILENAME "protoc-${PROTOC_VERSION}-win32.zip" - SHA512 27b1b82e92d82c35158362435a29f590961b91f68cda21bffe46e52271340ea4587c4e3177668809af0d053b61e6efa69f0f62156ea11393cd9e6eb4474a3049 -) - set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION}) -set(TOOL_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION}-win32) vcpkg_extract_source_archive(${ARCHIVE_FILE}) @@ -25,19 +18,29 @@ vcpkg_apply_patches( PATCHES "${CMAKE_CURRENT_LIST_DIR}/001-add-compiler-flag.patch" "${CMAKE_CURRENT_LIST_DIR}/export-ParseGeneratorParameter.patch" + "${CMAKE_CURRENT_LIST_DIR}/js-embed.patch" ) +if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(TOOL_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION}-win32) + vcpkg_download_distfile(TOOL_ARCHIVE_FILE + URLS "https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-win32.zip" + FILENAME "protoc-${PROTOC_VERSION}-win32.zip" + SHA512 27b1b82e92d82c35158362435a29f590961b91f68cda21bffe46e52271340ea4587c4e3177668809af0d053b61e6efa69f0f62156ea11393cd9e6eb4474a3049 + ) + + vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${TOOL_PATH}) +endif() -vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${TOOL_PATH}) # Disable the protobuf compiler when targeting UWP -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore) +if(CMAKE_HOST_WIN32 AND VCPKG_CMAKE_SYSTEM_NAME) set(protobuf_BUILD_COMPILER OFF) else() set(protobuf_BUILD_COMPILER ON) endif() -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(protobuf_BUILD_SHARED_LIBS ON) else() set(protobuf_BUILD_SHARED_LIBS OFF) @@ -57,6 +60,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/cmake + PREFER_NINJA OPTIONS -Dprotobuf_BUILD_SHARED_LIBS=${protobuf_BUILD_SHARED_LIBS} -Dprotobuf_MSVC_STATIC_RUNTIME=${protobuf_MSVC_STATIC_RUNTIME} @@ -92,7 +96,7 @@ file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake " protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share) -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin) protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin) else() @@ -107,5 +111,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) endif() file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright) -file(INSTALL ${TOOL_PATH}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + file(INSTALL ${TOOL_PATH}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +endif() vcpkg_copy_pdbs() |
