diff options
Diffstat (limited to 'vcpkg/ports/matio')
| -rw-r--r-- | vcpkg/ports/matio/fix-dependencies.patch | 28 | ||||
| -rw-r--r-- | vcpkg/ports/matio/portfile.cmake | 48 | ||||
| -rw-r--r-- | vcpkg/ports/matio/usage | 5 | ||||
| -rw-r--r-- | vcpkg/ports/matio/vcpkg.json | 47 |
4 files changed, 128 insertions, 0 deletions
diff --git a/vcpkg/ports/matio/fix-dependencies.patch b/vcpkg/ports/matio/fix-dependencies.patch new file mode 100644 index 0000000..03304d0 --- /dev/null +++ b/vcpkg/ports/matio/fix-dependencies.patch @@ -0,0 +1,28 @@ +diff --git a/cmake/thirdParties.cmake b/cmake/thirdParties.cmake +index 41d8529..392d455 100644 +--- a/cmake/thirdParties.cmake ++++ b/cmake/thirdParties.cmake +@@ -19,7 +19,7 @@ if(MATIO_WITH_HDF5) + endif() + set(HDF5_FOUND TRUE) + else() +- find_package(HDF5) ++ find_package(HDF5 CONFIG REQUIRED) + if(HDF5_FOUND) + set(HDF_MIN_VER 1.8) + if(HDF5_VERSION VERSION_LESS ${HDF_MIN_VER}) +@@ -44,9 +44,12 @@ if(HDF5_FOUND) + elseif(TARGET hdf5) + # target from hdf5 1.8 config + target_link_libraries(MATIO::HDF5 INTERFACE hdf5) +- elseif(TARGET HDF5::HDF5) ++ elseif(TARGET hdf5::hdf5-shared) + # target defined in CMake FindHDF5 (since 3.19) +- target_link_libraries(MATIO::HDF5 INTERFACE HDF5::HDF5) ++ target_link_libraries(MATIO::HDF5 INTERFACE hdf5::hdf5-shared) ++ elseif(TARGET hdf5::hdf5-static) ++ # target defined in CMake FindHDF5 (since 3.19) ++ target_link_libraries(MATIO::HDF5 INTERFACE hdf5-static) + else() + # results from CMake FindHDF5 + set_target_properties(MATIO::HDF5 PROPERTIES diff --git a/vcpkg/ports/matio/portfile.cmake b/vcpkg/ports/matio/portfile.cmake new file mode 100644 index 0000000..a610348 --- /dev/null +++ b/vcpkg/ports/matio/portfile.cmake @@ -0,0 +1,48 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO tbeu/matio + REF "v${VERSION}" + SHA512 358318a249e22f5228516309d267593b8da9005de015dc0f59645fbfd7a5001e10be9144f32437acc2f6921d952e03adbaf8b9ca5b6620e191346bb569c04780 + HEAD_REF master + PATCHES fix-dependencies.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + mat73 MATIO_WITH_HDF5 + mat73 MATIO_MAT73 + zlib MATIO_WITH_ZLIB + extended-sparse MATIO_EXTENDED_SPARSE + pic MATIO_PIC +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${FEATURE_OPTIONS} + -DMATIO_SHARED=${BUILD_SHARED} + -DMATIO_USE_CONAN=OFF +) + +vcpkg_cmake_install() + +set(prefix "${CURRENT_INSTALLED_DIR}") +set(exec_prefix [[${prefix}]]) +set(libdir [[${prefix}/lib]]) +set(includedir [[${prefix}/include]]) +configure_file("${SOURCE_PATH}/matio.pc.in" "${SOURCE_PATH}/matio.pc" @ONLY) +file(INSTALL "${SOURCE_PATH}/matio.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") +if(NOT VCPKG_BUILD_TYPE) + set(includedir [[${prefix}/../include]]) + file(INSTALL "${SOURCE_PATH}/matio.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") +endif() +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +vcpkg_copy_tools(TOOL_NAMES matdump AUTO_CLEAN) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/matio/usage b/vcpkg/ports/matio/usage new file mode 100644 index 0000000..4a69791 --- /dev/null +++ b/vcpkg/ports/matio/usage @@ -0,0 +1,5 @@ +matio can be imported via CMake FindPkgConfig module:
+
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(matio REQUIRED IMPORTED_TARGET matio)
+ target_link_libraries(main PRIVATE PkgConfig::matio)
diff --git a/vcpkg/ports/matio/vcpkg.json b/vcpkg/ports/matio/vcpkg.json new file mode 100644 index 0000000..c0f5910 --- /dev/null +++ b/vcpkg/ports/matio/vcpkg.json @@ -0,0 +1,47 @@ +{ + "name": "matio", + "version": "1.5.28", + "description": "MATLAB MAT File I/O Library", + "homepage": "https://github.com/tbeu/matio", + "license": "BSD-2-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "mat73", + "zlib" + ], + "features": { + "extended-sparse": { + "description": "Enable extended sparse matrix data types not supported in MATLAB" + }, + "mat73": { + "description": "Enable support for version 7.3 MAT files using the HDF5 library", + "dependencies": [ + { + "name": "hdf5", + "default-features": false + }, + { + "name": "matio", + "default-features": false, + "features": [ + "zlib" + ] + } + ] + }, + "pic": { + "description": "Enable position-independent code (PIC), i.e., compilation with the -fPIC flag" + }, + "zlib": { + "description": "Check for zlib library", + "dependencies": [ + "zlib" + ] + } + } +} |