Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Rename publication date to version info
Browse files Browse the repository at this point in the history
This is now generated by git.

TODO:
    Merge with the git logic used for the tarballs
    Test when building from tarballs

Fixes #529
  • Loading branch information
nickoe committed Jul 9, 2018
1 parent 331b879 commit e31375f
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 28 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ add_subdirectory( src )
# Start with the package version being unknown, then prove otherwise
set( CPACK_PACKAGE_VERSION "unknown" )

set( VERSION_INFO_FILE "${PROJECT_BINARY_DIR}/src/version_info.txt")
set_property( DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${VERSION_INFO_FILE}")
add_custom_target(
version_info ALL
COMMAND ${CMAKE_COMMAND}
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
-DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}
-DOUTPUT_FILE=${VERSION_INFO_FILE}
-P ${CMAKE_MODULE_PATH}/CreateGitVersionInfo.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating version info"
)

# Use Git to determine parts of the package name
find_package( Git )

Expand Down
81 changes: 81 additions & 0 deletions CMakeModules/CreateGitVersionInfo.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# (c)2018 KiCad Developers
# (c)2018 Nick Østergaard
#
# CMake module to find produce version information
#
# Variables generated:
#
# KICAD_VERSION A git describe string
# KICAD_VERSION_DATE The date of the last commit
#

macro( create_git_version_info _git_src_path )
# Include Git support to automagically create version header file.
find_package( Git )
message( STATUS "Source path is ${_git_src_path}" )

if( GIT_FOUND )
set( _Git_SAVED_LC_ALL "$ENV{LC_ALL}" )
set( ENV{LC_ALL} C )

execute_process(
COMMAND
${GIT_EXECUTABLE} describe --dirty --tags
WORKING_DIRECTORY "${_git_src_path}"
OUTPUT_VARIABLE _git_DESCRIBE
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(
COMMAND
${GIT_EXECUTABLE} show -s --format=%ci
WORKING_DIRECTORY "${_git_src_path}"
OUTPUT_VARIABLE _git_DATE_CI
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
message( STATUS "${_git_DATE_CI} 0 10 _git_DATE " )

string( SUBSTRING ${_git_DATE_CI} 0 10 _git_DATE )

set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
endif()

if( _git_DESCRIBE )
set( KICAD_VERSION "${_git_DESCRIBE}" )
set( KICAD_VERSION_DATE "${_git_DATE}" )
endif()

set( _wvi_new_version_text
"// Do not modify this file, it was automatically generated by CMake.
Published on ${KICAD_VERSION_DATE}
`${KICAD_VERSION}`
" )

set( _wvi_write_version_file ON )

# Only write the header if it has changed, to avoid rebuilds
if( EXISTS ${OUTPUT_FILE} )
file( READ ${OUTPUT_FILE} _wvi_old_version_text )
if( _wvi_old_version_text STREQUAL _wvi_new_version_text )
message( STATUS "Not updating ${OUTPUT_FILE}" )
set( _wvi_write_version_file OFF )
endif()
endif()

if( _wvi_write_version_file )
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${KICAD_VERSION}" )
file( WRITE ${OUTPUT_FILE} ${_wvi_new_version_text} )
endif()

# There should always be a valid version file. Otherwise, we might miss it.
if( NOT EXISTS ${OUTPUT_FILE} )
message( FATAL_ERROR "Configuration failed to write file ${OUTPUT_FILE}." )
endif()
endmacro()

create_git_version_info( "${PROJECT_SOURCE_DIR}" )

6 changes: 3 additions & 3 deletions src/cvpcb/cvpcb.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad software i18n: https://github.com/KiCad/kicad-i18n/issues

[[version_info]]
*Version info*

[[publication_date_and_software_version]]
*Publication date and software version*
include::../../version_info.txt[]

Published on may 22, 2015.

//Since docbook "article" is more compact, I have to separate this page
<<<<
Expand Down
7 changes: 3 additions & 4 deletions src/eeschema/eeschema.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad translation: https://github.com/KiCad/kicad-i18n/issues

[[version_info]]
*Version info*

[[publication_date_and_software_version]]
*Publication date and software version*

Published on May 30, 2015.
include::../../version_info.txt[]


include::eeschema_introduction.adoc[po4a]
Expand Down
6 changes: 3 additions & 3 deletions src/gerbview/gerbview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad software i18n: https://github.com/KiCad/kicad-i18n/issues

[[version_info]]
*Version info*

[[publication_date_and_software_version]]
*Publication date and software version*
include::../../version_info.txt[]

Published on February 24, 2018.

//Since docbook "article" is more compact, I have to separate this page
<<<<
Expand Down
6 changes: 3 additions & 3 deletions src/gui_translation_howto/gui_translation_howto.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad software i18n: https://github.com/KiCad/kicad-i18n/issues

[[version_info]]
*Version info*

[[publication_date_and_software_version]]
*Publication date and software version*
include::../../version_info.txt[]

Published on October 15, 2015.

//Since docbook "article" is more compact, I have to separate this page
<<<<
Expand Down
6 changes: 3 additions & 3 deletions src/idf_exporter/idf_exporter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad software i18n: https://github.com/KiCad/kicad-i18n/issues

[[version_info]]
*Version info*

[[publication_date_and_software_version]]
*Publication date and software version*
include::../../version_info.txt[]

Published on January 26, 2014.

//Since docbook "article" is more compact, I have to separate this page
<<<<
Expand Down
6 changes: 3 additions & 3 deletions src/kicad/kicad.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad translation: https://github.com/KiCad/kicad-i18n/issues

[[publication_date_and_software_version]]
*Publication date and software version*
[[version_info]]
*Version info*

2015, May 21.
include::../../version_info.txt[]

== Introduction

Expand Down
6 changes: 3 additions & 3 deletions src/pcbnew/pcbnew.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad software i18n: https://github.com/KiCad/kicad-i18n/issues

[[publication_date_and_software_version]]
*Publication date and software version*
[[version_info]]
*Version info*

2014, march 17.
include::../../version_info.txt[]


include::pcbnew_introduction.adoc[po4a]
Expand Down
7 changes: 4 additions & 3 deletions src/pl_editor/pl_editor.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad software i18n: https://github.com/KiCad/kicad-i18n/issues

[[publication_date_and_software_version]]
*Publication date and software version*
[[version_info]]
*Version info*

include::../../version_info.txt[]

may 23, 2015.

//Since docbook "article" is more compact, I have to separate this page
<<<<<
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/plugins.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:

- About KiCad software i18n: https://github.com/KiCad/kicad-i18n/issues

[[version_info]]
*Version info*

[[publication_date_and_software_version]]
*Publication date and software version*
include::../../version_info.txt[]

Published on January 29, 2016.

<<<<

Expand Down

0 comments on commit e31375f

Please sign in to comment.