Page 1 of 1
How to add version info resource from commandline?
Posted: Thu May 12, 2011 8:39 am
by Kukulkan
Hi,
I can enter version information, support address, website and other information in the IDE to get compiled into my exe or dll. How do I add this information to the executable, if I need to compile using the command-line compiler (make or ant)? And how to add the icon ressource to an executable? Is there a small commandline tool available for this? Any tipps?
Kukulkan
Re: How to add version info resource from commandline?
Posted: Wed May 18, 2011 1:34 am
by RichAlgeni
If you look at the bottom of a program in an editor other than the PB IDE, I think you'll see what you're looking for, and you won't need a command line tool. For instance:
Code: Select all
; IDE Options = PureBasic 4.51 (Windows - x64)
; CursorPosition = 319
; Folding = -
; EnableThread
; EnableXP
; EnableOnError
; UseIcon = marker_server.ico
; Executable = marker_server.exe
; HideErrorLog
; CurrentDirectory = D:\dev\PureBasic\temp\
; CompileSourceDirectory
; Compiler = PureBasic 4.51 (Windows - x64)
; EnablePurifier
; IncludeVersionInfo
; VersionField0 = 1.0.0.0
; VersionField1 = 1.4.01d
; VersionField2 = Joe Schmoe's Software
; VersionField3 = Marker Server
; VersionField4 = 1.4.01d
; VersionField5 = 1.0.0.0
; VersionField6 = Marker Server
; VersionField7 = Marker Server
; VersionField8 = Marker_Server.pb
; VersionField13 = joe@JoeSchmoe.com
Re: How to add version info resource from commandline?
Posted: Wed May 18, 2011 3:18 am
by skywalk
Thanks RichAlgeni!
I was just looking for this.
Never thought to look in the preferences section, since the version info wasn't there for what ever file.pb I was looking at.
It is a good question though.
Why aren't there formal #compiler constants for these values?
Re: How to add version info resource from commandline?
Posted: Wed May 18, 2011 6:48 am
by Kukulkan
Thank you.
Now, there is another questions on this: We use the IDE option "A common file project.cfg for every directory" to avoid problems in CVS (git). Are the settings inside there also recognized by the compiler? And how does he recognize the different variants on this (inside source, project.cfg etc.)?
Isn't this a little bit unusual?
Is there a documentation on this?
Kukulkan
Re: How to add version info resource from commandline?
Posted: Wed May 18, 2011 1:03 pm
by ts-soft
Kukulkan wrote:Are the settings inside there also recognized by the compiler?
Only the IDE use this settings, so it is not helpfull for you!
Re: How to add version info resource from commandline?
Posted: Thu May 19, 2011 7:54 am
by Kukulkan
Hi ts-soft,
yes, you are right. The compiler does not care about.
This turns me back to my initial question. How to solve?
Kukulkan
Re: How to add version info resource from commandline?
Posted: Thu May 19, 2011 3:59 pm
by helpy
With the following steps I got the version ressource
file, whiche PureBasic creates during its building process:
- I made a small test program (only a message requester) and filled the version info in to the compiler options.
- Then I made a compile/run (F5)
- In the user temp directory I found the file PB_Resources.rc
The PB_Resources.rc contains:
VERSIONINFO resource wrote:#define VOS_UNKNOWN 0x00000000
#define VOS_DOS 0x00010000
#define VOS_OS216 0x00020000
#define VOS_OS232 0x00030000
#define VOS_NT 0x00040000
#define VOS_DOS_WINDOWS16 0x00010001
#define VOS_DOS_WINDOWS32 0x00010004
#define VOS_OS216_PM16 0x00020002
#define VOS_OS232_PM32 0x00030003
#define VOS_NT_WINDOWS32 0x00040004
#define VFT_UNKNOWN 0
#define VFT_APP 1
#define VFT_DLL 2
#define VFT_DRV 3
#define VFT_FONT 4
#define VFT_VXD 5
#define VFT_STATIC_LIB 7
1 VERSIONINFO
FILEVERSION 1,2,3,4
PRODUCTVERSION 2,3,4,5
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
{
BLOCK "000004b0"
{
VALUE "CompanyName", "My Company Name\0"
VALUE "ProductName", "My Product Name\0"
VALUE "ProductVersion", "1.2.3.4\0"
VALUE "FileVersion", "2.3.4.5\0"
VALUE "FileDescription", "My File Description\0"
VALUE "InternalName", "My internal Name\0"
VALUE "OriginalFilename", "My Original FileName\0"
VALUE "LegalCopyright", "My Legal Copyright\0"
VALUE "LegalTrademarks", "My Legal Trademarks\0"
VALUE "PrivateBuild", "My Private Build\0"
VALUE "SpecialBuild", "My Special Build\0"
VALUE "Email", "My Email\0"
VALUE "Website", "My Website\0"
VALUE "UserDefined1", "My User Defined 1\0"
VALUE "UserDefined2", "My User Defined 2\0"
VALUE "UserDefined3", "My User Defined 3\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0000, 0x4b0
}
}
==> More information about
VERSIONINFO ==>
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
I would create a version.rc
file, which you can pass to the pbcompiler.exe:
==> with option: /RESOURCE version.rc
More information about pbcompiler options ==>
http://www.purebasic.com/documentation/ ... piler.html
In your build process you could use a tool (batch
file, purebasic program, ...) which creates dynamically a version.rc with the relevant information, which is used when compiling your project!
greetings from germany,
guido
Re: How to add version info resource from commandline?
Posted: Thu May 19, 2011 5:16 pm
by ts-soft
Another way is to use Resource Hacker. You can add the resource after compilation with a batchfile.
http://www.angusj.com/resourcehacker/
Re: How to add version info resource from commandline?
Posted: Thu May 19, 2011 6:47 pm
by freak
There are two options:
1) create the resource file manually (like helpy showed) and pass it to the compiler with /RESOURCE
2) create a project in the IDE and use the IDE's commandline project build options to compile it (new in 4.60)