mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	Fix parallel building when MATIO is not present.
Fix building with Ninja Matio is no longer optional but mandatory
This commit is contained in:
		
							
								
								
									
										136
									
								
								CMakeLists.txt
									
									
									
									
									
								
							
							
						
						
									
										136
									
								
								CMakeLists.txt
									
									
									
									
									
								
							| @@ -1088,6 +1088,74 @@ endif(NOT GNUTLS_OPENSSL_LIBRARY) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ######################################################################## | ||||||
|  | # Matio - https://github.com/tbeu/matio | ||||||
|  | ######################################################################## | ||||||
|  | find_package(MATIO) | ||||||
|  | if(NOT MATIO_FOUND) | ||||||
|  |     find_package(ZLIB) | ||||||
|  |     if(ZLIB_FOUND) | ||||||
|  |         get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY) | ||||||
|  |         find_package(HDF5) | ||||||
|  |         if(HDF5_FOUND) | ||||||
|  |             list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR) | ||||||
|  |             get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY) | ||||||
|  |             get_filename_component(HDF5_BASE_DIR ${HDF5_BASE_DIR2} DIRECTORY) | ||||||
|  |             if(OS_IS_MACOSX) | ||||||
|  |                 if(EXISTS /opt/local/include/hdf5.h) | ||||||
|  |                     set(HDF5_BASE_DIR /opt/local) | ||||||
|  |                 endif(EXISTS /opt/local/include/hdf5.h) | ||||||
|  |                 if(EXISTS /usr/local/include/hdf5.h) | ||||||
|  |                     set(HDF5_BASE_DIR /usr/local) | ||||||
|  |                 endif(EXISTS /usr/local/include/hdf5.h) | ||||||
|  |             endif(OS_IS_MACOSX) | ||||||
|  |             if(CMAKE_VERSION VERSION_LESS 3.2) | ||||||
|  |               ExternalProject_Add( | ||||||
|  |                  matio-${GNSSSDR_MATIO_LOCAL_VERSION} | ||||||
|  |                  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mati | ||||||
|  |                  GIT_REPOSITORY https://github.com/tbeu/matio | ||||||
|  |                  GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION} | ||||||
|  |                  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 | ||||||
|  |                  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> | ||||||
|  |                  BUILD_COMMAND make | ||||||
|  |               ) | ||||||
|  |             else(CMAKE_VERSION VERSION_LESS 3.2) | ||||||
|  |               ExternalProject_Add( | ||||||
|  |                  matio-${GNSSSDR_MATIO_LOCAL_VERSION} | ||||||
|  |                  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/matio | ||||||
|  |                  GIT_REPOSITORY https://github.com/tbeu/matio | ||||||
|  |                  GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION} | ||||||
|  |                  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 | ||||||
|  |                  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> | ||||||
|  |                  BUILD_COMMAND make | ||||||
|  |                  BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX} | ||||||
|  |               ) | ||||||
|  |             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 ) | ||||||
|  |             set(MATIO_LOCAL true) | ||||||
|  |         else(HDF5_FOUND) | ||||||
|  |             message(STATUS " The hdf5 library has not been found in your system.") | ||||||
|  |             message(STATUS " Please try to install it by doing:") | ||||||
|  |             if(OS_IS_MACOSX) | ||||||
|  |                 message(STATUS "  $ sudo port install hdf5") | ||||||
|  |                 message(STATUS " or") | ||||||
|  |                 message(STATUS "  $ brew install hdf5") | ||||||
|  |             endif(OS_IS_MACOSX) | ||||||
|  |             if(OS_IS_LINUX) | ||||||
|  |                 message(STATUS "  $ sudo apt-get install libhdf5-dev") | ||||||
|  |             endif(OS_IS_LINUX) | ||||||
|  |             message(FATAL_ERROR "*** The hdf5 library is required to build gnss-sdr") | ||||||
|  |         endif(HDF5_FOUND) | ||||||
|  |     else(ZLIB_FOUND) | ||||||
|  |         message(FATAL_ERROR "*** The zlib library is required to build gnss-sdr") | ||||||
|  |     endif(ZLIB_FOUND) | ||||||
|  | endif(NOT MATIO_FOUND) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ################################################################################ | ################################################################################ | ||||||
| # USRP Hardware Driver (UHD) - OPTIONAL | # USRP Hardware Driver (UHD) - OPTIONAL | ||||||
| ################################################################################ | ################################################################################ | ||||||
| @@ -1350,74 +1418,6 @@ endif(ENABLE_GPROF) | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ######################################################################## |  | ||||||
| # Matio (OPTIONAL) - https://github.com/tbeu/matio |  | ||||||
| ######################################################################## |  | ||||||
| find_package(MATIO) |  | ||||||
| if(NOT MATIO_FOUND) |  | ||||||
|     find_package(ZLIB) |  | ||||||
|     if(ZLIB_FOUND) |  | ||||||
|         get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY) |  | ||||||
|         find_package(HDF5) |  | ||||||
|         if(HDF5_FOUND) |  | ||||||
|             list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR) |  | ||||||
|             get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY) |  | ||||||
|             get_filename_component(HDF5_BASE_DIR ${HDF5_BASE_DIR2} DIRECTORY) |  | ||||||
|             if(OS_IS_MACOSX) |  | ||||||
|                 if(EXISTS /opt/local/include/hdf5.h) |  | ||||||
|                     set(HDF5_BASE_DIR /opt/local) |  | ||||||
|                 endif(EXISTS /opt/local/include/hdf5.h) |  | ||||||
|                 if(EXISTS /usr/local/include/hdf5.h) |  | ||||||
|                     set(HDF5_BASE_DIR /usr/local) |  | ||||||
|                 endif(EXISTS /usr/local/include/hdf5.h) |  | ||||||
|             endif(OS_IS_MACOSX) |  | ||||||
|             if(CMAKE_VERSION VERSION_LESS 3.2) |  | ||||||
|               ExternalProject_Add( |  | ||||||
|                  matio-${GNSSSDR_MATIO_LOCAL_VERSION} |  | ||||||
|                  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mati |  | ||||||
|                  GIT_REPOSITORY https://github.com/tbeu/matio |  | ||||||
|                  GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION} |  | ||||||
|                  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 |  | ||||||
|                  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> |  | ||||||
|                  BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}" |  | ||||||
|               ) |  | ||||||
|             else(CMAKE_VERSION VERSION_LESS 3.2) |  | ||||||
|               ExternalProject_Add( |  | ||||||
|                  matio-${GNSSSDR_MATIO_LOCAL_VERSION} |  | ||||||
|                  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/matio |  | ||||||
|                  GIT_REPOSITORY https://github.com/tbeu/matio |  | ||||||
|                  GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION} |  | ||||||
|                  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 |  | ||||||
|                  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> |  | ||||||
|                  BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}" |  | ||||||
|                  BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX} |  | ||||||
|               ) |  | ||||||
|             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 ) |  | ||||||
|             set(MATIO_LOCAL true) |  | ||||||
|         else(HDF5_FOUND) |  | ||||||
|             message(STATUS " The hdf5 library has not been found in your system.") |  | ||||||
|             message(STATUS " Please try to install it by doing:") |  | ||||||
|             if(OS_IS_MACOSX) |  | ||||||
|                 message(STATUS "  $ sudo port install hdf5") |  | ||||||
|                 message(STATUS " or") |  | ||||||
|                 message(STATUS "  $ brew install hdf5") |  | ||||||
|             endif(OS_IS_MACOSX) |  | ||||||
|             if(OS_IS_LINUX) |  | ||||||
|                 message(STATUS "  $ sudo apt-get install libhdf5-dev") |  | ||||||
|             endif(OS_IS_LINUX) |  | ||||||
|             message(FATAL_ERROR "*** The hdf5 library is required to build gnss-sdr") |  | ||||||
|         endif(HDF5_FOUND) |  | ||||||
|     else(ZLIB_FOUND) |  | ||||||
|         message(FATAL_ERROR "*** The zlib library is required to build gnss-sdr") |  | ||||||
|     endif(ZLIB_FOUND) |  | ||||||
| endif(NOT MATIO_FOUND) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ######################################################################## | ######################################################################## | ||||||
| # Set compiler flags | # Set compiler flags | ||||||
| ######################################################################## | ######################################################################## | ||||||
|   | |||||||
| @@ -38,5 +38,9 @@ file(GLOB OBS_GR_BLOCKS_HEADERS "*.h") | |||||||
| list(SORT OBS_GR_BLOCKS_HEADERS) | list(SORT OBS_GR_BLOCKS_HEADERS) | ||||||
| add_library(obs_gr_blocks ${OBS_GR_BLOCKS_SOURCES} ${OBS_GR_BLOCKS_HEADERS}) | add_library(obs_gr_blocks ${OBS_GR_BLOCKS_SOURCES} ${OBS_GR_BLOCKS_HEADERS}) | ||||||
| source_group(Headers FILES ${OBS_GR_BLOCKS_HEADERS}) | source_group(Headers FILES ${OBS_GR_BLOCKS_HEADERS}) | ||||||
|  | if(MATIO_FOUND) | ||||||
|     add_dependencies(obs_gr_blocks glog-${glog_RELEASE} armadillo-${armadillo_RELEASE}) |     add_dependencies(obs_gr_blocks glog-${glog_RELEASE} armadillo-${armadillo_RELEASE}) | ||||||
|  | else(MATIO_FOUND) | ||||||
|  |     add_dependencies(obs_gr_blocks glog-${glog_RELEASE} armadillo-${armadillo_RELEASE} matio-${GNSSSDR_MATIO_LOCAL_VERSION}) | ||||||
|  | endif(MATIO_FOUND) | ||||||
| target_link_libraries(obs_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES} ${ARMADILLO_LIBRARIES} ${MATIO_LIBRARIES}) | target_link_libraries(obs_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES} ${ARMADILLO_LIBRARIES} ${MATIO_LIBRARIES}) | ||||||
|   | |||||||
| @@ -66,5 +66,13 @@ source_group(Headers FILES ${TRACKING_GR_BLOCKS_HEADERS}) | |||||||
| target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_RUNTIME_LIBRARIES} gnss_sp_libs ${Boost_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${MATIO_LIBRARIES} ${OPT_TRACKING_LIBRARIES}) | target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_RUNTIME_LIBRARIES} gnss_sp_libs ${Boost_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${MATIO_LIBRARIES} ${OPT_TRACKING_LIBRARIES}) | ||||||
|  |  | ||||||
| if(NOT VOLK_GNSSSDR_FOUND) | if(NOT VOLK_GNSSSDR_FOUND) | ||||||
|  |     if(MATIO_FOUND) | ||||||
|         add_dependencies(tracking_gr_blocks volk_gnsssdr_module) |         add_dependencies(tracking_gr_blocks volk_gnsssdr_module) | ||||||
|  |     else(MATIO_FOUND) | ||||||
|  |         add_dependencies(tracking_gr_blocks volk_gnsssdr_module matio-${GNSSSDR_MATIO_LOCAL_VERSION}) | ||||||
|  |     endif(MATIO_FOUND) | ||||||
|  | else(NOT VOLK_GNSSSDR_FOUND) | ||||||
|  |     if(NOT MATIO_FOUND) | ||||||
|  |         add_dependencies(tracking_gr_blocks matio-${GNSSSDR_MATIO_LOCAL_VERSION}) | ||||||
|  |     endif(NOT MATIO_FOUND) | ||||||
| endif(NOT VOLK_GNSSSDR_FOUND) | endif(NOT VOLK_GNSSSDR_FOUND) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez