Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
5819f56f
Commit
5819f56f
authored
Nov 26, 2016
by
Matthieu Schaller
Browse files
Added the configuration command line and CFLGAS/CXXFLAGS to the snapshots and greeting message.
parent
2474a3c2
Changes
6
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
5819f56f
...
...
@@ -16,7 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Init the project.
AC_INIT([SWIFT],[0.4.0])
AC_INIT([SWIFT],[0.4.0],[https://gitlab.cosma.dur.ac.uk/swift/swiftsim],,[www.swiftsim.com])
swift_config_flags="$*"
AC_COPYRIGHT
AC_CONFIG_SRCDIR([src/space.c])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE
...
...
@@ -531,6 +533,9 @@ AC_CONFIG_FILES([tests/test27cellsPerturbed.sh], [chmod +x tests/test27cellsPert
AC_CONFIG_FILES([tests/test125cells.sh], [chmod +x tests/test125cells.sh])
AC_CONFIG_FILES([tests/testParser.sh], [chmod +x tests/testParser.sh])
# Save the compilation options
AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to configure])
# Report general configuration.
AC_MSG_RESULT([
Compiler : $CC
...
...
src/Makefile.am
View file @
5819f56f
...
...
@@ -108,12 +108,16 @@ version_string.h: version_string.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_
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_string.h
;
\
-e
"s|@GIT_BRANCH
\@
|
$
${GIT_BRANCH}
|"
\
-e
"s|@SWIFT_CFLAGS
\@
|
$(CFLAGS)
|"
\
-e
"s|@SWIFT_CXXFLAGS
\@
|
$(CXXFLAGS)
|"
$<
>
version_string.h
;
\
else
\
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_string.h
;
\
-e
"s,@GIT_BRANCH
\@
,unknown,"
\
-e
"s|@SWIFT_CFLAGS
\@
|
$(CFLAGS)
|"
\
-e
"s|@SWIFT_CXXFLAGS
\@
|
$(CXXFLAGS)
|"
$<
>
version_string.h
;
\
fi
;
\
fi
...
...
src/common_io.c
View file @
5819f56f
...
...
@@ -374,6 +374,9 @@ void writeCodeDescription(hid_t h_file) {
writeAttribute_s
(
h_grpcode
,
"Compiler Version"
,
compiler_version
());
writeAttribute_s
(
h_grpcode
,
"Git Branch"
,
git_branch
());
writeAttribute_s
(
h_grpcode
,
"Git Revision"
,
git_revision
());
writeAttribute_s
(
h_grpcode
,
"Configuration options"
,
configuration_options
());
writeAttribute_s
(
h_grpcode
,
"CFLAGS"
,
compilation_cflags
());
writeAttribute_s
(
h_grpcode
,
"CXXFLAGS"
,
compilation_cxxflags
());
writeAttribute_s
(
h_grpcode
,
"HDF5 library version"
,
hdf5_version
());
#ifdef HAVE_FFTW
writeAttribute_s
(
h_grpcode
,
"FFTW library version"
,
fftw3_version
());
...
...
src/version.c
View file @
5819f56f
...
...
@@ -39,10 +39,12 @@
/* Some standard headers. */
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<unistd.h>
/* This object's header. */
#include
"error.h"
#include
"version.h"
/* Local headers. */
...
...
@@ -109,6 +111,63 @@ const char *git_branch(void) {
return
buf
;
}
/**
* @brief Return the options passed to the 'configure' script
*
* @result List of configuration options within simple quotes (').
*/
const
char
*
configuration_options
(
void
)
{
static
char
buf
[
1024
];
static
int
initialised
=
0
;
static
const
char
*
config
=
SWIFT_CONFIG_FLAGS
;
if
(
!
initialised
)
{
if
(
strlen
(
config
)
<
1024
-
2
)
sprintf
(
buf
,
"'%s'"
,
config
);
else
error
(
"SWIFT_CONFIG_FLAGS string longer than buffer"
);
initialised
=
1
;
}
return
buf
;
}
/**
* @brief Return the CFLAGS the code was compiled with
*
* @result List of CFLAGS within simple quotes (').
*/
const
char
*
compilation_cflags
(
void
)
{
static
char
buf
[
1024
];
static
int
initialised
=
0
;
static
const
char
*
cflags
=
SWIFT_CFLAGS
;
if
(
!
initialised
)
{
if
(
strlen
(
cflags
)
<
1024
-
2
)
sprintf
(
buf
,
"'%s'"
,
cflags
);
else
error
(
"SWIFT_CFLAGS string longer than buffer"
);
initialised
=
1
;
}
return
buf
;
}
/**
* @brief Return the CPPFLAGS the code was compiled with
*
* @result List of CPPFLAGS within simple quotes (')
*/
const
char
*
compilation_cxxflags
(
void
)
{
static
char
buf
[
1024
];
static
int
initialised
=
0
;
static
const
char
*
cppflags
=
SWIFT_CXXFLAGS
;
if
(
!
initialised
)
{
if
(
strlen
(
cppflags
)
<
1024
-
2
)
sprintf
(
buf
,
"'%s'"
,
cppflags
);
else
error
(
"SWIFT_CPPFLAGS string longer than buffer"
);
initialised
=
1
;
}
return
buf
;
}
/**
* @brief The version of SWIFT
*
...
...
@@ -293,8 +352,12 @@ void greetings(void) {
printf
(
" Version : %s
\n
"
,
package_version
());
printf
(
" Revision: %s, Branch: %s
\n
"
,
git_revision
(),
git_branch
());
printf
(
" Webpage : www.swiftsim.com
\n\n
"
);
printf
(
" Webpage : %s
\n\n
"
,
PACKAGE_URL
);
printf
(
" Config. options: %s
\n\n
"
,
configuration_options
());
printf
(
" Compiler: %s, Version: %s
\n
"
,
compiler_name
(),
compiler_version
());
printf
(
" CFLAGS : %s
\n
"
,
compilation_cflags
());
printf
(
" CXXFLAGS: %s
\n
"
,
compilation_cxxflags
());
printf
(
"
\n
"
);
#ifdef HAVE_HDF5
printf
(
" HDF5 library version: %s
\n
"
,
hdf5_version
());
#endif
...
...
src/version.h
View file @
5819f56f
...
...
@@ -25,6 +25,9 @@ const char* package_version(void);
const
char
*
hostname
(
void
);
const
char
*
git_revision
(
void
);
const
char
*
git_branch
(
void
);
const
char
*
configuration_options
(
void
);
const
char
*
compilation_cflags
(
void
);
const
char
*
compilation_cxxflags
(
void
);
const
char
*
compiler_name
(
void
);
const
char
*
compiler_version
(
void
);
const
char
*
mpi_version
(
void
);
...
...
src/version_string.h.in
View file @
5819f56f
...
...
@@ -28,5 +28,7 @@
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
#define GIT_REVISION "@GIT_REVISION@"
#define GIT_BRANCH "@GIT_BRANCH@"
#define SWIFT_CFLAGS "@SWIFT_CFLAGS@"
#define SWIFT_CXXFLAGS "@SWIFT_CXXFLAGS@"
#endif /* SWIFT_VERSION_STRING_H */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment