1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Fix building in Linux

This commit is contained in:
Carles Fernandez 2017-11-17 21:20:56 +01:00
parent 929125cce5
commit 00e37a83a6
2 changed files with 50 additions and 42 deletions

View File

@ -326,6 +326,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "unstable")
set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.0") set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.0")
set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10") set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10")
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.11")
@ -1448,44 +1449,49 @@ endif(ENABLE_GPROF)
find_package(MATIO) find_package(MATIO)
if(NOT MATIO_FOUND) if(NOT MATIO_FOUND)
find_package(ZLIB) find_package(ZLIB)
get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY) if(ZLIB_FOUND)
find_package(HDF5) get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY)
list(GET ${HDF5_INCLUDE_DIRS} 0 HDF5_INCLUDE_FIRST_DIR) find_package(HDF5)
get_filename_component(HDF5_BASE_DIR ${HDF5_INCLUDE_FIRST_DIR} DIRECTORY) if(HDF5_FOUND)
if(OS_IS_MACOSX) list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR)
if(EXISTS /opt/local/include/hdf5.h) get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY)
set(HDF5_BASE_DIR /opt/local) get_filename_component(HDF5_BASE_DIR ${HDF5_BASE_DIR2} DIRECTORY)
endif(EXISTS /opt/local/include/hdf5.h) if(OS_IS_MACOSX)
if(EXISTS /usr/local/include/hdf5.h) if(EXISTS /opt/local/include/hdf5.h)
set(HDF5_BASE_DIR /usr/local) set(HDF5_BASE_DIR /opt/local)
endif(EXISTS /usr/local/include/hdf5.h) endif(EXISTS /opt/local/include/hdf5.h)
endif(OS_IS_MACOSX) if(EXISTS /usr/local/include/hdf5.h)
if(CMAKE_VERSION VERSION_LESS 3.2) set(HDF5_BASE_DIR /usr/local)
ExternalProject_Add( endif(EXISTS /usr/local/include/hdf5.h)
matio endif(OS_IS_MACOSX)
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/matio if(CMAKE_VERSION VERSION_LESS 3.2)
GIT_REPOSITORY https://github.com/tbeu/matio ExternalProject_Add(
GIT_TAG master matio-${GNSSSDR_MATIO_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mati
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio/autogen.sh GIT_REPOSITORY https://github.com/tbeu/matio
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio/configure --with-hdf5=${HDF5_BASE_DIR} --with-zlib=${ZLIB_BASE_DIR} --with-default-file-ver=7.3 --enable-mat73=yes --prefix=<INSTALL_DIR> GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION}
BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}" SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}
) UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/autogen.sh
else(CMAKE_VERSION VERSION_LESS 3.2) CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_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>
ExternalProject_Add( BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}"
matio )
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/matio else(CMAKE_VERSION VERSION_LESS 3.2)
GIT_REPOSITORY https://github.com/tbeu/matio ExternalProject_Add(
GIT_TAG master matio-${GNSSSDR_MATIO_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio PREFIX ${CMAKE_CURRENT_BINARY_DIR}/matio
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio/autogen.sh GIT_REPOSITORY https://github.com/tbeu/matio
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio/configure --with-hdf5=${HDF5_BASE_DIR} --with-zlib=${ZLIB_BASE_DIR} --with-default-file-ver=7.3 --enable-mat73=yes --prefix=<INSTALL_DIR> GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION}
BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}" SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX} UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/autogen.sh
) CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_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>
endif(CMAKE_VERSION VERSION_LESS 3.2) BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}"
set(MATIO_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ) BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX}
set(MATIO_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/matio/include ) )
endif(CMAKE_VERSION VERSION_LESS 3.2)
set(MATIO_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} )
set(MATIO_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/matio/include )
endif(HDF5_FOUND)
endif(ZLIB_FOUND)
endif(NOT MATIO_FOUND) endif(NOT MATIO_FOUND)

View File

@ -87,10 +87,12 @@ TEST(MatioTest, WriteAndReadGrComplex)
const int size = x_v.size(); const int size = x_v.size();
float x_real[size]; float x_real[size];
float x_imag[size]; float x_imag[size];
for (int i = 0; i < x_v.size(); i++) unsigned int i = 0;
for (std::vector<gr_complex>::const_iterator it = x_v.cbegin(); it != x_v.cend(); it++)
{ {
x_real[i] = x_v.at(i).real(); x_real[i] = it->real();
x_imag[i] = x_v.at(i).imag(); x_imag[i] = it->imag();
i++;
} }
struct mat_complex_split_t x = {x_real, x_imag}; struct mat_complex_split_t x = {x_real, x_imag};
@ -118,7 +120,7 @@ TEST(MatioTest, WriteAndReadGrComplex)
float * x_read_real = reinterpret_cast<float*>(x_read_st->Re); float * x_read_real = reinterpret_cast<float*>(x_read_st->Re);
float * x_read_imag = reinterpret_cast<float*>(x_read_st->Im); float * x_read_imag = reinterpret_cast<float*>(x_read_st->Im);
std::vector<gr_complex> x_v_read; std::vector<gr_complex> x_v_read;
for(int i = 0; i < size; i++) for(unsigned int i = 0; i < size; i++)
{ {
x_v_read.push_back(gr_complex(x_read_real[i], x_read_imag[i])); x_v_read.push_back(gr_complex(x_read_real[i], x_read_imag[i]));
} }