If the Matio library is not found, now it is configured and built by CMake instead of using autotools

This commit is contained in:
Carles Fernandez 2021-06-12 12:37:39 +02:00
parent ac84750f60
commit c20d8ecef7
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 144 additions and 133 deletions

View File

@ -2058,6 +2058,9 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
endif()
message(STATUS " Matio v${GNSSSDR_MATIO_LOCAL_VERSION} will be downloaded, built, and statically linked automatically")
message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.")
set_package_properties(MATIO PROPERTIES
PURPOSE "Matio v${GNSSSDR_MATIO_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
)
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES
URL "https://www.zlib.net/"
@ -2073,6 +2076,36 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library"
)
endif()
find_package(HDF5)
set_package_properties(HDF5 PROPERTIES
URL "https://support.hdfgroup.org/HDF5/"
PURPOSE "Required to build Matio."
TYPE REQUIRED
)
if(HDF5_FOUND AND HDF5_VERSION)
set_package_properties(HDF5 PROPERTIES
DESCRIPTION "A versatile data model, a portable file format and a software library (found: v${HDF5_VERSION})"
)
else()
set_package_properties(HDF5 PROPERTIES
DESCRIPTION "A versatile data model, a portable file format and a software library"
)
endif()
if(NOT HDF5_FOUND)
message(STATUS " The hdf5 library has not been found in your system.")
message(STATUS " Please try to install it by doing:")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS " $ sudo port install hdf5")
message(STATUS " or")
message(STATUS " $ brew install hdf5")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
message(STATUS " $ sudo apt-get install libhdf5-dev")
endif()
message(FATAL_ERROR "*** The hdf5 library is required to build Matio from source.")
endif()
if(CMAKE_VERSION VERSION_LESS 3.7)
if(ZLIB_FOUND)
get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
@ -2108,7 +2141,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
endif()
message(FATAL_ERROR "aclocal is required to build matio from source")
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS /opt/local/bin/glibtoolize) OR
(NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS /opt/local/bin/aclocal))
@ -2132,20 +2165,9 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
endif()
endif()
endif()
find_package(HDF5)
set_package_properties(HDF5 PROPERTIES
URL "https://support.hdfgroup.org/HDF5/"
PURPOSE "Required to build Matio."
TYPE REQUIRED
)
if(HDF5_FOUND AND HDF5_VERSION)
set_package_properties(HDF5 PROPERTIES
DESCRIPTION "A versatile data model, a portable file format and a software library (found: v${HDF5_VERSION})"
)
endif()
else()
set_package_properties(HDF5 PROPERTIES
DESCRIPTION "A versatile data model, a portable file format and a software library"
)
message(FATAL_ERROR "*** The zlib library is required to build Matio from source.")
endif()
if(HDF5_FOUND)
list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR)
@ -2159,7 +2181,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
set(HDF5_BASE_DIR /usr/local)
endif()
endif()
endif()
set(MATIO_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM})
if(MATIO_MAKE_PROGRAM MATCHES "ninja" OR CMAKE_GENERATOR STREQUAL Xcode)
find_program(MATIO_MAKE_EXECUTABLE make
@ -2173,7 +2195,6 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
set(MATIO_MAKE_PROGRAM ${MATIO_MAKE_EXECUTABLE})
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(matio-${GNSSSDR_MATIO_LOCAL_VERSION}
PREFIX ${CMAKE_BINARY_DIR}/matio
GIT_REPOSITORY https://github.com/tbeu/matio
@ -2189,9 +2210,16 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
GIT_REPOSITORY https://github.com/tbeu/matio
GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}
UPDATE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/autogen.sh
CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/configure --with-hdf5=${HDF5_BASE_DIR} --with-zlib=${ZLIB_BASE_DIR} --with-default-file-ver=7.3 --enable-mat73=yes --prefix=<INSTALL_DIR>
BUILD_COMMAND ${MATIO_MAKE_PROGRAM}
BINARY_DIR ${CMAKE_BINARY_DIR}/matio
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
-DMATIO_SHARED=OFF
-DMATIO_DEFAULT_FILE_VERSION:STRING=7.3
-DMATIO_MAT73=ON
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/matio
BUILD_COMMAND ${CMAKE_COMMAND}
"--build" "${CMAKE_BINARY_DIR}/matio"
"--config" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX}
)
endif()
@ -2208,25 +2236,6 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
INTERFACE_LINK_LIBRARIES "${CMAKE_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX};${HDF5_LIBRARIES};${ZLIB_LIBRARIES}"
)
endif()
else()
message(STATUS " The hdf5 library has not been found in your system.")
message(STATUS " Please try to install it by doing:")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS " $ sudo port install hdf5")
message(STATUS " or")
message(STATUS " $ brew install hdf5")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
message(STATUS " $ sudo apt-get install libhdf5-dev")
endif()
message(FATAL_ERROR "*** The hdf5 library is required to build gnss-sdr")
endif()
else()
message(FATAL_ERROR "*** The zlib library is required to build gnss-sdr")
endif()
set_package_properties(MATIO PROPERTIES
PURPOSE "Matio v${GNSSSDR_MATIO_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
)
endif()

View File

@ -65,6 +65,8 @@ All notable changes to GNSS-SDR will be documented in this file.
Boost >= 1.74.
- Fix linking of the `<filesystem>` library when using GCC 8.x and GNU Radio >=
3.8.
- If the Matio library is not found, now it is configured and built by CMake
instead of using autotools.
### Improvements in Usability: