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:
Wayne Stambaugh 2016-10-12 20:29:46 -04:00
parent b54166daa3
commit 03da56a9b5
5 changed files with 18 additions and 22 deletions

View File

@ -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 ) 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 # Global setting: exports are explicit
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" ) set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON ) set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )

View File

@ -27,7 +27,7 @@ macro( create_git_version_header _git_src_path )
# version, set the build version string to "no-git" and the default # version, set the build version string to "no-git" and the default
# branch name to unknown # branch name to unknown
set( KICAD_BUILD_VERSION "no-git" ) 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}") set( KICAD_FULL_VERSION "${KICAD_BUILD_VERSION}-${KICAD_BRANCH_NAME}")
# Include Git support to automagically create version header file. # Include Git support to automagically create version header file.
@ -108,5 +108,4 @@ macro( create_git_version_header _git_src_path )
endif() endif()
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} ) set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
set( KICAD_FULL_VERSION "${KICAD_BUILD_VERSION}-${KICAD_BRANCH_NAME}")
endmacro() endmacro()

View File

@ -27,20 +27,25 @@
# CreateGitVersionHeader cannot determine the current repo version, a # CreateGitVersionHeader cannot determine the current repo version, a
# version.h file is still created with KICAD_BUILD_VERSION set to # version.h file is still created with KICAD_BUILD_VERSION set to
# "no-vcs-found". # "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. # Attempt to detect if we have a git repo and set the version string.
if( EXISTS "${SRC_PATH}/.git" ) if( EXISTS "${SRC_PATH}/.git" )
message( STATUS "Using Git to determine build version string." ) message( STATUS "Using Git to determine build version string." )
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake ) include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
create_git_version_header( ${SRC_PATH} ) create_git_version_header( ${SRC_PATH} )
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
endif()
else()
set( _wvh_version_str ${KICAD_BUILD_VERSION} ) set( _wvh_version_str ${KICAD_BUILD_VERSION} )
endif() 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 set( _wvh_new_version_text
"/* Do not modify this file, it was automatically generated by CMake. */ "/* Do not modify this file, it was automatically generated by CMake. */

View File

@ -77,7 +77,4 @@
#define KIFACE_SUFFIX "@KIFACE_SUFFIX@" #define KIFACE_SUFFIX "@KIFACE_SUFFIX@"
#define KIFACE_PREFIX "@KIFACE_PREFIX@" #define KIFACE_PREFIX "@KIFACE_PREFIX@"
/// Name of repo from which this build came.
#define KICAD_REPO_NAME "@KICAD_REPO_NAME@"
#endif // CONFIG_H_ #endif // CONFIG_H_

View File

@ -37,9 +37,8 @@
wxString GetBuildVersion() wxString GetBuildVersion()
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format(
wxT( "%s-%s" ), wxT( "%s" ),
wxT( KICAD_BUILD_VERSION ), wxT( KICAD_FULL_VERSION )
wxT( KICAD_BRANCH_NAME )
); );
return msg; return msg;