1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-12 21:10:03 +00:00
This commit is contained in:
Carles Fernandez 2019-04-02 02:42:11 +02:00
commit 32a1714515
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 205 additions and 219 deletions

View File

@ -20,7 +20,7 @@
# Project setup
################################################################################
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(WARNING "In-tree build is bad practice. Try 'cd build && cmake ..'")
message(FATAL_ERROR "Prevented in-tree build, it is bad practice.\nTry 'cd build && cmake ..' instead.")
endif()
cmake_minimum_required(VERSION 2.8.12)
@ -28,6 +28,7 @@ project(gnss-sdr CXX C)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
################################################################################
# Determine optional blocks/libraries to be built (default: not built)
# Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..'
@ -436,7 +437,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
execute_process(COMMAND
${CMAKE_CXX_COMPILER} -v
RESULT_VARIABLE _res ERROR_VARIABLE _err
ERROR_STRIP_TRAILING_WHITESPACE)
ERROR_STRIP_TRAILING_WHITESPACE
)
if(${_res} STREQUAL "0")
# output is in error stream
string(REGEX MATCH "^Apple.*" IS_APPLE ${_err})
@ -624,73 +626,66 @@ endif()
if(CMAKE_VERSION VERSION_LESS 3.5)
if(NOT TARGET Boost::boost)
add_library(Boost::boost SHARED IMPORTED) # Trick for CMake 2.8.12
set_property(TARGET Boost::boost PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::boost PROPERTY
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES})
set_target_properties(Boost::boost PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
endif()
if(NOT TARGET Boost::date_time)
add_library(Boost::date_time SHARED IMPORTED)
set_property(TARGET Boost::date_time PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::date_time PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_DATE_TIME_LIBRARIES})
set_property(TARGET Boost::date_time PROPERTY
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES})
set_target_properties(Boost::date_time PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_DATE_TIME_LIBRARIES}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
endif()
if(NOT TARGET Boost::system)
add_library(Boost::system SHARED IMPORTED)
set_property(TARGET Boost::system PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::system PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_SYSTEM_LIBRARIES})
set_property(TARGET Boost::system PROPERTY
IMPORTED_LOCATION ${Boost_SYSTEM_LIBRARIES})
set_target_properties(Boost::system PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_SYSTEM_LIBRARIES}
)
endif()
if(NOT TARGET Boost::filesystem)
add_library(Boost::filesystem SHARED IMPORTED)
set_property(TARGET Boost::filesystem PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::filesystem PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_FILESYSTEM_LIBRARIES})
set_property(TARGET Boost::filesystem PROPERTY
IMPORTED_LOCATION ${Boost_FILESYSTEM_LIBRARIES})
set_target_properties(Boost::filesystem PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_FILESYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_FILESYSTEM_LIBRARIES}
)
endif()
if(NOT TARGET Boost::thread)
add_library(Boost::thread SHARED IMPORTED)
set_property(TARGET Boost::thread PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::thread PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_THREAD_LIBRARIES})
set_property(TARGET Boost::thread PROPERTY
IMPORTED_LOCATION ${Boost_THREAD_LIBRARIES})
set_target_properties(Boost::thread PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_THREAD_LIBRARIES}
IMPORTED_LOCATION ${Boost_THREAD_LIBRARIES}
)
endif()
if(NOT TARGET Boost::serialization)
add_library(Boost::serialization SHARED IMPORTED)
set_property(TARGET Boost::serialization PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::serialization PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_SERIALIZATION_LIBRARIES})
set_property(TARGET Boost::serialization PROPERTY
IMPORTED_LOCATION ${Boost_SERIALIZATION_LIBRARIES})
set_target_properties(Boost::serialization PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SERIALIZATION_LIBRARIES}
IMPORTED_LOCATION ${Boost_SERIALIZATION_LIBRARIES}
)
endif()
if(NOT TARGET Boost::chrono)
add_library(Boost::chrono SHARED IMPORTED)
set_property(TARGET Boost::chrono PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::chrono PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_CHRONO_LIBRARIES})
set_property(TARGET Boost::chrono PROPERTY
IMPORTED_LOCATION ${Boost_CHRONO_LIBRARIES})
set_target_properties(Boost::chrono PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_CHRONO_LIBRARIES}
IMPORTED_LOCATION ${Boost_CHRONO_LIBRARIES}
)
endif()
if(NOT TARGET Boost::atomic)
add_library(Boost::atomic SHARED IMPORTED)
set_property(TARGET Boost::atomic PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::atomic PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_ATOMIC_LIBRARIES})
set_property(TARGET Boost::atomic PROPERTY
IMPORTED_LOCATION ${Boost_ATOMIC_LIBRARIES})
set_target_properties(Boost::atomic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_ATOMIC_LIBRARIES}
IMPORTED_LOCATION ${Boost_ATOMIC_LIBRARIES}
)
endif()
endif()
@ -1205,8 +1200,8 @@ aclocal
automake --add-missing
autoreconf -vfi
cd ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure")
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure"
)
else()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags
"#!/bin/sh
@ -1218,13 +1213,15 @@ aclocal
automake --add-missing
autoreconf -vfi
cd ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure")
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure"
)
endif()
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
set(GLOG_CONFIGURE ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags)
@ -2267,14 +2264,16 @@ else()
REQUIRED_PACKAGES_NOT_FOUND
OPTIONAL_PACKAGES_FOUND
OPTIONAL_PACKAGES_NOT_FOUND
ENABLED_FEATURES DISABLED_FEATURES
ENABLED_FEATURES
DISABLED_FEATURES
)
feature_summary(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/features.log WHAT
REQUIRED_PACKAGES_FOUND
REQUIRED_PACKAGES_NOT_FOUND
OPTIONAL_PACKAGES_FOUND
OPTIONAL_PACKAGES_NOT_FOUND
ENABLED_FEATURES DISABLED_FEATURES
ENABLED_FEATURES
DISABLED_FEATURES
)
endif()
message(STATUS "GNSS-SDR v${VERSION} is ready to be built.")

