I'd like to know if it is possible to instruct Lazbuild to compile/build for each mode found in a .lpi file ?
To specify the build mode, use the option:
lazbuild project1.lpi --bm=release
Without specifying it, the last selected in the IDE is used by default.
The
--bm parameter supports wildcards ("
*"), and to specify all build modes, use:
lazbuild project1.lpi --bm=*
Another question is: is it possible to have Lazbuild save the build/compilation result in a file named after the project, e.g, <.lpr name only>.<build mode>.lbmessages.txt ?
Yes, if you have the same output file name in some build modes, they will simply be overwritten...
Recently,
lazbuild added the ability to specify
compiler options from the command line (add/override options from the build mode), and you can specify a specific file name:
lazbuild project1.lpi --opt=-oNewName.exe
You can use
IDE macros in these options. To output to a file with the project name and build mode, you will need:
lazbuild project1.lpi --bm=* --opt=-o$NameOnly($ProjFile())-$BuildMode().exe
Note that the build mode name may contain characters that may not be valid in the current file system.IOW, if a .lpi file has 4 build modes, is it possible to have Lazbuild iterate through each mode and create an output text file named after each mode ?
If you want to save the console output to a file, just use redirection:
lazbuild ... > output.txt
But if you want it to be saved in a separate file with the project name and build mode, things get much more complicated. You will have to manually write a script to list the build modes "
--get-build-modes", and for each one, generate an output name.
To simply query the macro result (get the project name) for use in a script, you can also use the
recently added "
--get" option:
lazbuild project1.lpi --get=$NameOnly($ProjFile())