Minor version string generation improvements.
Remove the KICAD_REPO_NAME option from the main cmake file and the generated config.h file since it is no longer used. Set the default branch name to "undefined" in CreateGitVersionHeader.cmake instead of the KICAD_REPO_NAME option. Remove generating KICAD_FULL_VERSION from CreateGitVersionHeader.cmake and add it to WriteVersionHeader.cmake so that the default settings and the new KiCadVersion.cmake definitions can be used to generate the full version string as well. Check to see if the branch name is set and only use the version to generate the full version string. This allows the use of the KiCad version cmake file to create a version only string like "4.0.4" with no trailing branch name. Change build_version.cpp to use the full version string rather than concatenating the version and branch strings.
This commit is contained in:
parent
b54166daa3
commit
03da56a9b5
|
@ -91,10 +91,6 @@ option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
|
|||
|
||||
option( KICAD_SPICE "Build Kicad with internal Spice simulator." OFF )
|
||||
|
||||
# This can be set to a custom name to brag about a particular branch in the "About" dialog:
|
||||
set( KICAD_REPO_NAME "unknown" CACHE STRING "Name of the tree from which this build came." )
|
||||
|
||||
|
||||
# Global setting: exports are explicit
|
||||
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
|
||||
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
|
||||
|
|
|
@ -27,7 +27,7 @@ macro( create_git_version_header _git_src_path )
|
|||
# version, set the build version string to "no-git" and the default
|
||||
# branch name to unknown
|
||||
set( KICAD_BUILD_VERSION "no-git" )
|
||||
set( KICAD_BRANCH_NAME ${KICAD_REPO_NAME} )
|
||||
set( KICAD_BRANCH_NAME "undefined" )
|
||||
set( KICAD_FULL_VERSION "${KICAD_BUILD_VERSION}-${KICAD_BRANCH_NAME}")
|
||||
|
||||
# Include Git support to automagically create version header file.
|
||||
|
@ -108,5 +108,4 @@ macro( create_git_version_header _git_src_path )
|
|||
endif()
|
||||
|
||||
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
|
||||
set( KICAD_FULL_VERSION "${KICAD_BUILD_VERSION}-${KICAD_BRANCH_NAME}")
|
||||
endmacro()
|
||||
|
|
|
@ -27,20 +27,25 @@
|
|||
# CreateGitVersionHeader cannot determine the current repo version, a
|
||||
# version.h file is still created with KICAD_BUILD_VERSION set to
|
||||
# "no-vcs-found".
|
||||
if( NOT KICAD_BUILD_VERSION )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
|
||||
# Attempt to detect if we have a git repo and set the version string.
|
||||
if( EXISTS "${SRC_PATH}/.git" )
|
||||
message( STATUS "Using Git to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header( ${SRC_PATH} )
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
endif()
|
||||
else()
|
||||
# Attempt to detect if we have a git repo and set the version string.
|
||||
if( EXISTS "${SRC_PATH}/.git" )
|
||||
message( STATUS "Using Git to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header( ${SRC_PATH} )
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
endif()
|
||||
|
||||
# If KICAD_BRANCH_NAME is empty, set KICAD_FULL_VERSION to just the build
|
||||
# version rather than the concatenation of the build version and the branch
|
||||
# name.
|
||||
if( KICAD_BRANCH_NAME )
|
||||
set( KICAD_FULL_VERSION "${_wvh_version_str}-${KICAD_BRANCH_NAME}" )
|
||||
else()
|
||||
set( KICAD_FULL_VERSION "${_wvh_version_str}" )
|
||||
endif()
|
||||
|
||||
set( _wvh_new_version_text
|
||||
"/* Do not modify this file, it was automatically generated by CMake. */
|
||||
|
||||
|
|
|
@ -77,7 +77,4 @@
|
|||
#define KIFACE_SUFFIX "@KIFACE_SUFFIX@"
|
||||
#define KIFACE_PREFIX "@KIFACE_PREFIX@"
|
||||
|
||||
/// Name of repo from which this build came.
|
||||
#define KICAD_REPO_NAME "@KICAD_REPO_NAME@"
|
||||
|
||||
#endif // CONFIG_H_
|
||||
|
|
|
@ -37,9 +37,8 @@
|
|||
wxString GetBuildVersion()
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
wxT( "%s-%s" ),
|
||||
wxT( KICAD_BUILD_VERSION ),
|
||||
wxT( KICAD_BRANCH_NAME )
|
||||
wxT( "%s" ),
|
||||
wxT( KICAD_FULL_VERSION )
|
||||
);
|
||||
|
||||
return msg;
|
||||
|
|
Loading…
Reference in New Issue