[protobuf] Fix for linux/osx

This commit is contained in:
Alexander Karatarakis 2018-04-10 15:05:04 -07:00
parent b4aad86642
commit bb7501a37e
2 changed files with 22 additions and 10 deletions

View File

@ -1,5 +1,5 @@
Source: protobuf
Version: 3.5.1-1
Version: 3.5.1-2
Description: Protocol Buffers - Google's data interchange format
Feature: zlib

View File

@ -21,7 +21,7 @@ vcpkg_apply_patches(
"${CMAKE_CURRENT_LIST_DIR}/js-embed.patch"
)
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if(CMAKE_HOST_WIN32)
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"
@ -85,27 +85,39 @@ endfunction()
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/include)
if(CMAKE_HOST_WIN32)
set(EXECUTABLE_SUFFIX ".exe")
else()
set(EXECUTABLE_SUFFIX "")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(READ ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake RELEASE_MODULE)
string(REPLACE "\${_IMPORT_PREFIX}/bin/protoc.exe" "\${_IMPORT_PREFIX}/tools/protoc.exe" RELEASE_MODULE "${RELEASE_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/bin/protoc${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protoc${EXECUTABLE_SUFFIX}" RELEASE_MODULE "${RELEASE_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake "${RELEASE_MODULE}")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake DEBUG_MODULE)
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc.exe" "\${_IMPORT_PREFIX}/tools/protoc.exe" DEBUG_MODULE "${DEBUG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protoc${EXECUTABLE_SUFFIX}" DEBUG_MODULE "${DEBUG_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake "${DEBUG_MODULE}")
endif()
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share)
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)
if(CMAKE_HOST_WIN32)
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()
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin/protoc.exe)
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe)
endif()
else()
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin/protoc.exe)
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe)
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
file(INSTALL ${CURRENT_PACKAGES_DIR}/bin/protoc DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
@ -115,7 +127,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
endif()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright)
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if(CMAKE_HOST_WIN32)
file(INSTALL ${TOOL_PATH}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
endif()
vcpkg_copy_pdbs()