mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	Merging next branch
This commit is contained in:
		| @@ -235,6 +235,10 @@ std::string galileo_e6_c_secondary_code(int32_t prn) | ||||
| { | ||||
|     std::string dest(static_cast<size_t>(GALILEO_E6_C_SECONDARY_CODE_LENGTH_CHIPS), '0'); | ||||
|     const uint32_t prn_ = prn - 1; | ||||
|     if ((prn < 1) || (prn > 50)) | ||||
|         { | ||||
|             return dest; | ||||
|         } | ||||
|     uint32_t index = 0; | ||||
|     for (size_t i = 0; i < GALILEO_E6_C_SECONDARY_CODE_STR_LENGTH; i++) | ||||
|         { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
| ######################################################################## | ||||
| # Project setup | ||||
| ######################################################################## | ||||
| cmake_minimum_required(VERSION 2.8.12...3.19) | ||||
| cmake_minimum_required(VERSION 2.8.12...3.20) | ||||
| if(NOT CMAKE_BUILD_TYPE) | ||||
|     set(CMAKE_BUILD_TYPE "Release") | ||||
| endif() | ||||
| @@ -204,7 +204,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.git) | ||||
| include(VolkVersion) # setup version info | ||||
| include(VolkGnsssdrVersion) # setup version info | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -0,0 +1,99 @@ | ||||
| # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. | ||||
| # This file is part of GNSS-SDR. | ||||
| # | ||||
| # Copyright (C) 2015-2021  (see AUTHORS file for a list of contributors) | ||||
| # SPDX-License-Identifier: BSD-3-Clause | ||||
|  | ||||
| if(DEFINED __INCLUDED_VOLK_VERSION_CMAKE) | ||||
|     return() | ||||
| endif() | ||||
| set(__INCLUDED_VOLK_VERSION_CMAKE TRUE) | ||||
|  | ||||
| #eventually, replace version.sh and fill in the variables below | ||||
| set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION}) | ||||
| set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION}) | ||||
| set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION}) | ||||
|  | ||||
| ######################################################################## | ||||
| # Extract the version string from git describe. | ||||
| ######################################################################## | ||||
| find_package(Git) | ||||
|  | ||||
| if(GIT_FOUND) | ||||
|     message(STATUS "Extracting version information from git...") | ||||
|     # was this info set in the CMake commandline? | ||||
|     if(NOT GIT_BRANCH) | ||||
|         # no: try to find it | ||||
|         execute_process( | ||||
|             COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD | ||||
|             WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||||
|             OUTPUT_VARIABLE GIT_BRANCH | ||||
|             OUTPUT_STRIP_TRAILING_WHITESPACE | ||||
|         ) | ||||
|     endif() | ||||
|     # was this info set in the CMake commandline? | ||||
|     if(NOT GIT_COMMIT_HASH) | ||||
|         # Get the latest abbreviated commit hash of the working branch | ||||
|         execute_process( | ||||
|             COMMAND ${GIT_EXECUTABLE} log -1 --format=%h | ||||
|             WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||||
|             OUTPUT_VARIABLE GIT_COMMIT_HASH | ||||
|             OUTPUT_STRIP_TRAILING_WHITESPACE | ||||
|         ) | ||||
|     endif() | ||||
|     set(VOLK_GNSSSDR_GIT_BRANCH "${GIT_BRANCH}") | ||||
|     set(VOLK_GNSSSDR_GIT_HASH "${GIT_COMMIT_HASH}") | ||||
| else() | ||||
|     if(GIT_COMMIT_HASH) | ||||
|         set(VOLK_GNSSSDR_GIT_HASH "${GIT_COMMIT_HASH}") | ||||
|     else() | ||||
|         set(VOLK_GNSSSDR_GIT_HASH "unknown") | ||||
|     endif() | ||||
|  | ||||
|     if(GIT_BRANCH) | ||||
|         set(VOLK_GNSSSDR_GIT_BRANCH "${GIT_BRANCH}") | ||||
|     else() | ||||
|         set(VOLK_GNSSSDR_GIT_BRANCH "unknown") | ||||
|     endif() | ||||
| endif() | ||||
|  | ||||
| if("${MAINT_VERSION}" MATCHES "git") | ||||
|     set(GIT_DESCRIBE "v${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}-${VOLK_GNSSSDR_GIT_BRANCH}-${VOLK_GNSSSDR_GIT_HASH}") | ||||
| else() | ||||
|     set(GIT_DESCRIBE "v${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}") | ||||
| endif() | ||||
|  | ||||
| ######################################################################## | ||||
| # Use the logic below to set the version constants | ||||
| ######################################################################## | ||||
| if("${MINOR_VERSION}" STREQUAL "git") | ||||
|     # VERSION: 1.0git-xxx-gxxxxxxxx | ||||
|     # DOCVER:  1.0git | ||||
|     # LIBVER:  1.0git | ||||
|     # SOVERSION:  1.0git | ||||
|     set(VERSION "${GIT_DESCRIBE}") | ||||
|     set(DOCVER "${MAJOR_VERSION}.0${MINOR_VERSION}") | ||||
|     set(LIBVER "${MAJOR_VERSION}.0${MINOR_VERSION}") | ||||
|     set(SOVERSION "${MAJOR_VERSION}.0${MINOR_VERSION}") | ||||
| elseif("${MAINT_VERSION}" MATCHES "git") | ||||
|     # VERSION: 1.2.3.git-xxx-gxxxxxxxx | ||||
|     # DOCVER:  1.2.3.git | ||||
|     # LIBVER:  1.2.3.git | ||||
|     # SOVERSION:  1.2.3.git | ||||
|     set(VERSION "${GIT_DESCRIBE}") | ||||
|     set(DOCVER "${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}") | ||||
|     set(LIBVER "${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}") | ||||
|     set(SOVERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}") | ||||
| else() | ||||
|     # This is a numbered release. | ||||
|     # VERSION: 1.2{.3} | ||||
|     # DOCVER:  1.2{.3} | ||||
|     # SOVERSION:  1.2.3 | ||||
|     if("${MAINT_VERSION}" STREQUAL "0") | ||||
|         set(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}") | ||||
|     else() | ||||
|         set(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}") | ||||
|     endif() | ||||
|     set(DOCVER "${VERSION}") | ||||
|     set(SOVERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}") | ||||
| endif() | ||||
| @@ -1,76 +0,0 @@ | ||||
| # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. | ||||
| # This file is part of GNSS-SDR. | ||||
| # | ||||
| # Copyright (C) 2015-2020  (see AUTHORS file for a list of contributors) | ||||
| # SPDX-License-Identifier: BSD-3-Clause | ||||
|  | ||||
| if(DEFINED __INCLUDED_VOLK_VERSION_CMAKE) | ||||
|     return() | ||||
| endif() | ||||
| set(__INCLUDED_VOLK_VERSION_CMAKE TRUE) | ||||
|  | ||||
| #eventually, replace version.sh and fill in the variables below | ||||
| set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION}) | ||||
| set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION}) | ||||
| set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION}) | ||||
|  | ||||
| ######################################################################## | ||||
| # Extract the version string from git describe. | ||||
| ######################################################################## | ||||
| find_package(Git) | ||||
|  | ||||
| if(GIT_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.git) | ||||
|     message(STATUS "Extracting version information from git describe...") | ||||
|     execute_process( | ||||
|         COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long | ||||
|         OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE | ||||
|         WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||||
|     ) | ||||
| else() | ||||
|   if(NOT VOLK_GIT_COUNT) | ||||
|     set(VOLK_GIT_COUNT "0") | ||||
|   endif() | ||||
|  | ||||
|   if(NOT VOLK_GIT_HASH) | ||||
|     set(VOLK_GIT_HASH "unknown") | ||||
|   endif() | ||||
|  | ||||
|   set(GIT_DESCRIBE "v${MAJOR_VERSION}.${MINOR_VERSION}-${VOLK_GIT_COUNT}-${VOLK_GIT_HASH}") | ||||
| endif() | ||||
|  | ||||
| ######################################################################## | ||||
| # Use the logic below to set the version constants | ||||
| ######################################################################## | ||||
| if("${MINOR_VERSION}" STREQUAL "git") | ||||
|     # VERSION: 1.0git-xxx-gxxxxxxxx | ||||
|     # DOCVER:  1.0git | ||||
|     # LIBVER:  1.0git | ||||
|     set(VERSION "${GIT_DESCRIBE}") | ||||
|     set(DOCVER  "${MAJOR_VERSION}.0${MINOR_VERSION}") | ||||
|     set(LIBVER  "${MAJOR_VERSION}.0${MINOR_VERSION}") | ||||
|     set(RC_MINOR_VERSION "0") | ||||
|     set(RC_MAINT_VERSION "0") | ||||
| elseif("${MAINT_VERSION}" STREQUAL "git") | ||||
|     # VERSION: 1.xgit-xxx-gxxxxxxxx | ||||
|     # DOCVER:  1.xgit | ||||
|     # LIBVER:  1.xgit | ||||
|     set(VERSION "${GIT_DESCRIBE}") | ||||
|     set(DOCVER  "${MAJOR_VERSION}.${MINOR_VERSION}${MAINT_VERSION}") | ||||
|     set(LIBVER  "${MAJOR_VERSION}.${MINOR_VERSION}${MAINT_VERSION}") | ||||
|     math(EXPR RC_MINOR_VERSION "${MINOR_VERSION} - 1") | ||||
|     set(RC_MAINT_VERSION "0") | ||||
| else() | ||||
|     # This is a numbered release. | ||||
|     # VERSION: 1.1{.x} | ||||
|     # DOCVER:  1.1{.x} | ||||
|     # LIBVER:  1.1{.x} | ||||
|     if("${MAINT_VERSION}" STREQUAL "0") | ||||
|         set(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}") | ||||
|     else() | ||||
|         set(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MAINT_VERSION}") | ||||
|     endif() | ||||
|     set(DOCVER "${VERSION}") | ||||
|     set(LIBVER "${VERSION}") | ||||
|     set(RC_MINOR_VERSION ${MINOR_VERSION}) | ||||
|     set(RC_MAINT_VERSION ${MAINT_VERSION}) | ||||
| endif() | ||||
| @@ -23,6 +23,16 @@ if(NOT CMAKE_BUILD_TYPE) | ||||
|       FORCE) | ||||
| endif() | ||||
|  | ||||
| # Workaround for cross-compilation with SDK | ||||
| if(DEFINED ENV{OECORE_TARGET_SYSROOT}) | ||||
|   set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake) | ||||
|   set(CMAKE_CROSSCOMPILING ON) | ||||
|   include(${CMAKE_TOOLCHAIN_FILE}) | ||||
|   if(CMAKE_SYSTEM_PROCESSOR MATCHES "^cortexa9hf") | ||||
|     set(CMAKE_SYSTEM_PROCESSOR arm-${CMAKE_SYSTEM_PROCESSOR}) | ||||
|   endif() | ||||
| endif() | ||||
|  | ||||
| # BUILD_TESTING is a standard CMake variable, but we declare it here to make it | ||||
| # prominent in the GUI. | ||||
| option(BUILD_TESTING "Enable test (depends on googletest)." OFF) | ||||
|   | ||||
| @@ -44,7 +44,7 @@ instructions) at runtime. | ||||
|  | ||||
| ## Code samples | ||||
|  | ||||
| **Note:** For C++ code, the library functions are defined in the `CpuFeatures` | ||||
| **Note:** For C++ code, the library functions are defined in the `cpu_features` | ||||
| namespace. | ||||
|  | ||||
| ### Checking features at runtime | ||||
| @@ -55,7 +55,7 @@ AES and the SSE4.2 instruction sets: | ||||
| ```c | ||||
| #include "cpuinfo_x86.h" | ||||
|  | ||||
| // For C++, add `using namespace CpuFeatures;` | ||||
| // For C++, add `using namespace cpu_features;` | ||||
| static const X86Features features = GetX86Info().features; | ||||
|  | ||||
| void Compute(void) { | ||||
| @@ -77,7 +77,7 @@ features and then check whether AES and NEON are supported. | ||||
| #include <stdbool.h> | ||||
| #include "cpuinfo_arm.h" | ||||
|  | ||||
| // For C++, add `using namespace CpuFeatures;` | ||||
| // For C++, add `using namespace cpu_features;` | ||||
| static const ArmFeatures features = GetArmInfo().features; | ||||
| static const bool has_aes_and_neon = features.aes && features.neon; | ||||
|  | ||||
| @@ -97,7 +97,7 @@ instruction set (e.g., `g++ -mavx`) and sets `has_avx` accordingly. | ||||
| #include <stdbool.h> | ||||
| #include "cpuinfo_x86.h" | ||||
|  | ||||
| // For C++, add `using namespace CpuFeatures;` | ||||
| // For C++, add `using namespace cpu_features;` | ||||
| static const X86Features features = GetX86Info().features; | ||||
| static const bool has_avx = CPU_FEATURES_COMPILED_X86_AVX || features.avx; | ||||
|  | ||||
| @@ -120,7 +120,7 @@ set—but only if it's not Sandy Bridge. | ||||
| #include <stdbool.h> | ||||
| #include "cpuinfo_x86.h" | ||||
|  | ||||
| // For C++, add `using namespace CpuFeatures;` | ||||
| // For C++, add `using namespace cpu_features;` | ||||
| static const X86Info info = GetX86Info(); | ||||
| static const X86Microarchitecture uarch = GetX86Microarchitecture(&info); | ||||
| static const bool has_fast_avx = info.features.avx && uarch != INTEL_SNB; | ||||
|   | ||||
| @@ -79,6 +79,7 @@ typedef struct | ||||
|  | ||||
|     int dca : 1; | ||||
|     int ss : 1; | ||||
|     int adx : 1; | ||||
|     // Make sure to update X86FeaturesEnum below if you add a field here. | ||||
| } X86Features; | ||||
|  | ||||
| @@ -207,6 +208,7 @@ typedef enum | ||||
|     X86_RDRND, | ||||
|     X86_DCA, | ||||
|     X86_SS, | ||||
|     X86_ADX, | ||||
|     X86_LAST_, | ||||
| } X86FeaturesEnum; | ||||
|  | ||||
|   | ||||
| @@ -74,7 +74,8 @@ | ||||
|     FEATURE(X86_MOVBE, movbe, "movbe", 0, 0)                                     \ | ||||
|     FEATURE(X86_RDRND, rdrnd, "rdrnd", 0, 0)                                     \ | ||||
|     FEATURE(X86_DCA, dca, "dca", 0, 0)                                           \ | ||||
|     FEATURE(X86_SS, ss, "ss", 0, 0) | ||||
|     FEATURE(X86_SS, ss, "ss", 0, 0)                                              \ | ||||
|     FEATURE(X86_ADX, adx, "adx", 0, 0) | ||||
| #define DEFINE_TABLE_FEATURE_TYPE X86Features | ||||
| #define DEFINE_TABLE_DONT_GENERATE_HWCAPS | ||||
| #include "define_tables.h" | ||||
| @@ -201,11 +202,13 @@ static bool HasYmmOsXSave(uint32_t xcr0_eax) | ||||
|  | ||||
| // Checks that operating system saves and restores zmm registers during context | ||||
| // switches. | ||||
| #if !defined(CPU_FEATURES_OS_DARWIN) | ||||
| static bool HasZmmOsXSave(uint32_t xcr0_eax) | ||||
| { | ||||
|     return HasMask(xcr0_eax, MASK_XMM | MASK_YMM | MASK_MASKREG | MASK_ZMM0_15 | | ||||
|                                  MASK_ZMM16_31); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| // Checks that operating system saves and restores AMX/TMUL state during context | ||||
| // switches. | ||||
| @@ -1184,6 +1187,20 @@ static void ParseLeaf4(const int max_cpuid_leaf, CacheInfo* info) | ||||
|         } | ||||
| } | ||||
|  | ||||
| #if defined(CPU_FEATURES_OS_DARWIN) | ||||
| #if defined(CPU_FEATURES_MOCK_CPUID_X86) | ||||
| extern bool GetDarwinSysCtlByName(const char*); | ||||
| #else  // CPU_FEATURES_MOCK_CPUID_X86 | ||||
| static bool GetDarwinSysCtlByName(const char* name) | ||||
| { | ||||
|     int enabled; | ||||
|     size_t enabled_len = sizeof(enabled); | ||||
|     const int failure = sysctlbyname(name, &enabled, &enabled_len, NULL, 0); | ||||
|     return failure ? false : enabled; | ||||
| } | ||||
| #endif | ||||
| #endif  // CPU_FEATURES_OS_DARWIN | ||||
|  | ||||
| // Internal structure to hold the OS support for vector operations. | ||||
| // Avoid to recompute them since each call to cpuid is ~100 cycles. | ||||
| typedef struct | ||||
| @@ -1212,7 +1229,11 @@ static OsSupport CheckOsSupport(const uint32_t max_cpuid_leaf) | ||||
|             const uint32_t xcr0_eax = GetXCR0Eax(); | ||||
|             os_support.have_sse_via_cpuid = HasXmmOsXSave(xcr0_eax); | ||||
|             os_support.have_avx = HasYmmOsXSave(xcr0_eax); | ||||
| #if defined(CPU_FEATURES_OS_DARWIN) | ||||
|             os_support.have_avx512 = GetDarwinSysCtlByName("hw.optional.avx512f"); | ||||
| #else | ||||
|             os_support.have_avx512 = HasZmmOsXSave(xcr0_eax); | ||||
| #endif  // CPU_FEATURES_OS_DARWIN | ||||
|             os_support.have_amx = HasTmmOsXSave(xcr0_eax); | ||||
|         } | ||||
|     else | ||||
| @@ -1235,20 +1256,6 @@ static bool GetWindowsIsProcessorFeaturePresent(DWORD ProcessorFeature) | ||||
| #endif | ||||
| #endif  // CPU_FEATURES_OS_WINDOWS | ||||
|  | ||||
| #if defined(CPU_FEATURES_OS_DARWIN) | ||||
| #if defined(CPU_FEATURES_MOCK_CPUID_X86) | ||||
| extern bool GetDarwinSysCtlByName(const char*); | ||||
| #else  // CPU_FEATURES_MOCK_CPUID_X86 | ||||
| static bool GetDarwinSysCtlByName(const char* name) | ||||
| { | ||||
|     int enabled; | ||||
|     size_t enabled_len = sizeof(enabled); | ||||
|     const int failure = sysctlbyname(name, &enabled, &enabled_len, NULL, 0); | ||||
|     return failure ? false : enabled; | ||||
| } | ||||
| #endif | ||||
| #endif  // CPU_FEATURES_OS_DARWIN | ||||
|  | ||||
| static void DetectSseViaOs(X86Features* features) | ||||
| { | ||||
| #if defined(CPU_FEATURES_OS_WINDOWS) | ||||
| @@ -1347,6 +1354,7 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, | ||||
|     features->sha = IsBitSet(leaf_7.ebx, 29); | ||||
|     features->vaes = IsBitSet(leaf_7.ecx, 9); | ||||
|     features->vpclmulqdq = IsBitSet(leaf_7.ecx, 10); | ||||
|     features->adx = IsBitSet(leaf_7.ebx, 19); | ||||
|  | ||||
|     if (os_support.have_sse_via_os) | ||||
|         { | ||||
|   | ||||
| @@ -150,6 +150,7 @@ TEST_F(CpuidX86Test, SandyBridge) | ||||
|     EXPECT_TRUE(features.popcnt); | ||||
|     EXPECT_FALSE(features.movbe); | ||||
|     EXPECT_FALSE(features.rdrnd); | ||||
|     EXPECT_FALSE(features.adx); | ||||
| } | ||||
|  | ||||
| const int KiB = 1024; | ||||
|   | ||||
| @@ -599,7 +599,8 @@ endif() | ||||
| if(NOT MSVC) | ||||
|     target_link_libraries(volk_gnsssdr PUBLIC m) | ||||
| endif() | ||||
| set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${LIBVER}) | ||||
| set_target_properties(volk_gnsssdr PROPERTIES VERSION ${VERSION}) | ||||
| set_target_properties(volk_gnsssdr PROPERTIES SOVERSION ${SOVERSION}) | ||||
| set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS") | ||||
|  | ||||
| # Install locations | ||||
|   | ||||
| @@ -10,6 +10,6 @@ LV_CXXFLAGS=@LV_CXXFLAGS@ | ||||
| Name: volk_gnsssdr | ||||
| Description: VOLK_GNSSSDR: Vector Optimized Library of Kernels specific for GNSS-SDR | ||||
| Requires: | ||||
| Version: @LIBVER@ | ||||
| Version: @SOVERSION@ | ||||
| Libs: -L${libdir} -lvolk_gnsssdr | ||||
| Cflags: -I${includedir} ${LV_CXXFLAGS} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas