Commit 0061e9ed authored by Mark Olesen's avatar Mark Olesen
Browse files

added Foam::FOAMbuild to Foam::FOAMversion

- avoids problems with finding files based on FOAMversion
  (reported by Mattijs)
parent f0f7ea95
...@@ -26,7 +26,7 @@ Application ...@@ -26,7 +26,7 @@ Application
foamVersionString.C foamVersionString.C
Description Description
Print the FOAMversion string. Print the OpenFOAM version strings.
Simultaneously the smallest possible program to use a minimal bit of Simultaneously the smallest possible program to use a minimal bit of
the OpenFOAM library the OpenFOAM library
...@@ -37,7 +37,10 @@ Description ...@@ -37,7 +37,10 @@ Description
int main() int main()
{ {
std::cerr<< "FOAMversion " << Foam::FOAMversion << "\n"; std::cerr
<< "build " << Foam::FOAMbuild << "\n"
<< "version " << Foam::FOAMversion << "\n";
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
set -x set -x
# update Foam::FOAMversion string if required # update OpenFOAM version strings if required
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
wmakeLnInclude -f OpenFOAM wmakeLnInclude -f OpenFOAM
......
...@@ -38,7 +38,7 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint) ...@@ -38,7 +38,7 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
{ {
memset(spaces, ' ', 40); memset(spaces, ' ', 40);
size_t len = strlen(Foam::FOAMversion); size_t len = strlen(Foam::FOAMbuild);
if (len < 38) if (len < 38)
{ {
spaces[38 - len] = '\0'; spaces[38 - len] = '\0';
...@@ -64,7 +64,7 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint) ...@@ -64,7 +64,7 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
os << os <<
"| ========= | |\n" "| ========= | |\n"
"| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n" "| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\n"
"| \\\\ / O peration | Version: " << FOAMversion << spaces << "|\n" "| \\\\ / O peration | Version: " << FOAMbuild << spaces << "|\n"
"| \\\\ / A nd | Web: www.OpenFOAM.org |\n" "| \\\\ / A nd | Web: www.OpenFOAM.org |\n"
"| \\\\/ M anipulation | |\n" "| \\\\/ M anipulation | |\n"
"\\*---------------------------------------------------------------------------*/\n"; "\\*---------------------------------------------------------------------------*/\n";
......
...@@ -35,6 +35,12 @@ Global ...@@ -35,6 +35,12 @@ Global
Description Description
OpenFOAM version number static string. OpenFOAM version number static string.
Global
Foam::FOAMbuild
Description
OpenFOAM version number static string with build information
SourceFiles SourceFiles
global.Cver global.Cver
...@@ -48,6 +54,7 @@ SourceFiles ...@@ -48,6 +54,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
extern const char* const FOAMversion; extern const char* const FOAMversion;
extern const char* const FOAMbuild;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
...@@ -28,14 +28,15 @@ Description ...@@ -28,14 +28,15 @@ Description
avoid the use of unconstructed data in the global namespace. avoid the use of unconstructed data in the global namespace.
This file has the extension .Cver to trigger a Makefile rule that converts This file has the extension .Cver to trigger a Makefile rule that converts
WM_PROJECT_VERSION into the appropriate version string. 'VERSION\_STRING' and 'BUILD\_STRING' into the appropriate strings.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "foamVersion.H" #include "foamVersion.H"
const char* const Foam::FOAMversion = "WM_PROJECT_VERSION"; const char* const Foam::FOAMversion = "VERSION_STRING";
const char* const Foam::FOAMbuild = "BUILD_STRING";
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Static initializers for string::null, word::null and fileName::null // Static initializers for string::null, word::null and fileName::null
......
.SUFFIXES: .Cver .SUFFIXES: .Cver
# #
# update version string in C++ file and in $WM_PROJECT_DIR/.build file # update version strings in C++ file and in $WM_PROJECT_DIR/.build file
# #
Cvertoo = \ Cvertoo = \
sed 's/WM_PROJECT_VERSION/$(shell wmakePrintBuild -update)/' $$SOURCE > $*.C; \ sed -e 's/VERSION_STRING/$(shell wmakePrintBuild -major)/' \
-e 's/BUILD_STRING/$(shell wmakePrintBuild -update)/' \
$$SOURCE > $*.C; \
$(CC) $(c++FLAGS) -c $*.C -o $@ $(CC) $(c++FLAGS) -c $*.C -o $@
.Cver.dep: .Cver.dep:
......
...@@ -39,7 +39,8 @@ usage: $Script [OPTION] ...@@ -39,7 +39,8 @@ usage: $Script [OPTION]
options: options:
-check check the git head commit vs. \$WM_PROJECT_DIR/.build -check check the git head commit vs. \$WM_PROJECT_DIR/.build
(exit code 0 for no changes) (exit code 0 for no changes)
-update update the \$WM_PROJECT_DIR/.build from the git information -major report \$WM_PROJECT_VERSION only and exit
-update update \$WM_PROJECT_DIR/.build from the git information
-version VER specify an alternative version -version VER specify an alternative version
Print the version used when building the project, in this order of precedence: Print the version used when building the project, in this order of precedence:
...@@ -65,6 +66,10 @@ do ...@@ -65,6 +66,10 @@ do
checkOnly=true checkOnly=true
shift shift
;; ;;
-major)
echo ${WM_PROJECT_VERSION:-unknown}
exit 0
;;
-u | -update) -u | -update)
update=true update=true
shift shift
......
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