mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-12 18:30:34 +00:00
Fix clash of the cpu_features library when volk_gnsssdr is built as a standalone library, and cpu_features was already installed by VOLK
Added new building option ENABLE_OWN_CPUFEATURES, set to ON when building gnss-sdr but set to OFF when building volk_gnsssdr standalone. The default does no change old behavior when buiding gnss-sdr without volk_gnsssdr already installed
This commit is contained in:
parent
87882d3d23
commit
603cab1ead
@ -94,6 +94,8 @@ option(ENABLE_SYSTEM_TESTING_EXTRA "Download external tools and build extra syst
|
||||
|
||||
option(ENABLE_GNSS_SIM_INSTALL "Enable the installation of gnss_sim on the fly" ON)
|
||||
|
||||
option(ENABLE_OWN_CPUFEATURES "Force the building of the cpu_features library even if it is already installed" ON)
|
||||
|
||||
if(NOT (ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA))
|
||||
set(ENABLE_GNSS_SIM_INSTALL OFF)
|
||||
endif()
|
||||
@ -1102,6 +1104,7 @@ if(NOT VOLKGNSSSDR_FOUND)
|
||||
set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install
|
||||
-DENABLE_STATIC_LIBS=ON
|
||||
-DENABLE_OWN_CPUFEATURES=${ENABLE_OWN_CPUFEATURES}
|
||||
-DENABLE_PROFILING=${ENABLE_PROFILING}
|
||||
-DENABLE_ORC=${ORC_ENABLED}
|
||||
${STRIP_VOLK_GNSSSDR_PROFILE}
|
||||
@ -1156,6 +1159,33 @@ if(NOT VOLKGNSSSDR_FOUND)
|
||||
)
|
||||
else()
|
||||
if(SUPPORTED_CPU_FEATURES_ARCH)
|
||||
set(VOLK_GNSSSDR_BUILD_BYPRODUCTS
|
||||
${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile
|
||||
)
|
||||
if(NOT ENABLE_OWN_CPUFEATURES)
|
||||
find_package(CpuFeatures QUIET)
|
||||
set_package_properties(CpuFeatures PROPERTIES
|
||||
URL "https://github.com/google/cpu_features"
|
||||
PURPOSE "Used by the volk_gnsssdr library."
|
||||
TYPE REQUIRED
|
||||
)
|
||||
endif()
|
||||
if(CpuFeatures_FOUND)
|
||||
message(STATUS "Found CpuFeatures: (found version ${CpuFeatures_VERSION})")
|
||||
set_package_properties(CpuFeatures PROPERTIES
|
||||
DESCRIPTION "A cross platform C99 library to get CPU features at runtime (found: v${CpuFeatures_VERSION})"
|
||||
)
|
||||
else()
|
||||
set_package_properties(CpuFeatures PROPERTIES
|
||||
DESCRIPTION "A cross platform C99 library to get CPU features at runtime"
|
||||
PURPOSE "CpuFeatures will be built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
|
||||
)
|
||||
set(VOLK_GNSSSDR_BUILD_BYPRODUCTS
|
||||
${VOLK_GNSSSDR_BUILD_BYPRODUCTS}
|
||||
${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
)
|
||||
endif()
|
||||
ExternalProject_Add(volk_gnsssdr_module
|
||||
PREFIX ${CMAKE_BINARY_DIR}/volk_gnsssdr_module
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr
|
||||
@ -1167,9 +1197,7 @@ if(NOT VOLKGNSSSDR_FOUND)
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile
|
||||
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile
|
||||
${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
BUILD_BYPRODUCTS ${VOLK_GNSSSDR_BUILD_BYPRODUCTS}
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install
|
||||
)
|
||||
else()
|
||||
@ -1200,6 +1228,9 @@ if(NOT VOLKGNSSSDR_FOUND)
|
||||
set_property(TARGET volk_gnsssdr PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
set(VOLK_GNSSSDR_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build/include/;${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include;${ORC_INCLUDE_DIRS}")
|
||||
set(VOLK_GNSSSDR_LIBRARIES volk_gnsssdr ${ORC_LIBRARIES_STATIC})
|
||||
if(CpuFeatures_FOUND)
|
||||
set(VOLK_GNSSSDR_LIBRARIES ${VOLK_GNSSSDR_LIBRARIES} CpuFeatures::cpu_features)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET Volkgnsssdr::volkgnsssdr)
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build/include)
|
||||
@ -1213,9 +1244,11 @@ if(NOT VOLKGNSSSDR_FOUND)
|
||||
INTERFACE_LINK_LIBRARIES "${VOLK_GNSSSDR_LIBRARIES}"
|
||||
)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.0 AND SUPPORTED_CPU_FEATURES_ARCH)
|
||||
set_target_properties(Volkgnsssdr::volkgnsssdr PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
)
|
||||
if(NOT CpuFeatures_FOUND)
|
||||
set_target_properties(Volkgnsssdr::volkgnsssdr PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -1240,6 +1273,8 @@ if(NOT VOLKGNSSSDR_FOUND)
|
||||
set_package_properties(VOLKGNSSSDR PROPERTIES
|
||||
PURPOSE "volk_gnsssdr will be built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
|
||||
)
|
||||
else()
|
||||
set(ENABLE_OWN_CPUFEATURES OFF)
|
||||
endif()
|
||||
|
||||
|
||||
@ -3210,6 +3245,7 @@ add_feature_info(ENABLE_GNSS_SIM_INSTALL ENABLE_GNSS_SIM_INSTALL "Enables downlo
|
||||
add_feature_info(ENABLE_INSTALL_TESTS ENABLE_INSTALL_TESTS "Install test binaries when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} install'.")
|
||||
add_feature_info(ENABLE_BENCHMARKS ENABLE_BENCHMARKS "Enables building of code snippet benchmarks.")
|
||||
add_feature_info(ENABLE_EXTERNAL_MATHJAX ENABLE_EXTERNAL_MATHJAX "Use MathJax from an external CDN in HTML docs when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} doc'.")
|
||||
add_feature_info(ENABLE_OWN_CPUFEATURES ENABLE_OWN_CPUFEATURES "Force building own local version of the cpu_features library, even if it is already installed.")
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "***************************************")
|
||||
|
@ -8,6 +8,20 @@ SPDX-FileCopyrightText: 2011-2021 Carles Fernandez-Prades <carles.fernandez@cttc
|
||||
)
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next)
|
||||
|
||||
### Improvements in Portability:
|
||||
|
||||
- Avoid collision of the `cpu_features` library when installing the
|
||||
`volk_gnsssdr` library by its own, and VOLK has already installed its version.
|
||||
Added a new building option `ENABLE_OWN_CPUFEATURES`, defaulting to `ON` when
|
||||
building `gnss-sdr` but defaulting to `OFF` when building a stand-alone
|
||||
version of `volk_gnsssdr`. When this building option is set to `ON`, it forces
|
||||
the building of the local version of the cpu_features library, regardless of
|
||||
whether it is already installed or not.
|
||||
|
||||
|
||||
|
||||
## [GNSS-SDR v0.0.14](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.14)
|
||||
|
||||
### Improvements in Availability:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
# This file is part of GNSS-SDR.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||
# SPDX-FileCopyrightText: 2010-2021 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
|
||||
|
||||
set(VERSION_INFO_MAJOR_VERSION 0)
|
||||
set(VERSION_INFO_MINOR_VERSION 0)
|
||||
set(VERSION_INFO_MAINT_VERSION 14)
|
||||
set(VERSION_INFO_MAINT_VERSION 14.git)
|
||||
include(VolkVersion) # setup version info
|
||||
|
||||
|
||||
@ -244,6 +244,8 @@ endif()
|
||||
########################################################################
|
||||
|
||||
# cpu_features
|
||||
option(ENABLE_OWN_CPUFEATURES "Force the building of the cpu_features library even if it is already installed" OFF)
|
||||
|
||||
set(SUPPORTED_CPU_FEATURES_ARCH FALSE)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
|
||||
set(SUPPORTED_CPU_FEATURES_ARCH TRUE)
|
||||
@ -265,7 +267,14 @@ if(CMAKE_VERSION VERSION_GREATER 3.0 AND SUPPORTED_CPU_FEATURES_ARCH)
|
||||
set(USE_CPU_FEATURES ON)
|
||||
set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
add_subdirectory(cpu_features)
|
||||
if(NOT ENABLE_OWN_CPUFEATURES)
|
||||
find_package(CpuFeatures QUIET)
|
||||
endif()
|
||||
if(CpuFeatures_FOUND)
|
||||
message(STATUS "Found CpuFeatures: (found version ${CpuFeatures_VERSION})")
|
||||
else()
|
||||
add_subdirectory(cpu_features)
|
||||
endif()
|
||||
set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
|
||||
endif()
|
||||
|
||||
|
@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
)
|
||||
|
||||
[comment]: # (
|
||||
SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc.es>
|
||||
SPDX-FileCopyrightText: 2011-2021 Carles Fernandez-Prades <carles.fernandez@cttc.es>
|
||||
)
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
@ -57,6 +57,12 @@ not found by CMake on your system at configure time.
|
||||
However, you can install and use VOLK_GNSSSDR kernels as you use VOLK's,
|
||||
independently of GNSS-SDR.
|
||||
|
||||
If you want to install the VOLK and VOLK_GNSSSDR libraries in the same machine,
|
||||
please install VOLK before building VOLK_GNSSSDR in order to avoid a clash of
|
||||
the [cpu_features](https://github.com/google/cpu_features) library, used
|
||||
internally by both. The CMake script will detect the presence of cpu_features
|
||||
and will make use of it if already installed, thus avoiding to install it twice.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
First, make sure that the required dependencies are installed in your machine:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
# This file is part of GNSS-SDR.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||
# SPDX-FileCopyrightText: 2010-2021 C. Fernandez-Prades cfernandez(at)cttc.es
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
@ -532,10 +532,17 @@ if(NOT (CMAKE_GENERATOR STREQUAL Xcode))
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
if(USE_CPU_FEATURES)
|
||||
target_include_directories(volk_gnsssdr_obj
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
if(CpuFeatures_FOUND)
|
||||
target_include_directories(volk_gnsssdr_obj
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:CpuFeatures::cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
else()
|
||||
target_include_directories(volk_gnsssdr_obj
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
# Configure object target properties
|
||||
if(NOT MSVC)
|
||||
@ -550,10 +557,17 @@ else()
|
||||
add_library(volk_gnsssdr SHARED $<TARGET_OBJECTS:volk_gnsssdr_obj>)
|
||||
endif()
|
||||
if(USE_CPU_FEATURES)
|
||||
target_link_libraries(volk_gnsssdr
|
||||
PUBLIC ${volk_gnsssdr_libraries}
|
||||
PRIVATE cpu_features
|
||||
)
|
||||
if(CpuFeatures_FOUND)
|
||||
target_link_libraries(volk_gnsssdr
|
||||
PUBLIC ${volk_gnsssdr_libraries}
|
||||
PRIVATE CpuFeatures::cpu_features
|
||||
)
|
||||
else()
|
||||
target_link_libraries(volk_gnsssdr
|
||||
PUBLIC ${volk_gnsssdr_libraries}
|
||||
PRIVATE cpu_features
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries})
|
||||
endif()
|
||||
@ -566,10 +580,17 @@ target_include_directories(volk_gnsssdr
|
||||
PUBLIC $<INSTALL_INTERFACE:include>
|
||||
)
|
||||
if(USE_CPU_FEATURES)
|
||||
target_include_directories(volk_gnsssdr
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
if(CpuFeatures_FOUND)
|
||||
target_include_directories(volk_gnsssdr
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:CpuFeatures::cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
else()
|
||||
target_include_directories(volk_gnsssdr
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:cpu_features,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
# Configure target properties
|
||||
if(ORC_FOUND)
|
||||
@ -598,9 +619,15 @@ if(ENABLE_STATIC_LIBS)
|
||||
endif()
|
||||
target_link_libraries(volk_gnsssdr_static PUBLIC ${volk_gnsssdr_libraries})
|
||||
if(USE_CPU_FEATURES)
|
||||
target_link_libraries(volk_gnsssdr_static
|
||||
PRIVATE cpu_features
|
||||
)
|
||||
if(CpuFeatures_FOUND)
|
||||
target_link_libraries(volk_gnsssdr_static
|
||||
PRIVATE CpuFeatures::cpu_features
|
||||
)
|
||||
else()
|
||||
target_link_libraries(volk_gnsssdr_static
|
||||
PRIVATE cpu_features
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(ORC_FOUND)
|
||||
target_link_libraries(volk_gnsssdr_static PUBLIC ${ORC_LIBRARIES_STATIC})
|
||||
|
Loading…
Reference in New Issue
Block a user