diff --git a/ports/matio/CMakeLists.txt b/ports/matio/CMakeLists.txt deleted file mode 100644 index d7b6bb61be..0000000000 --- a/ports/matio/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -cmake_minimum_required(VERSION 3.8.0) -project(libmatio C) - -set(SRC - src/endian.c - src/inflate.c - src/io.c - src/mat.c - src/mat4.c - src/mat5.c - src/mat73.c - visual_studio/matio.def - src/matvar_cell.c - src/matvar_struct.c - src/read_data.c - src/snprintf.c -) - -add_library(libmatio ${SRC}) -target_include_directories(libmatio PRIVATE src visual_studio) -target_compile_definitions(libmatio PRIVATE - -DH5_NO_DEPRECATED_SYMBOLS - -DMAT73=1 - -DREPLACE_GETOPT - -DMATIO_HAVE_INTTYPES_H=1 - -DMATIO_HAVE_STDINT_H=1 -) - -find_package(ZLIB REQUIRED) -target_link_libraries(libmatio PRIVATE ZLIB::ZLIB) -target_compile_definitions(libmatio PRIVATE -DHAVE_ZLIB=1) - -find_package(hdf5 CONFIG REQUIRED) - -if(BUILD_SHARED_LIBS) - target_compile_definitions(libmatio PRIVATE -DHAVE_HDF5=1 -DH5_BUILT_AS_DYNAMIC_LIB) - if(HDF5_USE_STATIC_LIBRARIES) - target_link_libraries(libmatio PRIVATE hdf5::hdf5-static hdf5::hdf5_hl-static) - else() - target_link_libraries(libmatio PRIVATE hdf5::hdf5-shared hdf5::hdf5_hl-shared) - endif() -else() - target_compile_definitions(libmatio PRIVATE -DHAVE_HDF5=1 -DH5_BUILT_AS_STATIC_LIB) - target_link_libraries(libmatio PRIVATE hdf5::hdf5-static hdf5::hdf5_hl-static) -endif() - -install( - TARGETS libmatio - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) - -if(NOT DISABLE_INSTALL_HEADERS) - install(FILES - src/matio.h - visual_studio/matio_pubconf.h - DESTINATION include - ) -endif() diff --git a/ports/matio/CONTROL b/ports/matio/CONTROL deleted file mode 100644 index 0d304a646d..0000000000 --- a/ports/matio/CONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: matio -Version: 1.5.19 -Homepage: https://github.com/tbeu/matio -Description: MATLAB MAT File I/O Library -Build-Depends: zlib, hdf5 diff --git a/ports/matio/fix-dependencies.patch b/ports/matio/fix-dependencies.patch new file mode 100644 index 0000000000..03304d0832 --- /dev/null +++ b/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/ports/matio/portfile.cmake b/ports/matio/portfile.cmake index a1e55d41dd..c72bd3e4d0 100644 --- a/ports/matio/portfile.cmake +++ b/ports/matio/portfile.cmake @@ -4,18 +4,34 @@ vcpkg_from_github( REF ca56394e5672115df1981996ed12524d1d551259 # v1.5.19 SHA512 67c239d8aabafaa935775f3b260ba0756c196b0d845ef5116365c9aa6a0b24dae70d92c4e74d5d43ae073ae0744f084f0f58ead864eb77c813d43dbbb3e4ec5e HEAD_REF master + PATCHES fix-dependencies.patch ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) -vcpkg_configure_cmake( +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + hdf5 MATIO_WITH_HDF5 + zlib MATIO_WITH_ZLIB + extended-sparse MATIO_EXTENDED_SPARSE + mat73 MATIO_MAT73 + pic MATIO_PIC +) + +vcpkg_cmake_configure( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON + OPTIONS ${FEATURE_OPTIONS} + -DMATIO_SHARED=${BUILD_SHARED} + -DMATIO_USE_CONAN=OFF ) -vcpkg_install_cmake() - -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/matio RENAME copyright) +vcpkg_cmake_install() vcpkg_copy_pdbs() + +vcpkg_copy_tools(TOOL_NAMES matdump AUTO_CLEAN) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/matio/vcpkg.json b/ports/matio/vcpkg.json new file mode 100644 index 0000000000..7e4b8d05ad --- /dev/null +++ b/ports/matio/vcpkg.json @@ -0,0 +1,40 @@ +{ + "name": "matio", + "version-semver": "1.5.19", + "port-version": 1, + "description": "MATLAB MAT File I/O Library", + "homepage": "https://github.com/tbeu/matio", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "hdf5", + "zlib" + ], + "features": { + "extended-sparse": { + "description": "Enable extended sparse matrix data types not supported in MATLAB" + }, + "hdf5": { + "description": "Check for HDF5 library", + "dependencies": [ + "hdf5" + ] + }, + "mat73": { + "description": "Enable support for version 7.3 MAT files" + }, + "pic": { + "description": "Enable position-independent code (PIC), i.e., compilation with the -fPIC flag" + }, + "zlib": { + "description": "Check for zlib library", + "dependencies": [ + "zlib" + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 655d131b35..8204db2073 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3910,7 +3910,7 @@ }, "matio": { "baseline": "1.5.19", - "port-version": 0 + "port-version": 1 }, "matplotlib-cpp": { "baseline": "2020-08-27", diff --git a/versions/m-/matio.json b/versions/m-/matio.json index 12b26f4ece..74bf34be5d 100644 --- a/versions/m-/matio.json +++ b/versions/m-/matio.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "c11c8ba1ca5c7f0286165d497088779ec0df756a", + "version-semver": "1.5.19", + "port-version": 1 + }, { "git-tree": "09b997c5cb31fdde33faf650612324a847967360", "version-string": "1.5.19",