diff options
Diffstat (limited to 'vcpkg/ports/libmatio-cpp')
| -rw-r--r-- | vcpkg/ports/libmatio-cpp/fix-dependencies.patch | 85 | ||||
| -rw-r--r-- | vcpkg/ports/libmatio-cpp/matioCppConfig.cmake.in | 9 | ||||
| -rw-r--r-- | vcpkg/ports/libmatio-cpp/portfile.cmake | 28 | ||||
| -rw-r--r-- | vcpkg/ports/libmatio-cpp/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/libmatio-cpp/vcpkg.json | 20 |
5 files changed, 146 insertions, 0 deletions
diff --git a/vcpkg/ports/libmatio-cpp/fix-dependencies.patch b/vcpkg/ports/libmatio-cpp/fix-dependencies.patch new file mode 100644 index 0000000..5f2b86b --- /dev/null +++ b/vcpkg/ports/libmatio-cpp/fix-dependencies.patch @@ -0,0 +1,85 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2e61060..02c714f 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -91,7 +91,8 @@ if(NOT CMAKE_CONFIGURATION_TYPES) + endif() + + ## Dependencies +-find_package(MATIO REQUIRED) ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(matio REQUIRED IMPORTED_TARGET matio) + find_package(Eigen3 QUIET) + + if (Eigen3_FOUND) +@@ -100,10 +101,10 @@ endif() + + # Fetching visit_struct + include(CMakeDependentOption) +-find_package(visit_struct QUIET) +-option(USE_SYSTEM_visit_struct "Use system visit_struct" ${visit_struct_FOUND}) ++find_package(unofficial-visit_struct QUIET) ++option(USE_SYSTEM_visit_struct "Use system visit_struct" ${unofficial-visit_struct_FOUND}) + if(USE_SYSTEM_visit_struct) +- find_package(visit_struct REQUIRED) ++ find_package(unofficial-visit_struct REQUIRED) + else() + include(FetchContent) + FetchContent_Declare(visit_struct +@@ -182,8 +183,14 @@ target_include_directories(matioCpp PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SO + "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/Autogenerated>" + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>") + +-target_link_libraries(matioCpp PUBLIC MATIO::MATIO visit_struct::visit_struct) +-list(APPEND MATIOCPP_DEPENDENCIES MATIO visit_struct) ++ ++target_link_libraries(matioCpp PUBLIC unofficial::visit_struct::visit_struct) ++# Avoid propagating pkg-config dependencies down the line. ++get_target_property(matio_LINK_LIBRARIES PkgConfig::matio INTERFACE_LINK_LIBRARIES) ++target_include_directories(matioCpp PUBLIC ${matio_INCLUDE_DIRS}) ++target_link_libraries(matioCpp PUBLIC ${matio_LINK_LIBRARIES}) ++ ++list(APPEND MATIOCPP_DEPENDENCIES PkgConfig::matio unofficial-visit_struct) + + if (Eigen3_FOUND) + target_link_libraries(matioCpp PUBLIC Eigen3::Eigen) +@@ -208,7 +215,7 @@ add_library(matioCpp::matioCpp ALIAS matioCpp) + + # Specify installation targets, typology and destination folders. + install(TARGETS matioCpp +- EXPORT matioCppTargets ++ EXPORT matioCppTargets DESTINATION share/matioCpp + COMPONENT runtime + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib +@@ -216,22 +223,15 @@ install(TARGETS matioCpp + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/matioCpp/" COMPONENT dev + PRIVATE_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/matioCpp/impl" COMPONENT dev) + +-install(FILES "cmake/FindMATIO.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/matioCpp/cmake") +-file(COPY "cmake/FindMATIO.cmake" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/share/matioCpp/cmake") +- +-install(FILES "cmake/Findvisit_struct.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/matioCpp/cmake") +-file(COPY "cmake/Findvisit_struct.cmake" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/share/matioCpp/cmake") +- +-include(InstallBasicPackageFiles) ++include(CMakePackageConfigHelpers) ++configure_package_config_file(matioCppConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/matioCppConfig.cmake ++ INSTALL_DESTINATION share/matioCpp ++) ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/matioCppConfig.cmake" DESTINATION share/matioCpp) ++install(EXPORT matioCppTargets ++ NAMESPACE matioCpp:: ++ DESTINATION share/matioCpp) + +-install_basic_package_files(${PROJECT_NAME} +- VERSION ${${PROJECT_NAME}_VERSION} +- EXPORT matioCppTargets +- COMPATIBILITY AnyNewerVersion +- VARS_PREFIX ${PROJECT_NAME} +- NO_CHECK_REQUIRED_COMPONENTS_MACRO +- DEPENDENCIES ${MATIOCPP_DEPENDENCIES} +- OVERRIDE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/matioCpp/cmake) + # Add the uninstall target + include(AddUninstallTarget) + diff --git a/vcpkg/ports/libmatio-cpp/matioCppConfig.cmake.in b/vcpkg/ports/libmatio-cpp/matioCppConfig.cmake.in new file mode 100644 index 0000000..5dfafd4 --- /dev/null +++ b/vcpkg/ports/libmatio-cpp/matioCppConfig.cmake.in @@ -0,0 +1,9 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +# matio already included with targets +find_dependency(unofficial-visit_struct) +find_dependency(Eigen3) + +include("${CMAKE_CURRENT_LIST_DIR}/matioCppTargets.cmake") diff --git a/vcpkg/ports/libmatio-cpp/portfile.cmake b/vcpkg/ports/libmatio-cpp/portfile.cmake new file mode 100644 index 0000000..01d3336 --- /dev/null +++ b/vcpkg/ports/libmatio-cpp/portfile.cmake @@ -0,0 +1,28 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ami-iit/matio-cpp + REF "v${VERSION}" + SHA512 efae9cec18b44291625f0770dabe8fd23c5b1d7cf77849cab827880ca96328430d4146014ace82d443bbc00cc313fd23cd5d67a7f1b58235efa7b5cb291a8ea4 + HEAD_REF master + PATCHES + fix-dependencies.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/matioCppConfig.cmake.in" DESTINATION "${SOURCE_PATH}") + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(PACKAGE_NAME matioCpp) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/vcpkg/ports/libmatio-cpp/usage b/vcpkg/ports/libmatio-cpp/usage new file mode 100644 index 0000000..49df697 --- /dev/null +++ b/vcpkg/ports/libmatio-cpp/usage @@ -0,0 +1,4 @@ +libmatio-cpp provides CMake targets: + + find_package(matioCpp REQUIRED) + target_link_libraries(yourTarget PRIVATE matioCpp::matioCpp) diff --git a/vcpkg/ports/libmatio-cpp/vcpkg.json b/vcpkg/ports/libmatio-cpp/vcpkg.json new file mode 100644 index 0000000..0596459 --- /dev/null +++ b/vcpkg/ports/libmatio-cpp/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "libmatio-cpp", + "version": "0.3.0", + "description": "matio-cpp is a C++ wrapper for the matio library, automatically dealing with memory allocation and deallocation. It can be used for reading and writing binary MATLAB .mat files from C++, without the need to access or rely on MATLAB's own shared libraries.", + "homepage": "https://github.com/ami-iit/matio-cpp", + "license": "BSD-2-Clause", + "dependencies": [ + "eigen3", + "matio", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "visit-struct" + ] +} |