Merge pull request #5935 from ras0219-msft/dev/roschuma/vtk

[vtk] Fix flaky builds by using system libraries
This commit is contained in:
Griffin Downs 2019-04-05 13:23:17 -07:00 committed by GitHub
commit a141b603b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 110 additions and 71 deletions

View File

@ -1,5 +1,5 @@
Source: hdf5
Version: 1.10.5-3
Version: 1.10.5-4
Description: HDF5 is a data model, library, and file format for storing and managing data
Build-Depends: zlib, szip

View File

@ -3,13 +3,11 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
endif()
include(vcpkg_common_functions)
#set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CMake-hdf5-1.10.5/hdf5-1.10.5)
vcpkg_download_distfile(ARCHIVE
URLS "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/CMake-hdf5-1.10.5.tar.gz"
FILENAME "CMake-hdf5-1.10.5.tar.gz"
SHA512 a25ea28d7a511f9184d97b5b8cd4c6d52dcdcad2bffd670e24a1c9a6f98b03108014a853553fa2b00d4be7523128b5fd6a4454545e3b17ff8c66fea16a09e962
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
@ -32,7 +30,7 @@ else()
set(ENABLE_CPP OFF)
endif()
#Note: HDF5 Builds by default static as well as shared libraries set BUILD_SHARED_LIBS to OFF to only get static libraries
#Note: HDF5 Builds by default static as well as shared libraries. Set BUILD_SHARED_LIBS to OFF to only get static libraries
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIBS)
vcpkg_configure_cmake(
@ -56,14 +54,15 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/hdf5)
#Linux build create additional scripts here. I dont know what they are doing so I am deleting them and hope for the best
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright)
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/hdf5/vcpkg-cmake-wrapper.cmake @ONLY)

View File

@ -0,0 +1,15 @@
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.3)
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
if(NOT "CONFIG" IN_LIST ARGS AND NOT "NO_MODULE" IN_LIST ARGS AND "HDF5" IN_LIST ARGS)
# The caller hasn't said "CONFIG", so they want the built-in FindHDF5.cmake behavior. Set configurations macros to ensure the built-in script finds us.
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
set(HDF5_USE_STATIC_LIBRARIES ON)
else()
set(HDF5_USE_STATIC_LIBRARIES OFF)
endif()
endif()
cmake_policy(POP)
endif()
_find_package(${ARGS})

View File

@ -1,4 +1,4 @@
Source: libharu
Version: 2017-08-15-d84867ebf9f-5
Version: 2017-08-15-d84867ebf9f-6
Description: libharu - free PDF library
Build-Depends: zlib, libpng

View File

@ -0,0 +1,12 @@
diff --git a/include/hpdf.h b/include/hpdf.h
index 1cf0dd9..cce9b59 100644
--- a/include/hpdf.h
+++ b/include/hpdf.h
@@ -54,6 +54,7 @@
#include "hpdf_types.h"
typedef void *HPDF_HANDLE;
+typedef HPDF_HANDLE HPDF_Boolean;
typedef HPDF_HANDLE HPDF_Doc;
typedef HPDF_HANDLE HPDF_Page;
typedef HPDF_HANDLE HPDF_Pages;

View File

@ -1,11 +1,22 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(SHADING_PR
URLS "https://github.com/libharu/libharu/pull/157.diff"
FILENAME "libharu-shading-pr-157.patch"
SHA512 f2ddb22b54b4eccc79400b6a4b2d245a221898f75456a5a559523eab7a523a87dfc5dfd0ec5fb17a771697e03c7ea6ed4c6095eff73e0a4302cd6eb24584c957
)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libharu/libharu
REF d84867ebf9f3de6afd661d2cdaff102457fbc371
SHA512 789579dd52c1056ae90a4ce5360c26ba92cadae5341a3901c4159afe624129a1f628fa6412952a398e048b0e5040c93f7ed5b4e4bc620a22d897098298fe2a99
HEAD_REF master
PATCHES fix-build-fail.patch
PATCHES
fix-build-fail.patch
add-boolean-typedef.patch
# This patch adds shading support which is required for VTK. If desired, this could be moved into an on-by-default feature.
${SHADING_PR}
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBHPDF_STATIC)
@ -21,7 +32,7 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libhpdfs.lib ${CURRENT_PACKAGES_DIR}/lib/libhpdf.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libhpdfsd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libhpdfd.lib)
endif()

View File

