32 std::string _tmpFolder;
33 std::string _sourcesFolder;
34 std::set<std::string> _ofiles;
35 std::set<std::string> _sfiles;
36 std::vector<std::string> _compileFlags;
37 std::vector<std::string> _compileLibFlags;
38 std::vector<std::string> _linkFlags;
40 bool _saveToDiskFirst;
45 _tmpFolder(
"cppadcg_tmp"),
46 _sourcesFolder(
"cppadcg_sources"),
48 _saveToDiskFirst(
false) {
54 std::string getCompilerPath()
const {
58 void setCompilerPath(
const std::string&
path) {
70 bool isSaveToDiskFirst()
const override {
71 return _saveToDiskFirst;
79 return _sourcesFolder;
86 const std::set<std::string>& getObjectFiles()
const override {
90 const std::set<std::string>& getSourceFiles()
const override {
94 const std::vector<std::string>& getCompileFlags()
const {
98 void setCompileFlags(
const std::vector<std::string>&
compileFlags) {
102 void addCompileFlag(
const std::string&
compileFlag) {
106 const std::vector<std::string>& getLinkFlags()
const {
110 void setLinkFlags(
const std::vector<std::string>&
linkFlags) {
114 void addLinkFlag(
const std::string&
linkFlag) {
118 const std::vector<std::string>& getCompileLibFlags()
const {
119 return _compileLibFlags;
122 void setCompileLibFlags(
const std::vector<std::string>&
compileLibFlags) {
130 bool isVerbose()
const override {
134 void setVerbose(
bool verbose)
override {
157 using namespace std::chrono;
166 std::map<std::string, std::string>::const_iterator
it;
168 _sfiles.insert(
it->first);
176 if (
timer !=
nullptr) {
177 size_t ms = 3 + 2 *
countWidth + 1 + JobTypeHolder<>::COMPILING.getActionName().size() + 2 +
maxsize + 5;
178 ms +=
timer->getJobCount() * 2;
179 if (
timer->getMaxLineWidth() <
ms)
181 }
else if (_verbose) {
182 std::cout << std::endl;
185 std::ostringstream os;
187 if (_saveToDiskFirst) {
197 steady_clock::time_point beginTime;
199 if (
timer !=
nullptr || _verbose) {
200 os <<
"[" << std::setw(
countWidth) << std::setfill(
' ') << std::right << count
201 <<
"/" <<
sources.size() <<
"]";
204 if (
timer !=
nullptr) {
205 timer->startingJob(
"'" +
file +
"'", JobTypeHolder<>::COMPILING, os.str());
207 }
else if (_verbose) {
208 beginTime = steady_clock::now();
209 char f = std::cout.fill();
210 std::cout << os.str() <<
" compiling "
211 << std::setw(
maxsize + 9) << std::setfill(
'.') << std::left
212 << (
"'" +
file +
"' ") <<
" ";
218 if (_saveToDiskFirst) {
233 if (
timer !=
nullptr) {
234 timer->finishedJob();
235 }
else if (_verbose) {
236 steady_clock::time_point
endTime = steady_clock::now();
238 std::cout <<
"done [" << std::fixed << std::setprecision(3)
239 <<
dt.count() <<
"]" << std::endl;
256 for (
const std::string&
it : _ofiles) {
257 if (remove(
it.c_str()) != 0)
258 std::cerr <<
"Failed to delete temporary file '" <<
it <<
"'" << std::endl;
263 remove(this->_tmpFolder.c_str());
279 const std::string&
output,
289 const std::string&
output,