mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-22 10:04:52 +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:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user