@ -1,7 +1,7 @@
Source: vtk
Version: 8.2.0-2
Description: Software system for 3D computer graphics, image processing, and visualization
Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora, atlmfc (windows)
Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora, atlmfc (windows), eigen3, double-conversion, pugixml, libharu, sqlite3, netcdf-c
Feature: openvr
Description: OpenVR functionality for VTK
@ -18,7 +18,3 @@ Build-Depends: msmpi, hdf5[parallel]
Feature: python
Description: Python functionality for VTK
Build-Depends: python3
Feature: libharu
Description: PDF libharu functionality for VTK
Build-Depends: libharu

View File

@ -0,0 +1,14 @@
diff --git a/IO/CityGML/CMakeLists.txt b/IO/CityGML/CMakeLists.txt
index ce979ba..322e2de 100644
--- a/IO/CityGML/CMakeLists.txt
+++ b/IO/CityGML/CMakeLists.txt
@@ -4,8 +4,5 @@ vtk_module_library(vtkIOCityGML ${Module_SRCS})
# pugixml does not set _INCLUDE_DIRS or _LIBRARIES
if(VTK_USE_SYSTEM_PUGIXML AND NOT pugixml_INCLUDE_DIRS)
find_package(pugixml REQUIRED)
- get_target_property(pugixml_INCLUDE_DIRS pugixml INTERFACE_INCLUDE_DIRECTORIES)
- get_target_property(pugixml_LIBRARIES pugixml LOCATION)
- include_directories(${pugixml_INCLUDE_DIRS})
- vtk_module_link_libraries(vtkIOCityGML LINK_PRIVATE ${pugixml_LIBRARIES})
+ vtk_module_link_libraries(vtkIOCityGML LINK_PRIVATE pugixml)
endif()

View File

