dynamicCode: Trigger recompile on changes to options and libs

This commit is contained in:
Will Bainbridge
2019-02-04 15:15:19 +00:00
parent 6d4960e36c
commit e600bb0482

View File

@ -79,12 +79,29 @@ Foam::dynamicCodeContext::dynamicCodeContext
} }
} }
// Options
const entry* optionsPtr = dict.lookupEntryPtr("codeOptions", false, false);
if (optionsPtr)
{
options_ =
stringOps::expand(stringOps::trim(optionsPtr->stream()), dict);
}
// Libs
const entry* libsPtr = dict.lookupEntryPtr("codeLibs", false, false);
if (libsPtr)
{
libs_ =
stringOps::expand(stringOps::trim(libsPtr->stream()), dict);
}
// Calculate SHA1 digest from all entries // Calculate SHA1 digest from all entries
OSHA1stream os; OSHA1stream os;
forAllConstIter(HashTable<string>, code_, iter) forAllConstIter(HashTable<string>, code_, iter)
{ {
os << iter(); os << iter();
} }
os << options_ << libs_;
sha1_ = os.digest(); sha1_ = os.digest();
// Add line directive after calculating SHA1 since this includes // Add line directive after calculating SHA1 since this includes
@ -102,23 +119,6 @@ Foam::dynamicCodeContext::dynamicCodeContext
); );
} }
} }
// Options
const entry* optionsPtr = dict.lookupEntryPtr("codeOptions", false, false);
if (optionsPtr)
{
options_ =
stringOps::expand(stringOps::trim(optionsPtr->stream()), dict);
}
// Libs
const entry* libsPtr = dict.lookupEntryPtr("codeLibs", false, false);
if (libsPtr)
{
libs_ =
stringOps::expand(stringOps::trim(libsPtr->stream()), dict);
}
} }