From: Timo Heister Date: Wed, 2 Sep 2015 22:39:37 +0000 (-0400) Subject: Implement .inst splitting in make_instantiations X-Git-Tag: v8.4.0-rc2~470^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=098aecd638c01902209a9afb700c4ad52639ff47;p=dealii.git Implement .inst splitting in make_instantiations --- diff --git a/cmake/scripts/expand_instantiations.cc b/cmake/scripts/expand_instantiations.cc index bb08ddc9f1..fdfa9a9520 100644 --- a/cmake/scripts/expand_instantiations.cc +++ b/cmake/scripts/expand_instantiations.cc @@ -376,14 +376,31 @@ void substitute (const std::string &text, expansion = expansion_lists[pattern].begin(); expansion != expansion_lists[pattern].end(); ++expansion) - std::cout << substitute_tokens (text, name, *expansion) - << std::endl; + { + // surround each block in the for loop with an if-def hack + // that allows us to split instantiation files into several + // chunks to be used in different .cc files (to reduce + // compiler memory usage). + // Just define SPLIT_INSTANTIATIONS_COUNT to a positive number (number of sections) + // to split the definitions into and SPLIT_INSTANTIATIONS_INDEX as a number + // between 0 and SPLIT_INSTANTIATIONS_COUNT-1 to get the instantiations of that + // particular chunk. + static unsigned int counter = 0; + std::cout << "#if !defined(SPLIT_INSTANTIATIONS_COUNT) || (" + << counter++ + << " % SPLIT_INSTANTIATIONS_COUNT == SPLIT_INSTANTIATIONS_INDEX)" << std::endl; + std::cout << substitute_tokens (text, name, *expansion) + << std::endl; + std::cout << "#endif" << std::endl; + } + } else { std::cout << text << std::endl; } + }