@ -16,9 +16,9 @@ else()
endif()
if ("mpi" IN_LIST FEATURES)
set(VTK_WITH_MPI ON )
set(VTK_Group_MPI ON)
else()
set(VTK_WITH_MPI OFF )
set(VTK_Group_MPI OFF)
endif()
if ("python" IN_LIST FEATURES)
@ -28,15 +28,9 @@ else()
endif()
if("openvr" IN_LIST FEATURES)
set(VTK_WITH_OPENVR ON)
set(Module_vtkRenderingOpenVR ON)
else()
set(VTK_WITH_OPENVR OFF)
endif()
if("libharu" IN_LIST FEATURES)
set(VTK_WITH_LIBHARU ON)
else()
set(VTK_WITH_LIBHARU OFF)
set(Module_vtkRenderingOpenVR OFF)
endif()
set(VTK_WITH_ALL_MODULES OFF) # IMPORTANT: if ON make sure `qt5`, `mpi`, `python3`, `ffmpeg`, `gdal`, `fontconfig`,
@ -46,14 +40,16 @@ set(VTK_WITH_ALL_MODULES OFF) # IMPORTANT: if ON make sure `qt5`
# Clone & patch
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO "Kitware/VTK"
REPO Kitware/VTK
REF "v${VTK_LONG_VERSION}"
SHA512 fd1d9c2872baa6eca7f8105b0057b56ec554e9d5eaf25985302e7fc032bdce72255d79e3f5f16ca50504151bda49cb3a148272ba32e0f410b4bdb70959b8f3f4
HEAD_REF "master"
HEAD_REF master
PATCHES
fix-find-lz4.patch
fix_ogg_linkage.patch
fix-pugixml-link.patch
)
# Remove the FindGLEW.cmake and FindPythonLibs.cmake that are distributed with VTK,
# since they do not detect the debug libraries correctly.
# The default files distributed with CMake (>= 3.9) should be superior by all means.
@ -73,12 +69,6 @@ if(VTK_WITH_QT)
)
endif()
if(VTK_WITH_MPI)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_Group_MPI=ON
)
endif()
if(VTK_WITH_PYTHON)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_WRAP_PYTHON=ON
@ -86,18 +76,6 @@ if(VTK_WITH_PYTHON)
)
endif()
if(VTK_WITH_OPENVR)
list(APPEND ADDITIONAL_OPTIONS
-DModule_vtkRenderingOpenVR=ON
)
endif()
if(VTK_WITH_LIBHARU)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_USE_SYSTEM_LIBHARU=ON
)
endif()
if(VTK_WITH_ALL_MODULES)
list(APPEND ADDITIONAL_OPTIONS
-DVTK_BUILD_ALL_MODULES=ON
@ -123,44 +101,31 @@ endif()
# =============================================================================
# Configure & Install
if(${VCPKG_LIBRARY_LINKAGE} MATCHES "static")
set(HDF5_USE_STATIC_LIBRARIES ON)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DHDF5_USE_STATIC_LIBRARIES=${HDF5_USE_STATIC_LIBRARIES}
-DHAVE_SNPRINTF=ON
-DVTK_Group_Imaging=ON
-DVTK_Group_Views=ON
-DBUILD_TESTING=OFF
-DBUILD_EXAMPLES=OFF
-DVTK_USE_SYSTEM_EXPAT=ON
-DVTK_USE_SYSTEM_FREETYPE=ON
# -DVTK_USE_SYSTEM_GL2PS=ON
-DVTK_USE_SYSTEM_JPEG=ON
-DVTK_USE_SYSTEM_GLEW=ON
-DVTK_USE_SYSTEM_HDF5=ON
-DVTK_USE_SYSTEM_JSONCPP=ON
-DVTK_USE_SYSTEM_LIBPROJ=ON
-DVTK_USE_SYSTEM_LIBXML2=ON
-DVTK_USE_SYSTEM_LZ4=ON
# -DVTK_USE_SYSTEM_NETCDF=ON
# -DVTK_USE_SYSTEM_NETCDFCPP=ON
-DVTK_USE_SYSTEM_OGG=ON
-DVTK_USE_SYSTEM_THEORA=ON
-DVTK_USE_SYSTEM_PNG=ON
-DVTK_USE_SYSTEM_TIFF=ON
-DVTK_USE_SYSTEM_ZLIB=ON
-DVTK_INSTALL_INCLUDE_DIR=include
-DVTK_INSTALL_DATA_DIR=share/vtk/data
-DVTK_INSTALL_DOC_DIR=share/vtk/doc
-DVTK_INSTALL_PACKAGE_DIR=share/vtk
-DVTK_INSTALL_RUNTIME_DIR=bin
-DVTK_FORBID_DOWNLOADS=ON
# We set all libraries to "system" and explicitly list the ones that should use embedded copies
-DVTK_USE_SYSTEM_LIBRARIES=ON
-DVTK_USE_SYSTEM_GL2PS=OFF
# Select modules / groups to install
-DVTK_Group_Imaging=ON
-DVTK_Group_Views=ON
-DModule_vtkGUISupportMFC=${Module_vtkGUISupportMFC}
-DModule_vtkRenderingOpenVR=${Module_vtkRenderingOpenVR}
-DVTK_Group_MPI=${VTK_Group_MPI}
${ADDITIONAL_OPTIONS}
)
@ -286,7 +251,7 @@ if(VTK_WITH_ALL_MODULES)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/XdmfConfig.cmake)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()

View File

@ -162,6 +162,33 @@ function(vcpkg_build_cmake)
endif()
endwhile()
endif()
elseif(out_contents MATCHES "mt : general error c101008d: ")
# Antivirus workaround - occasionally files are locked and cause mt.exe to fail
set(ITERATION 0)
while (ITERATION LESS 3 AND out_contents MATCHES "mt : general error c101008d: ")
MATH(EXPR ITERATION "${ITERATION}+1")
message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} because of mt.exe file locking issue. Iteration: ${ITERATION}")
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS}
OUTPUT_FILE "${LOGPREFIX}-out-${ITERATION}.log"
ERROR_FILE "${LOGPREFIX}-err-${ITERATION}.log"
RESULT_VARIABLE error_code
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE})
if(error_code)
file(READ "${LOGPREFIX}-out-${ITERATION}.log" out_contents)
file(READ "${LOGPREFIX}-err-${ITERATION}.log" err_contents)
if(out_contents)
list(APPEND LOGS "${LOGPREFIX}-out-${ITERATION}.log")
endif()
if(err_contents)
list(APPEND LOGS "${LOGPREFIX}-err-${ITERATION}.log")
endif()
else()
break()
endif()
endwhile()
endif()
if(error_code)
@ -170,7 +197,7 @@ function(vcpkg_build_cmake)
file(TO_NATIVE_PATH "${LOG}" NATIVE_LOG)
list(APPEND STRINGIFIED_LOGS " ${NATIVE_LOG}\n")
endforeach()
set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG})
set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG})
set(_eb_WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE})
message(FATAL_ERROR
" Command failed: ${_eb_COMMAND}\n"