STYLE: shorten paths reported in dynamicCode

This commit is contained in:
Mark Olesen
2011-03-02 15:36:02 +01:00
parent 815a806be7
commit ffc74562f7
2 changed files with 31 additions and 3 deletions

View File

@ -51,6 +51,8 @@ const Foam::fileName Foam::dynamicCode::codeTemplateDirName
const char* Foam::dynamicCode::libTargetRoot = const char* Foam::dynamicCode::libTargetRoot =
"LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib"; "LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib";
const char* Foam::dynamicCode::topDirName = "dynamicCode";
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -281,7 +283,7 @@ bool Foam::dynamicCode::writeDigest(const std::string& sha1) const
Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName) Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
: :
codeRoot_(stringOps::expand("$FOAM_CASE/dynamicCode")), codeRoot_(stringOps::expand("$FOAM_CASE")/topDirName),
libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")), libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")),
codeName_(codeName), codeName_(codeName),
codeDirName_(codeDirName) codeDirName_(codeDirName)
@ -297,6 +299,18 @@ Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::fileName Foam::dynamicCode::codeRelPath() const
{
return topDirName/codeDirName_;
}
Foam::fileName Foam::dynamicCode::libRelPath() const
{
return codeRelPath()/libSubDir_/"lib" + codeName_ + ".so";
}
void Foam::dynamicCode::clear() void Foam::dynamicCode::clear()
{ {
compileFiles_.clear(); compileFiles_.clear();
@ -376,7 +390,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
{ {
if (verbose) if (verbose)
{ {
Info<< "Creating new library in " << this->libPath() << endl; Info<< "Creating new library in " << this->libRelPath() << endl;
} }
if (!allowSystemOperations) if (!allowSystemOperations)
@ -500,7 +514,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
bool Foam::dynamicCode::wmakeLibso() const bool Foam::dynamicCode::wmakeLibso() const
{ {
const Foam::string wmakeCmd("wmake libso " + this->codePath()); const Foam::string wmakeCmd("wmake libso " + this->codeRelPath());
Info<< "Invoking " << wmakeCmd << endl; Info<< "Invoking " << wmakeCmd << endl;
if (Foam::system(wmakeCmd)) if (Foam::system(wmakeCmd))

View File

@ -108,6 +108,9 @@ protected:
//- Root of the LIB target for Make/files //- Root of the LIB target for Make/files
static const char* libTargetRoot; static const char* libTargetRoot;
//- Top-level directory name for copy/compiling
static const char* topDirName;
// Protected Member Functions // Protected Member Functions
@ -220,6 +223,17 @@ public:
return codeRoot_/libSubDir_/"lib" + codeName_ + ".so"; return codeRoot_/libSubDir_/"lib" + codeName_ + ".so";
} }
//- Path for specified code name relative to \$FOAM_CASE
// Corresponds to topDirName/codeDirName()
fileName codeRelPath() const;
//- Library path for specified code name relative to \$FOAM_CASE
// Corresponds to
// dynamicCode/codeDirName()/libSubDir()/lib\<codeName\>.so
fileName libRelPath() const;
//- Path for SHA1Digest //- Path for SHA1Digest
// Corresponds to codePath()/Make/SHA1Digest // Corresponds to codePath()/Make/SHA1Digest
fileName digestFile() const fileName digestFile() const