From 330043341cb28da7bb121f29199cf72fff36b66a Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Wed, 5 Jul 2017 13:04:17 -0700 Subject: [PATCH 1/4] [matio] new port #621 --- ports/matio/CMakeLists.txt | 89 ++++++++++++++++++++++++++++++++++++++ ports/matio/CONTROL | 4 ++ ports/matio/portfile.cmake | 23 ++++++++++ 3 files changed, 116 insertions(+) create mode 100644 ports/matio/CMakeLists.txt create mode 100644 ports/matio/CONTROL create mode 100644 ports/matio/portfile.cmake diff --git a/ports/matio/CMakeLists.txt b/ports/matio/CMakeLists.txt new file mode 100644 index 0000000000..eaecf304b4 --- /dev/null +++ b/ports/matio/CMakeLists.txt @@ -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() diff --git a/ports/matio/CONTROL b/ports/matio/CONTROL new file mode 100644 index 0000000000..eb2f87b706 --- /dev/null +++ b/ports/matio/CONTROL @@ -0,0 +1,4 @@ +Source: matio +Version: 1.5.10 +Description: MATLAB MAT File I/O Library +Build-Depends: zlib, hdf5 diff --git a/ports/matio/portfile.cmake b/ports/matio/portfile.cmake new file mode 100644 index 0000000000..2878bdbfb3 --- /dev/null +++ b/ports/matio/portfile.cmake @@ -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() From f354d6b31dc626ed649c3c679378965a8c8117c8 Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Thu, 6 Jul 2017 19:59:56 -0700 Subject: [PATCH 2/4] [matio] Fixed issues with customer cmakelists.txt --- ports/matio/CMakeLists.txt | 50 +++++++++----------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/ports/matio/CMakeLists.txt b/ports/matio/CMakeLists.txt index eaecf304b4..60f8e76d71 100644 --- a/ports/matio/CMakeLists.txt +++ b/ports/matio/CMakeLists.txt @@ -16,30 +16,12 @@ set(SRC 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 -) - +include_directories(src visual_studio) 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 @@ -47,30 +29,23 @@ add_definitions( -DMATIO_HAVE_STDINT_H=1 ) -if(BUILD_SHARED_LIBRARY) - add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB) - set(HDF5_USE_STATIC_LIBRARIES OFF) +if(BUILD_SHARED_LIBS) + add_definitions (-DH5_BUILT_AS_DYNAMIC_LIB) else() - set(HDF5_USE_STATIC_LIBRARIES ON) + add_definitions(-DH5_BUILT_AS_STATIC_LIB) endif() -find_package( ZLIB REQUIRED ) +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 ) +include_directories( ${ZLIB_INCLUDE_DIRS} ) +target_link_libraries(libmatio ${ZLIB_LIBRARIES}) +add_definitions(-DHAVE_ZLIB=1) -find_package( HDF5 REQUIRED) +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}) +include_directories( ${HDF5_INCLUDE_DIRS} ) +target_link_libraries(libmatio ${HDF5_C_LIBRARIES}) +add_definitions(-DHAVE_HDF5=1) install( TARGETS libmatio @@ -83,7 +58,6 @@ if(NOT DISABLE_INSTALL_HEADERS) install(FILES src/matio.h visual_studio/matio_pubconf.h - visual_studio/matioConfig.h DESTINATION include ) endif() From e60f06f7e94b1b1e107c46ff29d60d46dad124fb Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Thu, 6 Jul 2017 20:08:22 -0700 Subject: [PATCH 3/4] [matio] Removed unnecessary include --- ports/matio/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/matio/CMakeLists.txt b/ports/matio/CMakeLists.txt index 60f8e76d71..2f085d7e1f 100644 --- a/ports/matio/CMakeLists.txt +++ b/ports/matio/CMakeLists.txt @@ -20,8 +20,6 @@ include_directories(src visual_studio) add_library(libmatio ${SRC}) -include_directories(${COMMON_INCLUDES}) - add_definitions( -DH5_NO_DEPRECATED_SYMBOLS -DMAT73=1 -DREPLACE_GETOPT From 6e97f0018482e15e9b06f536a4ed12a73789c958 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 7 Jul 2017 18:44:28 -0700 Subject: [PATCH 4/4] [matio] Use target_X cmake directives. Prefer modern cmake ZLIB::ZLIB. --- ports/matio/CMakeLists.txt | 34 ++++++++++++++-------------------- ports/matio/CONTROL | 2 +- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/ports/matio/CMakeLists.txt b/ports/matio/CMakeLists.txt index 2f085d7e1f..31b7e1e2b7 100644 --- a/ports/matio/CMakeLists.txt +++ b/ports/matio/CMakeLists.txt @@ -16,34 +16,28 @@ set(SRC src/snprintf.c ) -include_directories(src visual_studio) - -add_library(libmatio ${SRC}) - -add_definitions( +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 + -DMAT73=1 + -DREPLACE_GETOPT -DMATIO_HAVE_INTTYPES_H=1 -DMATIO_HAVE_STDINT_H=1 ) -if(BUILD_SHARED_LIBS) - add_definitions (-DH5_BUILT_AS_DYNAMIC_LIB) -else() - add_definitions(-DH5_BUILT_AS_STATIC_LIB) -endif() - find_package(ZLIB REQUIRED) - -include_directories( ${ZLIB_INCLUDE_DIRS} ) -target_link_libraries(libmatio ${ZLIB_LIBRARIES}) -add_definitions(-DHAVE_ZLIB=1) +target_link_libraries(libmatio PRIVATE ZLIB::ZLIB) +target_compile_definitions(libmatio PRIVATE -DHAVE_ZLIB=1) find_package(HDF5 REQUIRED) - -include_directories( ${HDF5_INCLUDE_DIRS} ) -target_link_libraries(libmatio ${HDF5_C_LIBRARIES}) -add_definitions(-DHAVE_HDF5=1) +target_include_directories(libmatio PRIVATE ${HDF5_INCLUDE_DIRS} ) +target_link_libraries(libmatio PRIVATE ${HDF5_C_LIBRARIES}) +if(BUILD_SHARED_LIBS) + target_compile_definitions(libmatio PRIVATE -DHAVE_HDF5=1 -DH5_BUILT_AS_DYNAMIC_LIB) +else() + target_compile_definitions(libmatio PRIVATE -DHAVE_HDF5=1 -DH5_BUILT_AS_STATIC_LIB) +endif() install( TARGETS libmatio diff --git a/ports/matio/CONTROL b/ports/matio/CONTROL index eb2f87b706..f4dac30a1c 100644 --- a/ports/matio/CONTROL +++ b/ports/matio/CONTROL @@ -1,4 +1,4 @@ Source: matio -Version: 1.5.10 +Version: 1.5.10-1 Description: MATLAB MAT File I/O Library Build-Depends: zlib, hdf5