1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Improve volk_gnsssdr library versioning

This commit is contained in:
Carles Fernandez 2021-06-11 09:08:09 +02:00
parent d999a5e6a3
commit ac84750f60
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 103 additions and 79 deletions

View File

@ -204,7 +204,7 @@ message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_MAJOR_VERSION 0)
set(VERSION_INFO_MINOR_VERSION 0) set(VERSION_INFO_MINOR_VERSION 0)
set(VERSION_INFO_MAINT_VERSION 14.git) set(VERSION_INFO_MAINT_VERSION 14.git)
include(VolkVersion) # setup version info include(VolkGnsssdrVersion) # setup version info

View File

@ -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()

View File

@ -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()

View File

@ -599,7 +599,8 @@ endif()
if(NOT MSVC) if(NOT MSVC)
target_link_libraries(volk_gnsssdr PUBLIC m) target_link_libraries(volk_gnsssdr PUBLIC m)
endif() 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") set_target_properties(volk_gnsssdr PROPERTIES DEFINE_SYMBOL "volk_gnsssdr_EXPORTS")
# Install locations # Install locations

View File

@ -10,6 +10,6 @@ LV_CXXFLAGS=@LV_CXXFLAGS@
Name: volk_gnsssdr Name: volk_gnsssdr
Description: VOLK_GNSSSDR: Vector Optimized Library of Kernels specific for GNSS-SDR Description: VOLK_GNSSSDR: Vector Optimized Library of Kernels specific for GNSS-SDR
Requires: Requires:
Version: @LIBVER@ Version: @SOVERSION@
Libs: -L${libdir} -lvolk_gnsssdr Libs: -L${libdir} -lvolk_gnsssdr
Cflags: -I${includedir} ${LV_CXXFLAGS} Cflags: -I${includedir} ${LV_CXXFLAGS}