Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

log filename including compiler, version, linker and debug or release ?

(1/7) > >>

pabristow:
I am working to ensure portability across several compilers and would like to be able to save the log file for various combinations of compiler, compiler version, linker, dat and time, and debug or release.

For example I'd like the log file to be named like

    I:\Cpp\multiprecision\show_numeric_limits\show_numeric_limits_build_clang900_lld_debug_log.html
    I:\Cpp\multiprecision\show_numeric_limits\show_numeric_limits_build_gcc810_cl_release_log.html

This is possible now, but only with some tedious file renaming, and I'm making mistakes :-(

Could a macro be used somehow?

Thanks

Paul

BlueHazzard:
generally it should be possible... I think i found a bug in the scripting code that makes a problem here.... Will report back

BlueHazzard:

--- Code: ---[[IO.CopyFile(_("$(PROJECTNAME)_build_log.html"), _("$(PROJECTNAME)_build_log_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetTitle() + _("_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetCompilerID() + _(".html"), true );]]

--- End code ---

Ok, this should work if you post it in the post build process...

Sadly, this has to be in one line...
If you want it in one file we can modify it to run only a script file...

pabristow:
Sorry for delay.

Thanks for this that looks plausible - but I must be doing something wrong  :(

I've copied your line (as one line) into the box marked Build Options for the compiler debug Clang900 Pre/post build steps (and also ticked the 'Always execute, even if target is uptodate box in case that would help?).'

But when I rebuild, the Build log now says

  Output file is bin\Debug\hello_boost_exception.exe with size 272.50 KB
  Running target post-build steps
  Nothing to be done (all items are up-to-date).

What am I doing wrong?

PS While we are at it, would a date and time be possible too (rather than relying on the file properties CreateDate?

PPS I presume this could also be done similarly for one file of type .log or .txt



BlueHazzard:
Does it ask for write permission? There is a security feature that should ask for permission if you use the IO namespace of squirrel.
Have you tried to copy it in the project build options for testing?
Did you not forget to add the
--- Code: ---[[]]
--- End code ---
at the beginning and end of the squirrel line? It should exactly look like my code in the forum post.
What version of codeblocks do you use? I think i made some bug fixes in squirrel scripting after the release...
What happens if you paste the line, without
--- Code: --- [[]]
--- End code ---
, in the scripting console (view->scripting console) at the bottom line (warning this can overwrite your build log).


--- Quote ---While we are at it, would a date and time be possible too (rather than relying on the file properties CreateDate?
--- End quote ---
you can do this in two ways:
1) Variable expansion: http://wiki.codeblocks.org/index.php/Variable_expansion
Add
--- Code: ---$(NOW)
--- End code ---
where you want to have the date. For example:

--- Code: ---[[IO.CopyFile(_("$(PROJECTNAME)_build_log.html"), _("$(PROJECTNAME)_build_log_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetTitle() + _("_$(NOW)_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetCompilerID() + _(".html"), true );]]
--- End code ---
Would add the date and time before the compiler id.
2) Using the squirrel function. But this would make the code longer and less readable, so i omit it here... If you want it that way, you can ask and i will try to create something...


--- Code: --- I presume this could also be done similarly for one file of type .log or .txt
--- End code ---
Squirrel is a full touring complete scripting language. You can do everything with it :)
Some bindings are missing, but if you need it we can implement it...

Navigation

[0] Message Index

[#] Next page

Go to full version