Commit 93f88b38 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

added the pattern PackageVersionHeader

It's similar to ProjectVersionHeader, but dedicated to packages and
with the possibility of specifying the destination directory of the
generated header.

From: Marco Clemencic <marco.clemencic@cern.ch>


git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/Gaudi/trunk@6757 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent 1cb2162d
......@@ -1199,10 +1199,10 @@ pattern NullCommand \
end_private
#-------------------------------------------------------------------
# Pattern to create a <package>Version.h header file in the InstallArea/include.
# Pattern to create a <project>_VERSION.h header file in the InstallArea/include.
# Usage:
#
# apply_pattern ProjectVersionHeader proj=Gaudi
# apply_pattern ProjectVersionHeader
#
# (Marco Clemencic)
#-------------------------------------------------------------------
......@@ -1216,6 +1216,23 @@ pattern ProjectVersionHeader \
end_private ; \
set <project>VERS "<version>"
#-------------------------------------------------------------------
# Pattern to create a <package>Version.h header file in the InstallArea/include.
# Usage:
#
# apply_pattern PackageVersionHeader where="../path/..."
#
# (Marco Clemencic)
#-------------------------------------------------------------------
pattern PackageVersionHeader \
private ; \
macro PackageVersionHeader_output "<where>/<package>Version.h" ; \
macro PackageVersionHeader_deps "../cmt/requirements" ; \
macro PackageVersionHeader_command "python $(GaudiPolicy_root)/scripts/createProjVersHeader.py <package> <version> $(PackageVersionHeader_output)" \
<project>_without_installarea "" ; \
apply_pattern CallCommand target=PackageVersionHeader ; \
end_private
#-------------------------------------------------------------------
# Generic cmt template processing
# take "fichier.tmpl" as input and outputs "fichier" with all
......
package GaudiPolicy
package manager: Marco Clemencic
! 2011-12-15 - Marco Clemencic
- Added the pattern PackageVersionHeader, similar to ProjectVersionHeader, but
dedicated to packages and with the possibility of specifying the destination
directory of the generated header.
! 2011-12-13 - Ben Couturier
- Patch #5165: Change GaudiPolicy requirements to allow compilation with -O3
(CMT tag "use-O3")
......
......@@ -3,19 +3,20 @@ def main():
if len(sys.argv) != 4:
print "ERROR: Usage %s <project> <version> <outputfile>"%sys.argv[0]
exit(1)
project, version, outputfile = sys.argv[1:]
print "Creating %s for %s %s"%(outputfile, project, version)
print "Creating %s for %s %s"%(outputfile, project, version)
m = re.match("(v|([A-Za-z]+\-))(?P<maj_ver>[0-9]+)(r|\-)(?P<min_ver>[0-9]+)(?:(p|\-)(?P<pat_ver>[0-9]+))?",version)
majver = int(m.groupdict()['maj_ver'])
minver = int(m.groupdict()['min_ver'])
patver = int(m.groupdict()['pat_ver'] or 0)
outdir = os.path.dirname(outputfile)
if not os.path.exists(outdir):
print "Creating directory", outdir
os.makedirs(outdir)
open(outputfile,"w").write(
"""#ifndef %(proj)s_VERSION
/* Automatically generated file: do not modify! */
......@@ -24,9 +25,10 @@ def main():
#endif
#define %(proj)s_MAJOR_VERSION %(maj)d
#define %(proj)s_MINOR_VERSION %(min)d
#define %(proj)s_PATCH_VERSION %(pat)d
#define %(proj)s_VERSION CALC_GAUDI_VERSION(%(proj)s_MAJOR_VERSION,%(proj)s_MINOR_VERSION)
#endif
"""%{ 'proj': project.upper(), 'min': minver, 'maj': majver })
"""%{ 'proj': project.upper(), 'min': minver, 'maj': majver, 'pat': patver })
if __name__ == "__main__":
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment