Commit 224739ee authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'faster_compilation' into 'master'

Faster compilation

In the current master, every time we edit a file, we re-generate version.h which then triggers recompilation of a lot of file that include it. 

Here we re-generate a version_string.h instead that is only included in version.c. That speeds up the compilation when only a few files are modified.

See merge request !155
parents 51770a83 0463f647
......@@ -11,7 +11,7 @@ config.sub
ltmain.sh
libtool
src/version.h
src/version_string.h
swift*.tar.gz
doc/doxyfile.stamp
doc/html/
......
......@@ -62,18 +62,19 @@ swift_fixdt_mpi_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) $(MPI_FLAGS) -DENGINE_POLICY="e
swift_fixdt_mpi_LDADD = ../src/.libs/libswiftsim_mpi.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(MPI_LIBS)
# Scripts to generate ICs
EXTRA_DIST = UniformBox/makeIC.py \
EXTRA_DIST = UniformBox/makeIC.py UniformBox/run.sh UniformBox/uniformBox.yml \
UniformDMBox/makeIC.py \
PerturbedBox/makeIC.py \
SedovBlast/makeIC.py SedovBlast/makeIC_fcc.py SedovBlast/solution.py \
SodShock/makeIC.py SodShock/solution.py SodShock/glass_001.hdf5 SodShock/glass_002.hdf5 SodShock/rhox.py \
CosmoVolume/getIC.sh \
SedovBlast/makeIC.py SedovBlast/makeIC_fcc.py SedovBlast/solution.py SedovBlast/run.sh SedovBlast/sedov.yml \
SodShock/makeIC.py SodShock/solution.py SodShock/glass_001.hdf5 SodShock/glass_002.hdf5 SodShock/rhox.py SodShock/run.sh SodShock/sodShock.yml \
CosmoVolume/getIC.sh CosmoVolume/run.sh CosmoVolume/cosmoVolume.yml \
BigCosmoVolume/makeIC.py \
BigPerturbedBox/makeIC_fcc.py \
GreshoVortex/makeIC.py GreshoVortex/solution.py \
MultiTypes/makeIC.py
MultiTypes/makeIC.py \
parameter_example.yml
# Scripts to plot task graphs
EXTRA_DIST += plot_tasks_MPI.py plot_tasks.py \
process_plot_tasks_MPI process_plot_tasks
......@@ -36,7 +36,7 @@ endif
include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
engine.h swift.h serial_io.h timers.h debug.h scheduler.h proxy.h parallel_io.h \
common_io.h single_io.h multipole.h map.h tools.h partition.h clocks.h parser.h \
physical_constants.h physical_constants_cgs.h potentials.h
physical_constants.h physical_constants_cgs.h potentials.h version.h
# Common source files
AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
......@@ -72,27 +72,27 @@ libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) -DWITH_MPI $(METIS_INCS)
libswiftsim_mpi_la_SHORTNAME = mpi
# Versioning. If any sources change then update the version.h file with
# Versioning. If any sources change then update the version_string.h file with
# the current git revision and package version.
# May have a checkout without a version.h file and no git command (tar/zip
# May have a checkout without a version_string.h file and no git command (tar/zip
# download), allow that, but make sure we know it.
version.h: version.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
version_string.h: version_string.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
if test "X$(GIT_CMD)" != "X"; then \
GIT_REVISION=`$(GIT_CMD) describe --abbrev=8 --always --tags --dirty`; \
GIT_BRANCH=`$(GIT_CMD) branch | sed -n 's/^\* \(.*\)/\1/p'`; \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," \
-e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" version.h.in > version.h; \
-e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" version_string.h.in > version_string.h; \
else \
if test ! -f version.h; then \
if test ! -f version_string.h; then \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,unknown," \
-e "s,@GIT_BRANCH\@,unknown," version.h.in > version.h; \
-e "s,@GIT_BRANCH\@,unknown," version_string.h.in > version_string.h; \
fi; \
fi
# Make sure version.h is built first.
BUILT_SOURCES = version.h
# Make sure version_string.h is built first.
BUILT_SOURCES = version_string.h
# And distribute the built files.
EXTRA_DIST = version.h version.h.in
EXTRA_DIST = version_string.h version_string.h.in
......@@ -40,6 +40,9 @@
/* This object's header. */
#include "version.h"
/* Local headers. */
#include "version_string.h"
/**
* @brief Return the source code git revision
*
......
......@@ -2,33 +2,24 @@
* This file is part of SWIFT.
* Copyright (c) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
* Copyright (c) 2015 Peter W. Draper (p.w.draper@durham.ac.uk).
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
******************************************************************************/
#ifndef SWIFT_VERSION_H
#define SWIFT_VERSION_H
/**
* @file version.h
* @brief Package version, git revision sha and compiler info.
*/
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
#define GIT_REVISION "@GIT_REVISION@"
#define GIT_BRANCH "@GIT_BRANCH@"
const char* package_description(void);
const char* package_version(void);
const char* git_revision(void);
......@@ -36,8 +27,8 @@ const char* git_branch(void);
const char* compiler_name(void);
const char* compiler_version(void);
const char* mpi_version(void);
const char *hdf5_version(void);
const char *metis_version(void);
const char* hdf5_version(void);
const char* metis_version(void);
void greetings(void);
#endif /* SWIFT_VERSION_H */
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
* Copyright (c) 2015 Peter W. Draper (p.w.draper@durham.ac.uk).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_VERSION_STRING_H
#define SWIFT_VERSION_STRING_H
/**
* @file version_string.h
* @brief Package version, git revision sha and compiler info.
*/
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
#define GIT_REVISION "@GIT_REVISION@"
#define GIT_BRANCH "@GIT_BRANCH@"
#endif /* SWIFT_VERSION_STRING_H */
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