2015-07-05 19:24:34 +00:00
|
|
|
|
#
|
|
|
|
|
# This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
|
#
|
2018-02-12 21:04:48 +00:00
|
|
|
|
# Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
2020-03-07 18:43:24 +00:00
|
|
|
|
# Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2015-07-05 19:24:34 +00:00
|
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, you may find one here:
|
|
|
|
|
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
|
# or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
|
# or you may write to the Free Software Foundation, Inc.,
|
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
|
#
|
|
|
|
|
|
2019-12-18 17:24:07 +00:00
|
|
|
|
# Create the KiCad version strings
|
2016-10-13 00:29:46 +00:00
|
|
|
|
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
2019-12-18 17:24:07 +00:00
|
|
|
|
include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
|
2016-10-13 00:29:46 +00:00
|
|
|
|
|
2020-03-07 18:43:24 +00:00
|
|
|
|
# Extract the major and minor build version as a string
|
|
|
|
|
string( REGEX MATCH
|
2022-01-23 19:46:37 +00:00
|
|
|
|
"([0-9]+)\\.([0-9]+)\\.([0-9]+).*"
|
|
|
|
|
KICAD_MAJOR_MINOR_PATCH_VERSION
|
2020-03-07 18:43:24 +00:00
|
|
|
|
"${KICAD_SEMANTIC_VERSION}"
|
|
|
|
|
)
|
|
|
|
|
|
2022-01-23 19:46:37 +00:00
|
|
|
|
if( CMAKE_MATCH_COUNT EQUAL 3 )
|
2020-09-15 16:31:24 +00:00
|
|
|
|
# Match slot 0 is the full string, so we want slots 1 & 2
|
|
|
|
|
set( KICAD_MAJOR_MINOR_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
|
2022-01-23 19:46:37 +00:00
|
|
|
|
|
|
|
|
|
set( KICAD_MAJOR_MINOR_PATCH_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" )
|
2022-05-30 23:26:24 +00:00
|
|
|
|
set( KICAD_MAJOR_MINOR_PATCH_TUPLE "{ ${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}, ${CMAKE_MATCH_3} }" )
|
2022-01-23 19:46:37 +00:00
|
|
|
|
|
2020-09-15 16:31:24 +00:00
|
|
|
|
set( KICAD_MAJOR_VERSION "${CMAKE_MATCH_1}" )
|
2022-01-23 13:27:51 +00:00
|
|
|
|
set( KICAD_MINOR_VERSION "${CMAKE_MATCH_2}" )
|
2022-01-23 19:46:37 +00:00
|
|
|
|
set( KICAD_PATCH_VERSION "${CMAKE_MATCH_3}" )
|
2022-01-23 13:27:51 +00:00
|
|
|
|
|
|
|
|
|
if( KICAD_MINOR_VERSION STREQUAL "99" )
|
2022-01-23 19:16:02 +00:00
|
|
|
|
set( KICAD_IS_NIGHTLY "1" )
|
2022-01-23 13:27:51 +00:00
|
|
|
|
else()
|
2022-01-23 19:16:02 +00:00
|
|
|
|
set( KICAD_IS_NIGHTLY "0" )
|
2022-01-23 13:27:51 +00:00
|
|
|
|
endif()
|
|
|
|
|
|
2022-01-23 19:46:37 +00:00
|
|
|
|
set( KICAD_WIN32_RC_FILEVER_STR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${KICAD_GIT_REV}\\0" )
|
|
|
|
|
set( KICAD_WIN32_RC_FILEVER "${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}, ${CMAKE_MATCH_3}, ${KICAD_GIT_REV}" )
|
2022-03-15 00:34:14 +00:00
|
|
|
|
set( KICAD_WIN32_RC_PRODVER_STR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}\\0" )
|
2022-01-23 19:46:37 +00:00
|
|
|
|
set( KICAD_WIN32_RC_PRODVER "${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}, ${CMAKE_MATCH_3}, ${KICAD_GIT_REV}" )
|
2020-03-07 18:43:24 +00:00
|
|
|
|
else()
|
2022-01-23 19:46:37 +00:00
|
|
|
|
message( FATAL_ERROR "Unable to extract major, minor and patch version string" )
|
2020-03-07 18:43:24 +00:00
|
|
|
|
endif()
|
|
|
|
|
|
2016-09-27 15:40:12 +00:00
|
|
|
|
set( _wvh_new_version_text
|
2015-07-05 19:24:34 +00:00
|
|
|
|
"/* Do not modify this file, it was automatically generated by CMake. */
|
|
|
|
|
|
|
|
|
|
/*
|
2020-03-07 18:43:24 +00:00
|
|
|
|
* Define the KiCad build version strings.
|
2015-07-05 19:24:34 +00:00
|
|
|
|
*/
|
|
|
|
|
#ifndef __KICAD_VERSION_H__
|
|
|
|
|
#define __KICAD_VERSION_H__
|
|
|
|
|
|
2020-10-26 10:54:36 +00:00
|
|
|
|
#define KICAD_VERSION_FULL \"${KICAD_VERSION_FULL}\"
|
|
|
|
|
#define KICAD_SEMANTIC_VERSION \"${KICAD_SEMANTIC_VERSION}\"
|
|
|
|
|
#define KICAD_MAJOR_VERSION \"${KICAD_MAJOR_VERSION}\"
|
2022-01-23 13:27:51 +00:00
|
|
|
|
#define KICAD_MINOR_VERSION \"${KICAD_MINOR_VERSION}\"
|
2022-01-23 19:46:37 +00:00
|
|
|
|
#define KICAD_PATCH_VERSION \"${KICAD_PATCH_VERSION}\"
|
2022-01-23 13:27:51 +00:00
|
|
|
|
#define KICAD_IS_NIGHTLY ${KICAD_IS_NIGHTLY}
|
2020-10-26 10:54:36 +00:00
|
|
|
|
#define KICAD_MAJOR_MINOR_VERSION \"${KICAD_MAJOR_MINOR_VERSION}\"
|
2022-05-30 23:26:24 +00:00
|
|
|
|
#define KICAD_MAJOR_MINOR_PATCH_TUPLE ${KICAD_MAJOR_MINOR_PATCH_TUPLE}
|
2020-10-26 10:54:36 +00:00
|
|
|
|
#define KICAD_WIN32_RC_PRODVER ${KICAD_WIN32_RC_PRODVER}
|
|
|
|
|
#define KICAD_WIN32_RC_PRODVER_STR \"${KICAD_WIN32_RC_PRODVER_STR}\"
|
|
|
|
|
#define KICAD_WIN32_RC_FILEVER ${KICAD_WIN32_RC_FILEVER}
|
|
|
|
|
#define KICAD_WIN32_RC_FILEVER_STR \"${KICAD_WIN32_RC_FILEVER_STR}\"
|
2015-07-05 19:24:34 +00:00
|
|
|
|
|
|
|
|
|
#endif /* __KICAD_VERSION_H__ */
|
2016-09-27 15:40:12 +00:00
|
|
|
|
" )
|
|
|
|
|
|
|
|
|
|
set( _wvh_write_version_file ON )
|
|
|
|
|
|
|
|
|
|
# Only write the header if it has changed, to avoid rebuilds
|
|
|
|
|
if( EXISTS ${OUTPUT_FILE} )
|
|
|
|
|
file( READ ${OUTPUT_FILE} _wvh_old_version_text )
|
|
|
|
|
if( _wvh_old_version_text STREQUAL _wvh_new_version_text )
|
|
|
|
|
message( STATUS "Not updating ${OUTPUT_FILE}" )
|
|
|
|
|
set( _wvh_write_version_file OFF )
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if( _wvh_write_version_file )
|
2016-11-24 17:37:34 +00:00
|
|
|
|
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${KICAD_VERSION_FULL}" )
|
2016-09-27 15:40:12 +00:00
|
|
|
|
|
|
|
|
|
file( WRITE ${OUTPUT_FILE} ${_wvh_new_version_text} )
|
2015-07-05 19:24:34 +00:00
|
|
|
|
|
2020-07-21 22:13:58 +00:00
|
|
|
|
# Write a simple document with only the full version
|
|
|
|
|
file( WRITE ${TEXT_OUTPUT_FILE} "${KICAD_VERSION_FULL}" )
|
2015-07-10 18:47:59 +00:00
|
|
|
|
endif()
|
2015-07-05 19:24:34 +00:00
|
|
|
|
|
2015-07-10 18:47:59 +00:00
|
|
|
|
# There should always be a valid version.h file. Otherwise, the build will fail.
|
2015-11-24 10:05:34 +00:00
|
|
|
|
if( NOT EXISTS ${OUTPUT_FILE} )
|
2015-07-10 18:47:59 +00:00
|
|
|
|
message( FATAL_ERROR "Configuration failed to write file ${OUTPUT_FILE}." )
|
|
|
|
|
endif()
|