aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Christensen <philc@microsoft.com>2019-03-20 23:39:56 -0700
committerGitHub <noreply@github.com>2019-03-20 23:39:56 -0700
commit10014faad72347b9a321eb28e519b8a5e737d680 (patch)
tree0a3257e26290dfec1320345eb2533b405e5b2a29
parent64fc3202f557cdba7befd561d8ddb1bd83609606 (diff)
downloadvcpkg-10014faad72347b9a321eb28e519b8a5e737d680.tar.gz
vcpkg-10014faad72347b9a321eb28e519b8a5e737d680.zip
[ismrmrd] make optional hdf5 dependency explicit (#5757)
* [ismrmrd] make optional hdf5 dependency explicit This port will behave differently in the CI build depending on if hdf5 was installed before it. Make the hdf5 dependency explicit so it will behave consistently.
-rw-r--r--ports/ismrmrd/CONTROL6
-rw-r--r--ports/ismrmrd/optional_hdf5_dependency.patch77
-rw-r--r--ports/ismrmrd/portfile.cmake13
3 files changed, 94 insertions, 2 deletions
diff --git a/ports/ismrmrd/CONTROL b/ports/ismrmrd/CONTROL
index 3fe989da9..77d6e2e8d 100644
--- a/ports/ismrmrd/CONTROL
+++ b/ports/ismrmrd/CONTROL
@@ -1,4 +1,8 @@
Source: ismrmrd
-Version: 1.3.2-2
+Version: 1.3.2-3
Description: ISMRM Raw Data Format
Build-Depends: pugixml
+
+Feature: dataset
+Description: Dataset and file support
+Build-Depends: hdf5 \ No newline at end of file
diff --git a/ports/ismrmrd/optional_hdf5_dependency.patch b/ports/ismrmrd/optional_hdf5_dependency.patch
new file mode 100644
index 000000000..7c4772ed5
--- /dev/null
+++ b/ports/ismrmrd/optional_hdf5_dependency.patch
@@ -0,0 +1,77 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 456d4f4..3c235f2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,7 @@ set (ISMRMRD_CMAKE_DIR ${PROJECT_SOURCE_DIR}/cmake CACHE PATH
+
+ # command line options
+ option(USE_SYSTEM_PUGIXML "Use pugixml installed on the system" OFF)
++option(USE_HDF5_DATASET_SUPPORT "Use HDF5 library for dataset support" OFF)
+
+ # and include it to the search list
+ list(APPEND CMAKE_MODULE_PATH ${ISMRMRD_CMAKE_DIR})
+@@ -91,18 +92,23 @@ endif()
+ set(ISMRMRD_VERSION_STRING ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR}.${ISMRMRD_VERSION_PATCH})
+ set(ISMRMRD_SOVERSION ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR})
+
+-# Find HDF5 for dataset support
+-find_package(HDF5 1.8 COMPONENTS C)
+-
+-if (HDF5_FOUND)
+- set (ISMRMRD_DATASET_SUPPORT true)
+- set (ISMRMRD_DATASET_SOURCES libsrc/dataset.c libsrc/dataset.cpp)
+- set (ISMRMRD_DATASET_INCLUDE_DIR ${HDF5_C_INCLUDE_DIR})
+- set (ISMRMRD_DATASET_LIBRARIES ${HDF5_LIBRARIES})
+-else (HDF5_FOUND)
++if (USE_HDF5_DATASET_SUPPORT)
++ # Find HDF5 for dataset support
++ find_package(HDF5 1.8 COMPONENTS C)
++
++ if (HDF5_FOUND)
++ set (ISMRMRD_DATASET_SUPPORT true)
++ set (ISMRMRD_DATASET_SOURCES libsrc/dataset.c libsrc/dataset.cpp)
++ set (ISMRMRD_DATASET_INCLUDE_DIR ${HDF5_C_INCLUDE_DIR})
++ set (ISMRMRD_DATASET_LIBRARIES ${HDF5_LIBRARIES})
++ elseif (USE_HDF5_DATASET_SUPPORT)
++ set (ISMRMRD_DATASET_SUPPORT false)
++ # Dataset and file support was explicitly requested, force failure rather than succeed without support.
++ message (FATAL_ERROR "HDF5 not found. Dataset and file support unavailable!")
++ endif (HDF5_FOUND)
++else (USE_HDF5_DATASET_SUPPORT)
+ set (ISMRMRD_DATASET_SUPPORT false)
+- message (WARNING "HDF5 not found. Dataset and file support unavailable!")
+-endif (HDF5_FOUND)
++endif (USE_HDF5_DATASET_SUPPORT)
+
+ # Generate the version.h header file
+ find_package(Git)
+@@ -127,7 +133,7 @@ install(FILES ${CMAKE_BINARY_DIR}/include/ismrmrd/version.h DESTINATION include/
+
+ # --- Main Library (begin) ----
+ # in windows, install the HDF5 dependencies
+-if (HDF5_FOUND AND WIN32 AND ISMRMRD_INSTALL_DEPENDENCIES)
++if (USE_HDF5_DATASET_SUPPORT AND WIN32 AND ISMRMRD_INSTALL_DEPENDENCIES)
+ if(DEFINED ENV{HDF5_ROOT})
+ set(HDF5_BIN_DIR $ENV{HDF5_ROOT}/bin)
+ else (DEFINED ENV{HDF5_ROOT})
+@@ -135,7 +141,7 @@ if (HDF5_FOUND AND WIN32 AND ISMRMRD_INSTALL_DEPENDENCIES)
+ endif (DEFINED ENV{HDF5_ROOT})
+ message("Install hdf5 libraries from ${HDF5_BIN_DIR} ")
+ install( DIRECTORY ${HDF5_BIN_DIR} DESTINATION bin/.. FILES_MATCHING PATTERN "*.dll" )
+-endif (HDF5_FOUND AND WIN32 AND ISMRMRD_INSTALL_DEPENDENCIES)
++endif (USE_HDF5_DATASET_SUPPORT AND WIN32 AND ISMRMRD_INSTALL_DEPENDENCIES)
+
+ # include directories for main library
+ set(ISMRMRD_TARGET_INCLUDE_DIRS
+@@ -199,9 +205,9 @@ install(FILES cmake/FindIsmrmrd.cmake cmake/FindFFTW3.cmake DESTINATION share/is
+ add_subdirectory(doc)
+
+ add_subdirectory(utilities)
+-if (HDF5_FOUND)
++if (USE_HDF5_DATASET_SUPPORT)
+ add_subdirectory(examples/c)
+-endif (HDF5_FOUND)
++endif (USE_HDF5_DATASET_SUPPORT)
+
+ # TODO: make this work on Windows
+ if (NOT WIN32)
diff --git a/ports/ismrmrd/portfile.cmake b/ports/ismrmrd/portfile.cmake
index 1fda781b2..7bc30d028 100644
--- a/ports/ismrmrd/portfile.cmake
+++ b/ports/ismrmrd/portfile.cmake
@@ -10,12 +10,23 @@ vcpkg_from_github(
REF v1.3.2
SHA512 eb806f71c4b183105b3270d658a68195e009c0f7ca37f54f76d650a4d5c83c44d26b5f12a4c47c608aae9990cd04f1204b0c57e6438ca34a271fd54880133106
HEAD_REF master
+ PATCHES
+ # Makes optional hdf5 dependency explicit
+ optional_hdf5_dependency.patch
)
+if ("dataset" IN_LIST FEATURES)
+ set(ENABLE_DATASET ON)
+else()
+ set(ENABLE_DATASET OFF)
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
- OPTIONS -DUSE_SYSTEM_PUGIXML=ON
+ OPTIONS
+ -DUSE_SYSTEM_PUGIXML=ON
+ -DUSE_HDF5_DATASET_SUPPORT=${ENABLE_DATASET}
)
vcpkg_install_cmake()