aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-01-16 18:36:47 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-01-16 18:36:47 -0800
commit4ace533ad7fd7fe81e72bcb6926f2f6136137b11 (patch)
treed2cfbdc9b98162391884c8dd6de4a38b4b85c01b
parent518908dfd91fcba6eaa5853a6c3d98323b644f1e (diff)
downloadvcpkg-4ace533ad7fd7fe81e72bcb6926f2f6136137b11.tar.gz
vcpkg-4ace533ad7fd7fe81e72bcb6926f2f6136137b11.zip
[protobuf] Attempt to make build more consistent
-rw-r--r--ports/protobuf/portfile.cmake24
1 files changed, 17 insertions, 7 deletions
diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake
index fa7748381..5853c1e4a 100644
--- a/ports/protobuf/portfile.cmake
+++ b/ports/protobuf/portfile.cmake
@@ -23,9 +23,21 @@ vcpkg_configure_cmake(
-DCMAKE_INSTALL_CMAKEDIR=share/protobuf
)
-vcpkg_install_cmake()
+# Using 64-bit toolset to avoid occassional Linker Out-of-Memory issues.
+vcpkg_install_cmake(MSVC_64_TOOLSET)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+# It appears that at this point the build hasn't actually finished. There is probably
+# a process spawned by the build, therefore we need to wait a bit.
+
+function(protobuf_try_remove_recurse_wait PATH_TO_REMOVE)
+ file(REMOVE_RECURSE ${PATH_TO_REMOVE})
+ if (EXISTS "${PATH_TO_REMOVE}")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 5)
+ file(REMOVE_RECURSE ${PATH_TO_REMOVE})
+ endif()
+endfunction()
+
+protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/include)
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}")
@@ -36,11 +48,9 @@ string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${D
string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc.exe" "\${_IMPORT_PREFIX}/tools/protoc.exe" DEBUG_MODULE "${DEBUG_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake "${DEBUG_MODULE}")
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
-
-file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/protoc.exe)
-file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share)
+protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
+protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright)
file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2-win32/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools)