Skip to content

Commit

Permalink
Change to git info processing [WIP]
Browse files Browse the repository at this point in the history
- gGitInfo is now provided by a .cc file and defined as external in
  the two source files that use it (no more compile time dependency)
- gitinfo.cc is created from gitinfo.cc.in by the CMakeGitInfo module.
- The CMakeGitInfo modules checks whether the git state has changed
  before it creates gitinfo.cc again.
  • Loading branch information
wdconinc committed Jan 28, 2019
1 parent 2521643 commit e0d50f4
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 75 deletions.
5 changes: 3 additions & 2 deletions Analysis/src/QwOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# endif
#endif


#include "QwOptions.h"

// System headers
Expand All @@ -28,7 +27,6 @@ QwOptions gQwOptions;
// Qweak headers
#include "QwLog.h"
#include "QwParameterFile.h"
#include "gitinfo.hh"

// Qweak objects with default options
#include "QwSubsystemArray.h"
Expand All @@ -40,6 +38,9 @@ QwOptions gQwOptions;
#include "QwRootFile.h"
#include "QwHistogramHelper.h"

// External objects
extern const char* const gGitInfo;

// Initialize the static command line arguments to zero
int QwOptions::fArgc = 0;
char** QwOptions::fArgv = 0;
Expand Down
4 changes: 3 additions & 1 deletion Analysis/src/QwRunCondition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/

#include "QwRunCondition.h"
#include "gitinfo.hh"

// External objects
extern const char* const gGitInfo;

const Int_t QwRunCondition::fCharLength = 127;

Expand Down
37 changes: 13 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ endif()
# Sources and headers
#
file(GLOB my_project_sources
Analysis/src/*.cc
Parity/src/*.cc
)
Analysis/src/*.cc
Parity/src/*.cc
)
list(REMOVE_ITEM my_project_sources
${PROJECT_SOURCE_DIR}/Analysis/src/QwF1TDContainer.cc
${PROJECT_SOURCE_DIR}/Analysis/src/QwSIS3320_Samples.cc
)

file(GLOB my_project_headers
Analysis/include/*.h
Parity/include/*.h
)
Analysis/include/*.h
Parity/include/*.h
)
list(REMOVE_ITEM my_project_headers
${PROJECT_SOURCE_DIR}/Analysis/include/QwF1TDContainer.h
${PROJECT_SOURCE_DIR}/Analysis/include/QwF1TDContainer.h
${PROJECT_SOURCE_DIR}/Analysis/include/QwSIS3320_Samples.h
)

Expand Down Expand Up @@ -90,22 +90,12 @@ config_add_dependency(ROOT ${minimum_root_version})


#----------------------------------------------------------------------------
# gitinfo.hh
# gitinfo.cc
#
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh.does_not_exist
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/pullgitinfo.py ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Getting Git information"
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh
COMMAND echo -n
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh.does_not_exist
)
set_property(
SOURCE Analysis/src/QwOptions.cc Analysis/src/QwRunCondition.cc
APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh
)
set(PRE_CONFIGURE_FILE ${PROJECT_SOURCE_DIR}/cmake/templates/gitinfo.cc.in)
set(POST_CONFIGURE_FILE ${CMAKE_CURRENT_BINARY_DIR}/gitinfo.cc)
include(CMakeGitInfo)
set(my_project_sources ${my_project_sources} ${POST_CONFIGURE_FILE})


#----------------------------------------------------------------------------
Expand Down Expand Up @@ -157,8 +147,7 @@ endforeach()
#----------------------------------------------------------------------------
# main library
#
add_library(${PROJECT_NAME} SHARED ${my_project_sources} ${my_project_headers}
${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh)
add_library(${PROJECT_NAME} SHARED ${my_project_sources} ${my_project_headers})

target_include_directories(${PROJECT_NAME}
PUBLIC
Expand Down
48 changes: 0 additions & 48 deletions bin/pullgitinfo.py

This file was deleted.

Loading

0 comments on commit e0d50f4

Please sign in to comment.