mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-18 18:37:49 +08:00
[matio] Use official CMakeLists, add features (#18254)
* [matio] Use official CMakeLists, add features * Fix portfile.cmake * update version record * Commit missing files * Update versions/m-/matio.json * Update ports/matio/portfile.cmake * Update ports/matio/portfile.cmake * Update versions/m-/matio.json
This commit is contained in:
parent
cbe38c8280
commit
761578f827
@ -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()
|
|
@ -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
|
|
28
ports/matio/fix-dependencies.patch
Normal file
28
ports/matio/fix-dependencies.patch
Normal file
@ -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
|
@ -4,18 +4,34 @@ vcpkg_from_github(
|
|||||||
REF ca56394e5672115df1981996ed12524d1d551259 # v1.5.19
|
REF ca56394e5672115df1981996ed12524d1d551259 # v1.5.19
|
||||||
SHA512 67c239d8aabafaa935775f3b260ba0756c196b0d845ef5116365c9aa6a0b24dae70d92c4e74d5d43ae073ae0744f084f0f58ead864eb77c813d43dbbb3e4ec5e
|
SHA512 67c239d8aabafaa935775f3b260ba0756c196b0d845ef5116365c9aa6a0b24dae70d92c4e74d5d43ae073ae0744f084f0f58ead864eb77c813d43dbbb3e4ec5e
|
||||||
HEAD_REF master
|
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}
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
PREFER_NINJA
|
PREFER_NINJA
|
||||||
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
|
OPTIONS ${FEATURE_OPTIONS}
|
||||||
|
-DMATIO_SHARED=${BUILD_SHARED}
|
||||||
|
-DMATIO_USE_CONAN=OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
vcpkg_install_cmake()
|
vcpkg_cmake_install()
|
||||||
|
|
||||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/matio RENAME copyright)
|
|
||||||
|
|
||||||
vcpkg_copy_pdbs()
|
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)
|
||||||
|
40
ports/matio/vcpkg.json
Normal file
40
ports/matio/vcpkg.json
Normal file
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3910,7 +3910,7 @@
|
|||||||
},
|
},
|
||||||
"matio": {
|
"matio": {
|
||||||
"baseline": "1.5.19",
|
"baseline": "1.5.19",
|
||||||
"port-version": 0
|
"port-version": 1
|
||||||
},
|
},
|
||||||
"matplotlib-cpp": {
|
"matplotlib-cpp": {
|
||||||
"baseline": "2020-08-27",
|
"baseline": "2020-08-27",
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"git-tree": "c11c8ba1ca5c7f0286165d497088779ec0df756a",
|
||||||
|
"version-semver": "1.5.19",
|
||||||
|
"port-version": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"git-tree": "09b997c5cb31fdde33faf650612324a847967360",
|
"git-tree": "09b997c5cb31fdde33faf650612324a847967360",
|
||||||
"version-string": "1.5.19",
|
"version-string": "1.5.19",
|
||||||
|
Loading…
Reference in New Issue
Block a user