# Build when git commit is changed

**URL:** https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607
**Category:** Development
**Created:** [May 23, 2023, 2:12pm UTC](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607 "2023-05-23T14:12:46Z")
**Posts on this page:** 6
**Page:** 2

<div class="post-metadata">

### Author: ![aymeric.chataigner](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aymeric.chataigner/32/4977_2.png) [@aymeric.chataigner](https://discourse.slicer.org/u/aymeric.chataigner)
#### Post date: [June 8, 2023, 8:06am UTC](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607/21 "2023-06-08T08:06:06Z")

</div>

Hi all, could I have some feedback on my github pull request ?

---

<div class="post-metadata">

### Author: ![aymeric.chataigner](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aymeric.chataigner/32/4977_2.png) [@aymeric.chataigner](https://discourse.slicer.org/u/aymeric.chataigner)
#### Post date: [August 21, 2023, 2:35pm UTC](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607/22 "2023-08-21T14:35:12Z")

</div>

Hi all,

I would like to do the final step: put the content of the new vtkSlicerVersionConfigure.h into a resource file which is read at runtime in /home/aymeric/dev/slicer/Base/QTCore/qSlicerCoreApplication.cxx.  
Did you already plan to do it ?  
Do you have any idea/advice to implement it correctly ?

Best regards

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [August 21, 2023, 2:51pm UTC](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607/23 "2023-08-21T14:51:57Z")

</div>

Since the current use of the macro is for conditionally including code at compile time, i am not this approach would work here.

That said, i suggest we list the current use of the macros to make the final call.

---

<div class="post-metadata">

### Author: ![aymeric.chataigner](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aymeric.chataigner/32/4977_2.png) [@aymeric.chataigner](https://discourse.slicer.org/u/aymeric.chataigner)
#### Post date: [August 21, 2023, 3:06pm UTC](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607/24 "2023-08-21T15:06:39Z")

</div>

I have not found code which uses the constant of vtkSlicerVersionConfigure.h (not vtkSlicerVersionConfigureMinimal.h) in #if or #ifdef statements.

Am I wrong ?

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [August 21, 2023, 5:21pm UTC](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607/25 "2023-08-21T17:21:06Z")

</div>

Inspecting the source files, we can see the following files directly including `vtkSlicerVersionConfigure.h`:

```auto
$ pwd
/path/to/Slicer

```

```auto
$ ack --cpp vtkSlicerVersionConfigure\.h
Base/Logic/Testing/vtkSlicerVersionConfigureTest1.cxx
21:#include "vtkSlicerVersionConfigure.h"

Base/QTGUI/qSlicerApplication.cxx
41:#include <vtkSlicerVersionConfigure.h> // For Slicer_VERSION_FULL

Base/QTApp/qSlicerApplicationHelper.cxx
43:#include "vtkSlicerVersionConfigure.h" // For Slicer_MAIN_PROJECT_VERSION_FULL

Base/QTCore/Testing/Cxx/qSlicerUtilsTest1.cxx
36:#include "vtkSlicerVersionConfigure.h"

Base/QTCore/qSlicerCoreApplication.cxx
138:#include "vtkSlicerVersionConfigure.h"

Applications/SlicerApp/Main.cxx
25:#include "vtkSlicerVersionConfigure.h" // For Slicer_VERSION_FULL

```

… then reading the comments in the respective `.cxx` files you will be able to assess which macro are used.

---

<div class="post-metadata">

### Author: ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)
#### Post date: [August 21, 2023, 6:01pm UTC](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607/26 "2023-08-21T18:01:12Z")

</div>

After modifying `vtkSlicerVersionConfigure.h`, the following executable and libraries are rebuilt:

```auto
bin/SlicerBaseLogicCxxTests
bin/libqSlicerBaseQTCore.so
bin/qSlicerBaseQTCoreCxxTests
libqSlicerBaseQTGUI.so
libqSlicerBaseQTApp.so
SlicerApp-real

```

Details output:

```auto
$ touch vtkSlicerVersionConfigure.h

$ make 
[0%] Configuring vtkSlicerVersionConfigure.h
-- Configuring Slicer release type [Experimental]
-- Found Git: /usr/bin/git  
-- Configuring Slicer version [5.5.0-2023-08-21]
-- Configuring Slicer revision [32141]
[0%] Built target SlicerConfigureVersionHeader
[...]
[42%] Building CXX object Base/Logic/Testing/CMakeFiles/SlicerBaseLogicCxxTests.dir/vtkSlicerVersionConfigureTest1.cxx.o
[42%] Linking CXX executable ../../../bin/SlicerBaseLogicCxxTests
[...]
[42%] Building CXX object Base/QTCore/CMakeFiles/qSlicerBaseQTCore.dir/qSlicerCoreApplication.cxx.o
[42%] Linking CXX shared library ../../bin/libqSlicerBaseQTCore.so
[...]
[43%] Building CXX object Base/QTCore/Testing/Cxx/CMakeFiles/qSlicerBaseQTCoreCxxTests.dir/qSlicerUtilsTest1.cxx.o
[43%] Linking CXX executable ../../../../bin/qSlicerBaseQTCoreCxxTests
[...]
[43%] Building CXX object Base/QTGUI/CMakeFiles/qSlicerBaseQTGUI.dir/qSlicerApplication.cxx.o
[44%] Linking CXX shared library ../../bin/libqSlicerBaseQTGUI.so
[...]
[50%] Building CXX object Base/QTApp/CMakeFiles/qSlicerBaseQTApp.dir/qSlicerApplicationHelper.cxx.o
[50%] Linking CXX shared library ../../bin/libqSlicerBaseQTApp.so
[...]
[95%] Built target qSlicerApp
Consolidate compiler generated dependencies of target SlicerApp
[95%] Building CXX object Applications/SlicerApp/CMakeFiles/SlicerApp.dir/Main.cxx.o
[95%] Linking CXX executable ../../bin/SlicerApp-real
[...]
[100%] Built target SlicerDesignerConfigureLauncher

```

[Previous page](https://discourse.slicer.org/t/build-when-git-commit-is-changed/29607.md?page=1)
