Commit 240f4eff authored by Roy Fabrice's avatar Roy Fabrice
Browse files

Replace SVN version with GIT version

metadata in output file is now 'version'
this version number now comes from git
parent 3f2a8862
......@@ -65,7 +65,7 @@ module modconstant
NAME_PFOF_SNAP, &
NAME_PSOD_SNAP, &
PR, &
SVN_VERSION, &
GIT_VERSION, &
type_common_metadata, &
type_info_cone, &
type_info_cone_grav, &
......@@ -80,7 +80,7 @@ module modconstant
type_parameter_pfof_snap, &
type_parameter_psod_snap
#include "svnrev.h"
#include "gitversion.h"
! error handling
integer, parameter :: ERR_CODE_COMPUTATION = 30
......@@ -118,8 +118,8 @@ module modconstant
integer, parameter :: PR=4 !< Precision for real arrays read from Ramses simulations (position/velocities)
#endif
! SVN Revision
character(len=32), parameter :: SVN_VERSION = SVNREV
! GIT Revision
character(len=64), parameter :: GIT_VERSION = GITVERSION
! types for particles array : experimental
type :: particles_t
......@@ -284,7 +284,7 @@ module modconstant
type :: type_common_metadata !< type for metadata common to every kind of hdf5 output file
character(len=16) :: created_by
integer(kind=4) :: svn_version
integer(kind=4) :: version
character(len=16) :: simulation_code
character(len=16) :: particle_type
integer(kind=4) :: constant_mass
......
......@@ -20,7 +20,7 @@ module modreadmeta
NAME_PSOD_SNAP,&
NAME_CONECREATOR_PART,&
NAME_CONECREATOR_GRAV,&
SVN_VERSION
GIT_VERSION
use modhdf5, only : hid_t,&
H5_STR_LEN,&
......@@ -65,8 +65,8 @@ contains
length = len(common%created_by)
name = 'created_by'
call Hdf5_read_attr(meta_id, name, length, common%created_by)
name = 'svn_version'
call Hdf5_read_attr(meta_id, name, common%svn_version)
name = 'version'
call Hdf5_read_attr(meta_id, name, common%version)
length = len(common%simulation_code)
name = 'simulation_code'
call Hdf5_read_attr(meta_id, name, length, common%simulation_code)
......
......@@ -20,7 +20,7 @@ module modwritemeta
NAME_PSOD_SNAP,&
NAME_CONECREATOR_PART,&
NAME_CONECREATOR_GRAV,&
SVN_VERSION
GIT_VERSION
use modhdf5, only : hid_t,&
H5_STR_LEN,&
......@@ -74,8 +74,8 @@ contains
! Common metadata
aname = 'created_by'
call Hdf5_write_attr(gr_id, aname, codename)
aname = 'svn_version'
call Hdf5_write_attr(gr_id, aname, svn_version)
aname = 'version'
call Hdf5_write_attr(gr_id, aname, GIT_VERSION)
aname = 'simulation_code'
adata = 'ramses'
call Hdf5_write_attr(gr_id, aname,adata)
......
#define SVNREV "no_version_found"
......@@ -33,6 +33,15 @@ SRC = modhdf5.f90 \
OBJS = $(SRC:%.f90=%.o)
# variable containing if git is used or not
ifeq ($(wildcard ../../.git/HEAD ../../.git/index),)
OBJ_GIT =
USE_GIT =
else
USE_GIT = $(shell which git)
OBJ_GIT = ../../.git/HEAD ../../.git/index
endif
%.o:%.f90
@echo "--------------------------------"
......@@ -49,7 +58,7 @@ OBJS = $(SRC:%.f90=%.o)
release: $(EXE)
all: release
$(EXE) : $(MODS) $(OBJS)
$(EXE) : gitversion $(MODS) $(OBJS)
@echo "--------------------------------"
@echo building $(EXE) with parameters \
FC=$(MPIFC), LDFLAGS=$(LDFLAGS)
......@@ -58,10 +67,16 @@ $(EXE) : $(MODS) $(OBJS)
clean :
@echo "--------------------------------"
@echo cleaning compiled objects, modules and executable
rm -f *.o *.mod *~ $(EXE)
svnrev:
cd $(COMMONDIR) ; echo "#define SVNREV \"no_version_found\"" > svnrev.h ; cd - ;\
rm -f *.o *.mod *~ $(EXE) $(COMMONDIR)/gitversion.h
# create file for git version
gitversion: $(OBJ_GIT)
ifneq ($(USE_GIT), )
@cd $(COMMONDIR) ;\
echo "#define GITVERSION \"$(shell git rev-parse HEAD)\"" > gitversion.h
else
@cd $(COMMONDIR) ;\
echo "#define GITVERSION \"no_version_found\"" > gitversion.h
endif
.PHONY: svnrev clean all
.PHONY: gitversion clean all
Supports Markdown
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