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
|
2020-09-15 16:31:24 +00:00
|
|
|
|
"([0-9]+)\\.([0-9]+)\\..*"
|
2020-03-07 18:43:24 +00:00
|
|
|
|
KICAD_MAJOR_MINOR_VERSION
|
|
|
|
|
"${KICAD_SEMANTIC_VERSION}"
|
|
|
|
|
)
|
|
|
|
|
|
2020-09-15 16:31:24 +00:00
|
|
|
|
if( CMAKE_MATCH_COUNT EQUAL 2 )
|
|
|
|
|
# Match slot 0 is the full string, so we want slots 1 & 2
|
|
|
|
|
set( KICAD_MAJOR_MINOR_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
|
|
|
|
|
set( KICAD_MAJOR_VERSION "${CMAKE_MATCH_1}" )
|
2020-03-07 18:43:24 +00:00
|
|
|
|
else()
|
|
|
|
|
message( FATAL_ERROR "Unable to extract major and minor version string" )
|
|
|
|
|
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-03-07 18:43:24 +00:00
|
|
|
|
#define KICAD_VERSION_FULL \"${KICAD_VERSION_FULL}\"
|
|
|
|
|
#define KICAD_SEMANTIC_VERSION \"${KICAD_SEMANTIC_VERSION}\"
|
2020-09-15 16:31:24 +00:00
|
|
|
|
#define KICAD_MAJOR_VERSION \"${KICAD_MAJOR_VERSION}\"
|
2020-03-07 18:43:24 +00:00
|
|
|
|
#define KICAD_MAJOR_MINOR_VERSION \"${KICAD_MAJOR_MINOR_VERSION}\"
|
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()
|