[matio] new port #621

This commit is contained in:
atkawa7 2017-07-05 13:04:17 -07:00
parent f17d5af64a
commit 330043341c
3 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,89 @@
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
)
set(
HEADERS
src/mat4.h
src/mat5.h
src/mat73.h
src/matio.h
src/matio_private.h
visual_studio/matio_pubconf.h
visual_studio/matioConfig.h
)
add_library(libmatio ${SRC})
set(COMMON_INCLUDES ${PROJECT_BINARY_DIR}/includes)
file(COPY ${HEADERS} DESTINATION ${COMMON_INCLUDES})
#fixes issues with relative directories
include_directories(${COMMON_INCLUDES})
option(BUILD_SHARED_LIBRARY ON)
add_definitions(
-DH5_NO_DEPRECATED_SYMBOLS
-DMAT73=1 -DREPLACE_GETOPT
-DMATIO_HAVE_INTTYPES_H=1
-DMATIO_HAVE_STDINT_H=1
)
if(BUILD_SHARED_LIBRARY)
add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB)
set(HDF5_USE_STATIC_LIBRARIES OFF)
else()
set(HDF5_USE_STATIC_LIBRARIES ON)
endif()
find_package( ZLIB REQUIRED )
if (ZLIB_FOUND)
include_directories( ${ZLIB_INCLUDE_DIRS} )
target_link_libraries(libmatio ${ZLIB_LIBRARIES})
add_definitions(-DHAVE_ZLIB=1)
endif( ZLIB_FOUND )
find_package( HDF5 REQUIRED)
if(HDF5_FOUND)
include_directories( ${HDF5_INCLUDE_DIRS} )
target_link_libraries(libmatio ${HDF5_C_LIBRARIES})
add_definitions(-DHAVE_HDF5=1)
endif()
message(STATUS ${HDF5_C_LIBRARIES})
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
visual_studio/matioConfig.h
DESTINATION include
)
endif()

4
ports/matio/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: matio
Version: 1.5.10
Description: MATLAB MAT File I/O Library
Build-Depends: zlib, hdf5

View File

@ -0,0 +1,23 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO tbeu/matio
REF v1.5.10
SHA512 c06ff6b3d17a136be20cebca4e1a4bb87eea98e35d979713e73f855487dee568895245528b1b8e55caf02f88aff1b742daf75f590e2d3b08158d0ad73e377243
HEAD_REF master
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/matio RENAME copyright)
vcpkg_copy_pdbs()