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

Commit e31375f

Browse files
committedJul 9, 2018
Rename publication date to version info
This is now generated by git. TODO: Merge with the git logic used for the tarballs Test when building from tarballs Fixes #529
1 parent 331b879 commit e31375f

File tree

11 files changed

+122
-28
lines changed

11 files changed

+122
-28
lines changed
 

‎CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ add_subdirectory( src )
7474
# Start with the package version being unknown, then prove otherwise
7575
set( CPACK_PACKAGE_VERSION "unknown" )
7676

77+
set( VERSION_INFO_FILE "${PROJECT_BINARY_DIR}/src/version_info.txt")
78+
set_property( DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${VERSION_INFO_FILE}")
79+
add_custom_target(
80+
version_info ALL
81+
COMMAND ${CMAKE_COMMAND}
82+
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
83+
-DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}
84+
-DOUTPUT_FILE=${VERSION_INFO_FILE}
85+
-P ${CMAKE_MODULE_PATH}/CreateGitVersionInfo.cmake
86+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
87+
COMMENT "Generating version info"
88+
)
89+
7790
# Use Git to determine parts of the package name
7891
find_package( Git )
7992

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#
2+
# (c)2018 KiCad Developers
3+
# (c)2018 Nick Østergaard
4+
#
5+
# CMake module to find produce version information
6+
#
7+
# Variables generated:
8+
#
9+
# KICAD_VERSION A git describe string
10+
# KICAD_VERSION_DATE The date of the last commit
11+
#
12+
13+
macro( create_git_version_info _git_src_path )
14+
# Include Git support to automagically create version header file.
15+
find_package( Git )
16+
message( STATUS "Source path is ${_git_src_path}" )
17+
18+
if( GIT_FOUND )
19+
set( _Git_SAVED_LC_ALL "$ENV{LC_ALL}" )
20+
set( ENV{LC_ALL} C )
21+
22+
execute_process(
23+
COMMAND
24+
${GIT_EXECUTABLE} describe --dirty --tags
25+
WORKING_DIRECTORY "${_git_src_path}"
26+
OUTPUT_VARIABLE _git_DESCRIBE
27+
ERROR_VARIABLE _git_log_error
28+
RESULT_VARIABLE _git_log_result
29+
OUTPUT_STRIP_TRAILING_WHITESPACE)
30+
31+
execute_process(
32+
COMMAND
33+
${GIT_EXECUTABLE} show -s --format=%ci
34+
WORKING_DIRECTORY "${_git_src_path}"
35+
OUTPUT_VARIABLE _git_DATE_CI
36+
ERROR_VARIABLE _git_log_error
37+
RESULT_VARIABLE _git_log_result
38+
OUTPUT_STRIP_TRAILING_WHITESPACE)
39+
message( STATUS "${_git_DATE_CI} 0 10 _git_DATE " )
40+
41+
string( SUBSTRING ${_git_DATE_CI} 0 10 _git_DATE )
42+
43+
set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
44+
endif()
45+
46+
if( _git_DESCRIBE )
47+
set( KICAD_VERSION "${_git_DESCRIBE}" )
48+
set( KICAD_VERSION_DATE "${_git_DATE}" )
49+
endif()
50+
51+
set( _wvi_new_version_text
52+
"// Do not modify this file, it was automatically generated by CMake.
53+
Published on ${KICAD_VERSION_DATE}
54+
55+
`${KICAD_VERSION}`
56+
" )
57+
58+
set( _wvi_write_version_file ON )
59+
60+
# Only write the header if it has changed, to avoid rebuilds
61+
if( EXISTS ${OUTPUT_FILE} )
62+
file( READ ${OUTPUT_FILE} _wvi_old_version_text )
63+
if( _wvi_old_version_text STREQUAL _wvi_new_version_text )
64+
message( STATUS "Not updating ${OUTPUT_FILE}" )
65+
set( _wvi_write_version_file OFF )
66+
endif()
67+
endif()
68+
69+
if( _wvi_write_version_file )
70+
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${KICAD_VERSION}" )
71+
file( WRITE ${OUTPUT_FILE} ${_wvi_new_version_text} )
72+
endif()
73+
74+
# There should always be a valid version file. Otherwise, we might miss it.
75+
if( NOT EXISTS ${OUTPUT_FILE} )
76+
message( FATAL_ERROR "Configuration failed to write file ${OUTPUT_FILE}." )
77+
endif()
78+
endmacro()
79+
80+
create_git_version_info( "${PROJECT_SOURCE_DIR}" )
81+

‎src/cvpcb/cvpcb.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37+
[[version_info]]
38+
*Version info*
3739

38-
[[publication_date_and_software_version]]
39-
*Publication date and software version*
40+
include::../../version_info.txt[]
4041

41-
Published on may 22, 2015.
4242

4343
//Since docbook "article" is more compact, I have to separate this page
4444
<<<<

‎src/eeschema/eeschema.adoc

+3-4
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37+
[[version_info]]
38+
*Version info*
3739

38-
[[publication_date_and_software_version]]
39-
*Publication date and software version*
40-
41-
Published on May 30, 2015.
40+
include::../../version_info.txt[]
4241

4342

4443
include::eeschema_introduction.adoc[po4a]

‎src/gerbview/gerbview.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37+
[[version_info]]
38+
*Version info*
3739

38-
[[publication_date_and_software_version]]
39-
*Publication date and software version*
40+
include::../../version_info.txt[]
4041

41-
Published on February 24, 2018.
4242

4343
//Since docbook "article" is more compact, I have to separate this page
4444
<<<<

‎src/gui_translation_howto/gui_translation_howto.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37+
[[version_info]]
38+
*Version info*
3739

38-
[[publication_date_and_software_version]]
39-
*Publication date and software version*
40+
include::../../version_info.txt[]
4041

41-
Published on October 15, 2015.
4242

4343
//Since docbook "article" is more compact, I have to separate this page
4444
<<<<

‎src/idf_exporter/idf_exporter.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37+
[[version_info]]
38+
*Version info*
3739

38-
[[publication_date_and_software_version]]
39-
*Publication date and software version*
40+
include::../../version_info.txt[]
4041

41-
Published on January 26, 2014.
4242

4343
//Since docbook "article" is more compact, I have to separate this page
4444
<<<<

‎src/kicad/kicad.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37-
[[publication_date_and_software_version]]
38-
*Publication date and software version*
37+
[[version_info]]
38+
*Version info*
3939

40-
2015, May 21.
40+
include::../../version_info.txt[]
4141

4242
== Introduction
4343

‎src/pcbnew/pcbnew.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37-
[[publication_date_and_software_version]]
38-
*Publication date and software version*
37+
[[version_info]]
38+
*Version info*
3939

40-
2014, march 17.
40+
include::../../version_info.txt[]
4141

4242

4343
include::pcbnew_introduction.adoc[po4a]

‎src/pl_editor/pl_editor.adoc

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ Please direct any bug reports, suggestions or new versions to here:
3333

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

36-
[[publication_date_and_software_version]]
37-
*Publication date and software version*
36+
[[version_info]]
37+
*Version info*
38+
39+
include::../../version_info.txt[]
3840

39-
may 23, 2015.
4041

4142
//Since docbook "article" is more compact, I have to separate this page
4243
<<<<<

‎src/plugins/plugins.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Please direct any bug reports, suggestions or new versions to here:
3434

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

37+
[[version_info]]
38+
*Version info*
3739

38-
[[publication_date_and_software_version]]
39-
*Publication date and software version*
40+
include::../../version_info.txt[]
4041

41-
Published on January 29, 2016.
4242

4343
<<<<
4444

0 commit comments

Comments
 (0)
This repository has been archived.