Commit b6c48e5a authored by Benjamin Storer's avatar Benjamin Storer Committed by David Deepwell

Adds version numbering to the repository

The file VERSION now records the MAJOR_VERSION, MINOR_VERSION,
and PATCH_VERSION.
To update the version number, the user only needs to modify the
appropriate lines in VERSION.

Makefile has been updated to automatically pass the version
information through compiler flags.

BaseCase.cpp has been updated to add a print statement into the
initialization function. By default, every casefile that uses
BaseCase will now print the SPINS version with which is was compiled.
This should help avoid issues with mis-matched versions.

It will appear in the output as:
SPINS Version 1.0.1

The starting version is set to 2.0.0

StackOverflow has a nice summary of when to change which version number
(https://stackoverflow.com/questions/3826580/what-rules-does-software-version-numbering-follow)
 - Major version numbers change whenever there is some significant change
being introduced. For example, a large or potentially
backward-incompatible change to a software package.
 - Minor version numbers change when a new, minor feature is introduced or
when a set of smaller features is rolled out.
 - Patch numbers change when a new build of the software is released to
customers. This is normally for small bug-fixes or the like.
parent 22a6bfac
...@@ -17,6 +17,9 @@ extern "C" { ...@@ -17,6 +17,9 @@ extern "C" {
BaseCase::BaseCase(void) BaseCase::BaseCase(void)
{ {
if (master()) WriteCaseFileSource(); if (master()) WriteCaseFileSource();
// Print version information
if (master()) { fprintf(stdout,"\nSPINS Version %d.%d.%d \n\n", MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION); }
} }
/* Implementation of non-abstract methods in BaseCase */ /* Implementation of non-abstract methods in BaseCase */
...@@ -231,17 +234,17 @@ void BaseCase::automatic_grid(double MinX, double MinY, double MinZ, ...@@ -231,17 +234,17 @@ void BaseCase::automatic_grid(double MinX, double MinY, double MinZ,
// Write grid/reader // Write grid/reader
grid = (*xx)(ii) + 0*jj + 0*kk; grid = (*xx)(ii) + 0*jj + 0*kk;
write_array(grid,"xgrid"); write_grid(grid,"xgrid");
write_reader(grid,"xgrid",false); write_reader(grid,"xgrid",false);
if (size_y() > 1) { if (size_y() > 1) {
grid = 0*ii + (*yy)(jj) + 0*kk; grid = 0*ii + (*yy)(jj) + 0*kk;
write_array(grid,"ygrid"); write_grid(grid,"ygrid");
write_reader(grid,"ygrid",false); write_reader(grid,"ygrid",false);
} }
grid = 0*ii + 0*jj + (*zz)(kk); grid = 0*ii + 0*jj + (*zz)(kk);
write_array(grid,"zgrid"); write_grid(grid,"zgrid");
write_reader(grid,"zgrid",false); write_reader(grid,"zgrid",false);
// Clean up // Clean up
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# system-specific make variables, most notably the # system-specific make variables, most notably the
# C/C++ compiler/linker, # C/C++ compiler/linker,
include system.mk include system.mk
include VERSION
# Compile with debugging flags # Compile with debugging flags
...@@ -23,6 +24,9 @@ ifeq ($(strip $(MPICXX)),) ...@@ -23,6 +24,9 @@ ifeq ($(strip $(MPICXX)),)
MPICXX:=$(CXX) MPICXX:=$(CXX)
endif endif
# Flag to pass version info to code
VERSION:= -DMAJOR_VERSION=${MAJOR_VERSION} -DMINOR_VERSION=${MINOR_VERSION} -DPATCH_VERSION=${PATCH_VERSION}
# Assemble the CFLAGS # Assemble the CFLAGS
CFLAGS:=$(SYSTEM_CFLAGS) $(MPI_CFLAGS) $(SYSTEM_CXXFLAGS) CFLAGS:=$(SYSTEM_CFLAGS) $(MPI_CFLAGS) $(SYSTEM_CXXFLAGS)
LDFLAGS:=$(SYSTEM_LDFLAGS) LDFLAGS:=$(SYSTEM_LDFLAGS)
...@@ -56,7 +60,7 @@ all: tests/test_deriv_x tests/test_write_x tests/test_esolve_x tests/test_heat_x ...@@ -56,7 +60,7 @@ all: tests/test_deriv_x tests/test_write_x tests/test_esolve_x tests/test_heat_x
.PHONY: clean .PHONY: clean
clean: clean:
rm -f *.o tests/*.o cases/*.o cases/*.src.? tests/*.src.? Science/*.o rm -f *.o tests/*.o cases/*.o cases/*.src.? tests/*.src.? Science/*.o cases/*/*.src.? cases/*/*.o
## ##
## Short-names for source files ## Short-names for source files
...@@ -80,19 +84,19 @@ SCIENCE_OBJS := $(addprefix Science/,$(notdir $(SCIENCE_CPPS:.cpp=.o))) ...@@ -80,19 +84,19 @@ SCIENCE_OBJS := $(addprefix Science/,$(notdir $(SCIENCE_CPPS:.cpp=.o)))
NSIntegrator.o: NSIntegrator.cpp NSIntegrator_impl.cc NSIntegrator.o: NSIntegrator.cpp NSIntegrator_impl.cc
tests/test%.o: tests/test%.cpp tests/test%.o: tests/test%.cpp
$(MPICXX) $(CFLAGS) -o $@ -c $< $(MPICXX) ${VERSION} $(CFLAGS) -o $@ -c $<
tests/test%.x: tests/test%.o tests/test%.src.o ${SCIENCE_OBJS} ${SPINS_BASE} tests/test%.x: tests/test%.o tests/test%.src.o ${SCIENCE_OBJS} ${SPINS_BASE}
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(LD) ${VERSION} $(LDFLAGS) -o $@ $^ $(LDLIBS)
cases/%.o: cases/%.cpp NSIntegrator_impl.cc NSIntegrator.hpp cases/%.o: cases/%.cpp NSIntegrator_impl.cc NSIntegrator.hpp
$(MPICXX) $(CFLAGS) -o $@ -c $< $(MPICXX) ${VERSION} $(CFLAGS) -o $@ -c $<
cases/%.x: cases/%.o cases/%.src.o ${SCIENCE_OBJS} ${SPINS_BASE} cases/%.x: cases/%.o cases/%.src.o ${SCIENCE_OBJS} ${SPINS_BASE}
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(LD) ${VERSION} $(LDFLAGS) -o $@ $^ $(LDLIBS)
cases/%_x: cases/%.o cases/%.src.o ${SCIENCE_OBJS} ${SPINS_BASE} cases/%_x: cases/%.o cases/%.src.o ${SCIENCE_OBJS} ${SPINS_BASE}
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(LD) ${VERSION} $(LDFLAGS) -o $@ $^ $(LDLIBS)
tests/test%.src.c: tests/test%.cpp CaseFileSource.c tests/test%.src.c: tests/test%.cpp CaseFileSource.c
echo "const char casefilesource[] = {`xxd -i < $<`, 0x00};" > $@ echo "const char casefilesource[] = {`xxd -i < $<`, 0x00};" > $@
...@@ -105,7 +109,7 @@ cases/%.src.c: cases/%.cpp CaseFileSource.c ...@@ -105,7 +109,7 @@ cases/%.src.c: cases/%.cpp CaseFileSource.c
cat CaseFileSource.c >> $@ cat CaseFileSource.c >> $@
%.o: %.cpp *.hpp %.o: %.cpp *.hpp
$(MPICXX) $(CFLAGS) -o $@ -c $< $(MPICXX) ${VERSION} $(CFLAGS) -o $@ -c $<
print-% : ; @echo $* = $($*) print-% : ; @echo $* = $($*)
......
MAJOR_VERSION=2
MINOR_VERSION=0
PATCH_VERSION=0
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