Buil number as part of compiled binary file name lazarus / 13-General ---------------------------------------------------------------------- srnec · 2025-02-03 07:31 Hello, is it there a possibility to have build number included in file name or path? I searched in IDE macros and others settings but found nothing. ---------------------------------------------------------------------- Thaddy · 2025-02-03 07:38 The version info dialog in Lazarus ---------------------------------------------------------------------- srnec · 2025-02-03 07:58 Quote from: Thaddy on February 03, 2025, 08:38:37 amThe version info dialog in Lazarus "The version info dialog" includes version info in compiled file itself, I am looking for build number in file name. In the Project Options Compiler - Paths - Target File name: and use somethink like lib/myBinary-$(BuildNo) ---------------------------------------------------------------------- dbannon · 2025-02-03 08:14 Lazarus will run a command or script after the compile Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $> mv project1 project1-b343 Er, Windows, its 'rename' perhaps ? Davo ---------------------------------------------------------------------- cdbc · 2025-02-03 09:45 Hi You can set the 'Target-filename' in 'Project' -> 'Options' -> 'Paths' See the attached screen-shot... Regards Benny ---------------------------------------------------------------------- MarkMLl · 2025-02-03 09:53 But as far as I can see there isn't an IDE macro which expands to the build number, so it can't be automated by either setting a target filename or by renaming after the build (without having an external program which reads the build version from the binary then renames it appropriately). MarkMLl ---------------------------------------------------------------------- n7800 · 2025-02-03 11:15 There is no such macro, but it was added to trunk. It will be released in Lazarus 5.0. ---------------------------------------------------------------------- 440bx · 2025-02-03 11:42 Quote from: n7800 on February 03, 2025, 12:15:27 pmThere is no such macro, but it was added to trunk. It will be released in Lazarus 5.0. I am under the impression that the macro you are referring to returns Lazarus IDE information.  Is this correct ? Also, I am under the impression that what the OP is asking for is to be able to use the _applicaton's_ build information (like what's stored in the Windows version info.)  If this is correct then the Lazarus macro you referred to does not apply. Are either one of these impressions incorrect ? ---------------------------------------------------------------------- Thaddy · 2025-02-03 11:56 Yes, it is info about lazarus itself, not info about your own compiled binaries and that is what is asked. The way to do that is to use two of the tips mentioned above: 1. Use the version info dialog 2. Extract the build info into a string and add that to the executable name by using mv or rename. There are some other ways to achieve that. Have to check if these still work. ---------------------------------------------------------------------- n7800 · 2025-02-03 11:59 It's sad to hear this, because I spent a lot of time writing the description and example of use... (( The very first line says: QuoteAdds a macro to the IDE that returns the project version number. The last section "$LazVer() macro" (this is already a macro for the IDE version) says: QuoteFor consistency, the second commit adds the same optional parameters to the $LazVer() macro. So, I added a macro for the project. And additionally added parameters for the IDE macro (which already exists, but has no parameters). EDIT: Even the title also says: QuoteIDE: Added IDE macro ProjVer to get project version. Issue #23198 ---------------------------------------------------------------------- 440bx · 2025-02-03 12:04 Quote from: n7800 on February 03, 2025, 12:59:20 pmIt's sad to hear this, because I spent a lot of time writing the description and example of use... Even if the macro you implemented doesn't solve the OP's problem, there is a good chance it will be useful to other people. IOW, don't be sad, it is very likely to be useful. ---------------------------------------------------------------------- alpine · 2025-02-03 13:56 Quote from: Thaddy on February 03, 2025, 12:56:06 pm1. Use the version info dialog 2. Extract the build info into a string and add that to the executable name by using mv or rename. wmic can be used on Window$. Put that in a filever.cmd file: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i @echo offrem display file version of an executable file     setlocal enableextensions      rem fully expand the file name    set "file=%~dp1%~nx1"            if not defined file goto :eof    if not exist "%file%" goto :eof     rem use wmic to get file version in %vers%    set "vers="    for /F "tokens=2 delims==" %%g in ('        wmic datafile where name^="%file:\=\\%" get Version /value     ') do set "vers=%%g"     if not "%vers%"=="" echo %vers%     endlocal Then: filever.cmd somefile.exe will output something like: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 7.14.0.3804 Don't know for Linux. ---------------------------------------------------------------------- Thaddy · 2025-02-03 13:59 The way I proposed is cross-platform. You can also do it manually by specifying the -o option. If you use a version control system like git or svn for your own sources, the version should be easy to script. ---------------------------------------------------------------------- JuhaManninen · 2025-02-03 19:33 Quote from: 440bx on February 03, 2025, 01:04:52 pmEven if the macro you implemented doesn't solve the OP's problem, there is a good chance it will be useful to other people. Why wouldn't the $ProjVer() macro solve this problem? It looks like a perfect match to me. The "Target file name (-o)" field in Project Options supports macros AFAIK. ---------------------------------------------------------------------- srnec · 2025-02-03 19:46 For me, the $ProjVer(build) looks like perfect solution. Clean and multiplatform. There is possibility to extract "" from .lpi file and rename compiled binary, but use of macro is more straightforward. I think adding new macro to IDE is useful also other purposes.