kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #21408
Re: "generate version string header"
Le 21/11/2015 23:08, Wayne Stambaugh a écrit :
> On 11/21/2015 2:54 PM, jp charras wrote:
>> Le 20/11/2015 21:56, Wayne Stambaugh a écrit :
>>> On 11/20/2015 3:08 PM, Mário Luzeiro wrote:
>>>> Hello all,
>>>>
>>>> I am building kicad on windows msys/mingw32
>>>> Everytime I update (pull) my development bzr branch it will "generate version string header" and rebuild all kicad. :S
>>>
>>> It should only rebuild when there is a commit change to your branch.
>>> Even when it does change, it should only update the version string,
>>> recompile the common library, and relink all of the binaries to the
>>> updated common library.
>>
>> This is true on Linux, but unfortunately, not on Windows:
>> Each time the bzr version has changed a full compilation of all files in
>> Kicad sources is made.
>
> This sounds like an issue with make on windows. I don't know how else
> this could happen unless cmake build scripts is changing the time stamp
> on one of header files used by most of kicad such as config.h.
>
This is more strange:
I had a look at .cpp files dependencies like depend.internal.
version.h and config.h appear in dependency list of each .cpp file in
Kicad (all but bitmaps).
Therefore, each time version.h is rebuilt, all files are recompiled.
In attached patch, I just renamed version.h to kicad_build_version.h
And the problem is gone.
Can you have a look at my patch.
Thanks.
--
Jean-Pierre CHARRAS
=== modifié fichier CMakeModules/WriteVersionHeader.cmake
--- CMakeModules/WriteVersionHeader.cmake 2015-07-13 00:06:50 +0000
+++ CMakeModules/WriteVersionHeader.cmake 2015-11-23 16:50:03 +0000
@@ -49,7 +49,7 @@
# Compare the version argument against the version in the existing header file for a mismatch.
if( EXISTS ${OUTPUT_FILE} )
- file( STRINGS ${CMAKE_BINARY_DIR}/version.h _current_version_str
+ file( STRINGS ${OUTPUT_FILE} _current_version_str
REGEX "^#define[\t ]+KICAD_BUILD_VERSION[\t ]+.*" )
string( REGEX REPLACE "^#define KICAD_BUILD_VERSION \"([()a-zA-Z0-9 -.]+)\".*"
"\\1" _wvh_last_version "${_current_version_str}" )
@@ -82,6 +82,6 @@
endif()
# There should always be a valid version.h file. Otherwise, the build will fail.
-if( NOT EXISTS ${CMAKE_BINARY_DIR}/version.h )
+if( NOT EXISTS ${OUTPUT_FILE} )
message( FATAL_ERROR "Configuration failed to write file ${OUTPUT_FILE}." )
endif()
=== modifié fichier common/CMakeLists.txt
--- common/CMakeLists.txt 2015-09-13 19:11:45 +0000
+++ common/CMakeLists.txt 2015-11-23 18:54:57 +0000
@@ -124,7 +124,7 @@
version_header ALL
COMMAND ${CMAKE_COMMAND}
-DKICAD_BUILD_VERSION=${KICAD_BUILD_VERSION}
- -DOUTPUT_FILE=${CMAKE_BINARY_DIR}/version.h
+ -DOUTPUT_FILE=${CMAKE_BINARY_DIR}/kicad_build_version.h
-DSRC_PATH=${PROJECT_SOURCE_DIR}
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-P ${CMAKE_MODULE_PATH}/WriteVersionHeader.cmake
=== modifié fichier common/build_version.cpp
--- common/build_version.cpp 2015-07-05 19:24:34 +0000
+++ common/build_version.cpp 2015-11-23 18:54:40 +0000
@@ -27,7 +27,7 @@
// The include file version.h is always created even if the repo version cannot be
// determined. In this case KICAD_BUILD_VERSION will default to "no-bzr".
-#include <version.h>
+#include <kicad_build_version.h>
/**
Follow ups
References