mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: adjust headers for more detailed build info in the future (issue #1010)
- this splits a larger changeset for a gradual implementation
This commit is contained in:
@ -31,6 +31,7 @@ Description
|
||||
|
||||
#include <typeinfo>
|
||||
#include "foamVersion.H"
|
||||
#include "Switch.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -49,10 +50,13 @@ int main()
|
||||
|
||||
Info
|
||||
<< "\nVersion information (namespace)" << nl
|
||||
<< "patched? = " << Switch(foamVersion::patched()) << nl
|
||||
<< "api " << foamVersion::api << nl
|
||||
<< "patch " << foamVersion::patch << nl
|
||||
<< "version " << foamVersion::version << nl
|
||||
<< "build " << foamVersion::build << nl
|
||||
<< "buildArch " << foamVersion::buildArch << nl;
|
||||
|
||||
Info
|
||||
<< "\nTypes" << nl
|
||||
<< "version " << typeid(foamVersion::version).name() << nl
|
||||
|
||||
@ -194,14 +194,15 @@ public:
|
||||
//- Foam::findEtcDirs("caseDicts/postProcessing")
|
||||
//
|
||||
// -# \b user settings
|
||||
// - ~/.OpenFOAM/$WM_PROJECT_VERSION/"caseDicts/postProcessing"
|
||||
// - ~/.OpenFOAM/{PROJECT_API}/"caseDicts/postProcessing"
|
||||
// - ~/.OpenFOAM/"caseDicts/postProcessing"
|
||||
// -# \b group settings
|
||||
// - $WM_PROJECT_SITE/$WM_PROJECT_VERSION/"caseDicts/postProcessing"
|
||||
// - $WM_PROJECT_SITE/{PROJECT_API}/"caseDicts/postProcessing"
|
||||
// - $WM_PROJECT_SITE/"caseDicts/postProcessing"
|
||||
// -# \b other (shipped) settings
|
||||
// - $WM_PROJECT_DIR/etc/"caseDicts/postProcessing"
|
||||
//
|
||||
// Where {PROJECT_API} is the value of the OPENFOAM define.
|
||||
// See further notes in Foam::findEtcFiles()
|
||||
static void list();
|
||||
|
||||
|
||||
@ -872,10 +872,15 @@ void Foam::argList::parse
|
||||
{
|
||||
IOobject::writeBanner(Info, true)
|
||||
<< "Build : " << foamVersion::build.c_str()
|
||||
#if OPENFOAM
|
||||
<< " (OPENFOAM=" << OPENFOAM << ')'
|
||||
#endif
|
||||
<< nl
|
||||
<< " (OPENFOAM=" << OPENFOAM;
|
||||
|
||||
if (foamVersion::patched())
|
||||
{
|
||||
// Patch-level, when defined
|
||||
Info<< " patch=" << foamVersion::patch.c_str();
|
||||
}
|
||||
|
||||
Info<< ')' << nl
|
||||
<< "Arch : " << foamVersion::buildArch << nl
|
||||
<< "Exec : " << commandLine_.c_str() << nl
|
||||
<< "Date : " << dateString.c_str() << nl
|
||||
|
||||
@ -61,17 +61,16 @@ fileNameList findEtcDirs
|
||||
// The search hierarchy corresponds to that of the foamEtcFile script,
|
||||
// which allows for version-specific and version-independent files:
|
||||
// -# \b user settings
|
||||
// - ~/.OpenFOAM/$WM_PROJECT_VERSION
|
||||
// - ~/.OpenFOAM/{PROJECT_API}
|
||||
// - ~/.OpenFOAM/
|
||||
// -# \b group settings
|
||||
// - $WM_PROJECT_SITE/$WM_PROJECT_VERSION
|
||||
// - $WM_PROJECT_SITE/{PROJECT_API}
|
||||
// - $WM_PROJECT_SITE/
|
||||
// -# \b other (shipped) settings
|
||||
// - $WM_PROJECT_DIR/etc/
|
||||
//
|
||||
// \note Treatment of empty or undefined variables
|
||||
// - \b \$WM_PROJECT_VERSION : Use compile-time value of OPENFOAM
|
||||
// - \b \$WM_PROJECT_SITE : Use $WM_PROJECT_DIR/site
|
||||
// Where {PROJECT_API} is the value of the OPENFOAM define.
|
||||
// - \b \$WM_PROJECT_SITE : If unset, use $WM_PROJECT_DIR/site
|
||||
//
|
||||
// \return The list of full paths of all the matching files or
|
||||
// an empty list if the name cannot be found.
|
||||
|
||||
@ -41,22 +41,18 @@ Description
|
||||
// Value from OPENFOAM, defined in wmake rules
|
||||
const int Foam::foamVersion::api
|
||||
(
|
||||
#if OPENFOAM
|
||||
OPENFOAM
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
// Value of VERSION\_STRING generated by the build-script
|
||||
const std::string Foam::foamVersion::version
|
||||
// Value of PATCH generated by the build-script
|
||||
const std::string Foam::foamVersion::patch
|
||||
(
|
||||
"VERSION_STRING"
|
||||
""
|
||||
);
|
||||
|
||||
|
||||
// Value of the BUILD\_STRING generated by the build-script
|
||||
// Value of the BUILD generated by the build-script
|
||||
const std::string Foam::foamVersion::build
|
||||
(
|
||||
"BUILD_STRING"
|
||||
@ -78,6 +74,14 @@ const std::string Foam::foamVersion::buildArch
|
||||
);
|
||||
|
||||
|
||||
// Value of VERSION generated by the build-script
|
||||
// Only required for compatibility
|
||||
const std::string Foam::foamVersion::version
|
||||
(
|
||||
"VERSION_STRING"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Setup an error handler for the global new operator
|
||||
|
||||
|
||||
@ -30,18 +30,31 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::foamVersion::patched()
|
||||
{
|
||||
// Patch-level, when defined (non-zero) and not some @TOKEN@ rubbish
|
||||
return
|
||||
(
|
||||
foamVersion::patch.size() && foamVersion::patch[0] != '@'
|
||||
&& (foamVersion::patch.size() > 1 || foamVersion::patch[0] != '0')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVersion::printBuildInfo(const bool full)
|
||||
{
|
||||
// Can use #if OPENFOAM directly
|
||||
|
||||
Info<<"Using: OpenFOAM-" << foamVersion::version.c_str()
|
||||
<< " (see www.OpenFOAM.com)" << nl
|
||||
<< "Build: " << foamVersion::build.c_str()
|
||||
// The same as using foamVersion::api
|
||||
#if OPENFOAM
|
||||
<< " (OPENFOAM=" << OPENFOAM << ')'
|
||||
#endif
|
||||
<< nl;
|
||||
Info<< "Using: OpenFOAM-" << foamVersion::version.c_str()
|
||||
<< " (" << OPENFOAM << ") (see www.OpenFOAM.com)" << nl
|
||||
<< "Build: " << foamVersion::build.c_str();
|
||||
|
||||
if (foamVersion::patched())
|
||||
{
|
||||
// Patch-level, when defined
|
||||
Info<< " (patch=" << foamVersion::patch.c_str() << ')';
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
if (full)
|
||||
{
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -83,8 +83,8 @@ namespace Foam
|
||||
// The value is 0 if OPENFOAM was not defined.
|
||||
extern const int api;
|
||||
|
||||
//- OpenFOAM version (name or stringified number) as a std::string
|
||||
extern const std::string version;
|
||||
//- OpenFOAM patch number as a std::string
|
||||
extern const std::string patch;
|
||||
|
||||
//- OpenFOAM build information as a std::string
|
||||
extern const std::string build;
|
||||
@ -93,13 +93,19 @@ namespace Foam
|
||||
//- (machine endian, label/scalar sizes) as a std::string
|
||||
extern const std::string buildArch;
|
||||
|
||||
//- OpenFOAM version (name or stringified number) as a std::string
|
||||
extern const std::string version;
|
||||
|
||||
//- Test if the patch string appeared to be in use,
|
||||
//- which is when it is defined (non-zero).
|
||||
bool patched();
|
||||
|
||||
//- Print information about version, build, arch to Info
|
||||
//
|
||||
// Eg,
|
||||
// \code
|
||||
// Using: OpenFOAM-<VERSION> (see www.OpenFOAM.com)
|
||||
// Build: <BUILD> (OPENFOAM=<API_LEVEL>)
|
||||
// Using: OpenFOAM-<MAJOR> (see www.OpenFOAM.com)
|
||||
// Build: <BUILD>
|
||||
// Arch: "<ARCH_INFO>"
|
||||
// \endcode
|
||||
//
|
||||
@ -112,8 +118,8 @@ namespace Foam
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Compatibility names (1806 and earlier).
|
||||
// Historically assumed to be called within the Foam namespace, so they are
|
||||
// defined without the Foam namespace qualifier.
|
||||
// Historically assumed to be called within the Foam namespace, they are
|
||||
// thus defined without the Foam namespace qualifier.
|
||||
//
|
||||
// - FOAMversion: c-string
|
||||
// - FOAMbuild: c-string
|
||||
|
||||
Reference in New Issue
Block a user