View File

@ -23,22 +23,6 @@ add_subdirectory(system-tests/libs)
################################################################################
# Google Test - https://github.com/google/googletest
################################################################################
if(EXISTS $ENV{GTEST_DIR})
set(GTEST_DIR_LOCAL $ENV{GTEST_DIR})
endif()
if(GTEST_DIR)
set(GTEST_DIR_LOCAL ${GTEST_DIR})
endif()
if(NOT GTEST_DIR_LOCAL)
set(GTEST_DIR_LOCAL false)
else()
set(GTEST_DIR_LOCAL true)
endif()
if(GTEST_INCLUDE_DIRS)
set(GTEST_DIR_LOCAL true)
endif()
set(GTEST_COMPILER -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
set(TOOLCHAIN_ARG "")
if(EXISTS $ENV{OECORE_TARGET_SYSROOT})
@ -50,8 +34,7 @@ else()
endif()
endif()
if(NOT ${GTEST_DIR_LOCAL})
# if GTEST_DIR is not defined, we download and build it
if(NOT GOOGLETEST_FOUND)
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(DEBUG_POSTFIX "d")
endif()
@ -63,8 +46,7 @@ if(NOT ${GTEST_DIR_LOCAL})
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(
gtest-${GNSSSDR_GTEST_LOCAL_VERSION}
ExternalProject_Add(gtest-${GNSSSDR_GTEST_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG release-${GNSSSDR_GTEST_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}
@ -75,8 +57,7 @@ if(NOT ${GTEST_DIR_LOCAL})
INSTALL_COMMAND ""
)
else()
ExternalProject_Add(
gtest-${GNSSSDR_GTEST_LOCAL_VERSION}
ExternalProject_Add(gtest-${GNSSSDR_GTEST_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG release-${GNSSSDR_GTEST_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}
@ -224,8 +205,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/brdc3540.14n")
add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/circle.csv")
else()
ExternalProject_Add(
gnss-sim
ExternalProject_Add(gnss-sim
GIT_REPOSITORY https://bitbucket.org/jarribas/gnss-simulator
GIT_TAG ${GNSSSDR_GNSS_SIM_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gnss-sim
@ -262,8 +242,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
endif()
include(GNUInstallDirs)
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(
gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}
ExternalProject_Add(gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/SGL-UT/GPSTk
GIT_TAG v${GNSSSDR_GPSTK_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}
@ -273,8 +252,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
PATCH_COMMAND ""
)
else()
ExternalProject_Add(
gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}
ExternalProject_Add(gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/SGL-UT/GPSTk
GIT_TAG v${GNSSSDR_GPSTK_LOCAL_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}
@ -427,7 +405,8 @@ if(ENABLE_UNIT_TESTING)
else()
add_custom_command(TARGET run_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:run_tests>
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:run_tests>)
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:run_tests>
)
endif()
if(ENABLE_GPERFTOOLS)
if(GPERFTOOLS_FOUND)
@ -515,7 +494,8 @@ function(add_system_test executable)
else()
add_custom_command(TARGET ${executable} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${executable}>
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:${executable}>)
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:${executable}>
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
@ -844,7 +824,14 @@ else()
if(ENABLE_FPGA)
add_dependencies(check matio_test)
else()
add_dependencies(check control_thread_test flowgraph_test gnss_block_test
gnuradio_block_test acq_test trk_test matio_test)
add_dependencies(check
control_thread_test
flowgraph_test
gnss_block_test
gnuradio_block_test
acq_test
trk_test
matio_test
)
endif()
endif()