mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-14 18:10:10 +00:00
If Armadillo is not installed in the system, now CMake will download it, patch it in order to make a static library, build it, and link it with the rest of GNSS-SDR.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@306 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
6628e5e2d8
commit
e0f577fe98
@ -119,7 +119,6 @@ if (NOT GFlags_FOUND OR LOCAL_GFLAGS)
|
|||||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags/gflags-${gflags_RELEASE}
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags/gflags-${gflags_RELEASE}
|
||||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}
|
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}
|
||||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE}
|
||||||
#BUILD_IN_SOURCE 1
|
|
||||||
BUILD_COMMAND make
|
BUILD_COMMAND make
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
PATCH_COMMAND ""
|
PATCH_COMMAND ""
|
||||||
@ -183,7 +182,7 @@ export GFLAGS_LIBS=${GFlags_LIBS}
|
|||||||
URL_MD5 ${glog_MD5}
|
URL_MD5 ${glog_MD5}
|
||||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${glog_RELEASE}
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${glog_RELEASE}
|
||||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}
|
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/glog-${glog_RELEASE}
|
||||||
CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix=<INSTALL_DIR>
|
CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix=<INSTALL_DIR>
|
||||||
BUILD_COMMAND make
|
BUILD_COMMAND make
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
PATCH_COMMAND ""
|
PATCH_COMMAND ""
|
||||||
@ -272,8 +271,48 @@ endif()
|
|||||||
|
|
||||||
find_package(Armadillo)
|
find_package(Armadillo)
|
||||||
if(NOT ARMADILLO_FOUND)
|
if(NOT ARMADILLO_FOUND)
|
||||||
message(FATAL_ERROR "Armadillo required to build gnss-sdr. Please check http://arma.sourceforge.net/")
|
message (" Armadillo has not been found.")
|
||||||
endif()
|
message (" Armadillo will be downloaded and built automatically ")
|
||||||
|
message (" when doing 'make'. ")
|
||||||
|
set(armadillo_RELEASE 3.6.1)
|
||||||
|
set(armadillo_MD5 "cf0e72fbd2ed07d9fbde01ec8feee953")
|
||||||
|
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}/armadillo-${armadillo_RELEASE}.tar.gz)
|
||||||
|
set(ARMADILLO_PATCH_FILE ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}/armadillo_no.patch)
|
||||||
|
file(WRITE ${ARMADILLO_PATCH_FILE} "")
|
||||||
|
else(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}/armadillo-${armadillo_RELEASE}.tar.gz)
|
||||||
|
set(ARMADILLO_PATCH_FILE ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}/armadillo_staticlib.patch)
|
||||||
|
file(WRITE ${ARMADILLO_PATCH_FILE}
|
||||||
|
"43c43
|
||||||
|
< set(ARMA_USE_WRAPPER true ) # set this to false if you prefer to directly link with LAPACK and/or BLAS (eg. -llapack -lblas) instead of -larmadillo
|
||||||
|
---
|
||||||
|
> set(ARMA_USE_WRAPPER false) # set this to false if you prefer to directly link with LAPACK and/or BLAS (eg. -llapack -lblas) instead of -larmadillo
|
||||||
|
274c274
|
||||||
|
< add_library( armadillo SHARED src/wrap_libs )
|
||||||
|
---
|
||||||
|
> add_library( armadillo STATIC src/wrap_libs )
|
||||||
|
")
|
||||||
|
endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}/armadillo-${armadillo_RELEASE}.tar.gz)
|
||||||
|
ExternalProject_Add(
|
||||||
|
armadillo-${armadillo_RELEASE}
|
||||||
|
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}
|
||||||
|
URL http://sourceforge.net/projects/arma/files/armadillo-${armadillo_RELEASE}.tar.gz
|
||||||
|
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/download/armadillo-${armadillo_RELEASE}
|
||||||
|
URL_MD5 ${armadillo_MD5}
|
||||||
|
PATCH_COMMAND patch -N <BINARY_DIR>/CMakeLists.txt ${ARMADILLO_PATCH_FILE}
|
||||||
|
CONFIGURE_COMMAND <BINARY_DIR>/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE}
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
BUILD_COMMAND make
|
||||||
|
UPDATE_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
)
|
||||||
|
# Set up variables
|
||||||
|
ExternalProject_Get_Property(armadillo-${armadillo_RELEASE} binary_dir)
|
||||||
|
set(ARMADILLO_INCLUDE_DIRS ${binary_dir}/include )
|
||||||
|
find_library(lapack NAMES lapack HINTS /usr/lib /usr/local/lib /usr/lib64)
|
||||||
|
find_library(blas NAMES blas HINTS /usr/lib /usr/local/lib /usr/lib64)
|
||||||
|
set(ARMADILLO_LIBRARIES ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo.a ${lapack} ${blas} gfortran)
|
||||||
|
set(LOCAL_ARMADILLO true)
|
||||||
|
endif(NOT ARMADILLO_FOUND)
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -298,6 +337,7 @@ endif($ENV{RTLSDR_DRIVER} )
|
|||||||
########################################################################
|
########################################################################
|
||||||
# Setup the include paths
|
# Setup the include paths
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${Boost_INCLUDE_DIRS}
|
${Boost_INCLUDE_DIRS}
|
||||||
${GRUEL_INCLUDE_DIRS}
|
${GRUEL_INCLUDE_DIRS}
|
||||||
@ -352,5 +392,4 @@ list(APPEND CMAKE_CXX_FLAGS ${MY_CXX_FLAGS})
|
|||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,8 +26,8 @@ include_directories(
|
|||||||
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/gnuradio_blocks
|
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/gnuradio_blocks
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs
|
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs
|
||||||
${GNURADIO_CORE_INCLUDE_DIRS}
|
${GNURADIO_CORE_INCLUDE_DIRS}
|
||||||
${GNURADIO_GRUEL_INCLUDE_DIRS}
|
${ARMADILLO_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(pvt_adapters ${PVT_ADAPTER_SOURCES})
|
add_library(pvt_adapters ${PVT_ADAPTER_SOURCES})
|
||||||
target_link_libraries(pvt_adapters pvt_gr_blocks)
|
target_link_libraries(pvt_adapters pvt_gr_blocks ${ARMADILLO_LIBRARIES})
|
@ -25,8 +25,8 @@ include_directories(
|
|||||||
${CMAKE_SOURCE_DIR}/src/core/receiver
|
${CMAKE_SOURCE_DIR}/src/core/receiver
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs
|
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs
|
||||||
${GNURADIO_CORE_INCLUDE_DIRS}
|
${GNURADIO_CORE_INCLUDE_DIRS}
|
||||||
${GNURADIO_GRUEL_INCLUDE_DIRS}
|
${ARMADILLO_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(pvt_gr_blocks ${PVT_GR_BLOCKS_SOURCES})
|
add_library(pvt_gr_blocks ${PVT_GR_BLOCKS_SOURCES})
|
||||||
target_link_libraries(pvt_gr_blocks pvt_lib)
|
target_link_libraries(pvt_gr_blocks pvt_lib ${ARMADILLO_LIBRARIES})
|
@ -23,7 +23,6 @@ set(PVT_LIB_SOURCES
|
|||||||
nmea_printer.cc
|
nmea_printer.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
$(CMAKE_CURRENT_SOURCE_DIR)
|
$(CMAKE_CURRENT_SOURCE_DIR)
|
||||||
${CMAKE_SOURCE_DIR}/src/core/system_parameters
|
${CMAKE_SOURCE_DIR}/src/core/system_parameters
|
||||||
@ -37,4 +36,4 @@ include_directories(
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_library(pvt_lib ${PVT_LIB_SOURCES})
|
add_library(pvt_lib ${PVT_LIB_SOURCES})
|
||||||
target_link_libraries(pvt_lib ${Boost_LIBRARIES} ${GFlags_LIBS} ${ARMADILLO_LIBRARY})
|
target_link_libraries(pvt_lib ${Boost_LIBRARIES} ${GFlags_LIBS} ${ARMADILLO_LIBRARIES} )
|
@ -51,11 +51,10 @@ include_directories(
|
|||||||
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/adapters
|
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/adapters
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/gnuradio_blocks
|
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/gnuradio_blocks
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs
|
${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs
|
||||||
${Boost_INCLUDE_DIRS}
|
|
||||||
${GNURADIO_CORE_INCLUDE_DIRS}
|
${GNURADIO_CORE_INCLUDE_DIRS}
|
||||||
#${GNURADIO_GRUEL_INCLUDE_DIRS}
|
${ARMADILLO_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
link_directories(${Boost_LIBRARY_DIR})
|
link_directories(${Boost_LIBRARY_DIR})
|
||||||
|
|
||||||
add_library(gnss_rx ${GNSS_RECEIVER_SOURCES})
|
add_library(gnss_rx ${GNSS_RECEIVER_SOURCES})
|
||||||
target_link_libraries(gnss_rx ${Boost_LIBRARIES} gnuradio-core gnss_system_parameters gnss_sp_libs signal_source_adapters datatype_adapters input_filter_adapters conditioner_adapters resampler_adapters acq_adapters tracking_lib tracking_adapters channel_adapters telemetry_decoder_adapters obs_adapters pvt_adapters pvt_lib out_adapters rx_core_lib)
|
target_link_libraries(gnss_rx ${Boost_LIBRARIES} ${ARMADILLO_LIBRARIES} gnuradio-core gnss_system_parameters gnss_sp_libs signal_source_adapters datatype_adapters input_filter_adapters conditioner_adapters resampler_adapters acq_adapters tracking_lib tracking_adapters channel_adapters telemetry_decoder_adapters obs_adapters pvt_adapters pvt_lib out_adapters rx_core_lib)
|
@ -24,13 +24,12 @@ include_directories(
|
|||||||
${GLOG_INCLUDE_DIRS}
|
${GLOG_INCLUDE_DIRS}
|
||||||
${GFlags_INCLUDE_DIRS}
|
${GFlags_INCLUDE_DIRS}
|
||||||
${GNURADIO_CORE_INCLUDE_DIRS}
|
${GNURADIO_CORE_INCLUDE_DIRS}
|
||||||
${GNURADIO_GRUEL_INCLUDE_DIRS}
|
${ARMADILLO_INCLUDE_DIRS}
|
||||||
${Boost_INCLUDE_DIRS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
|
add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
|
||||||
target_link_libraries(gnss-sdr ${Boost_LIBRARIES} ${GLOG_LIBRARIES} ${GFlags_LIBS} gnss_sp_libs gnss_rx)
|
target_link_libraries(gnss-sdr ${Boost_LIBRARIES} ${GLOG_LIBRARIES} ${GFlags_LIBS} ${ARMADILLO_LIBRARIES} gnss_sp_libs gnss_rx)
|
||||||
#add_dependencies(gnss-sdr gflags-${glags_RELEASE} glog-${glog_RELEASE} STATIC)############
|
|
||||||
install(TARGETS gnss-sdr
|
install(TARGETS gnss-sdr
|
||||||
DESTINATION ${CMAKE_SOURCE_DIR}/install
|
DESTINATION ${CMAKE_SOURCE_DIR}/install
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user