How to add version info resource from commandline?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

How to add version info resource from commandline?

Post 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
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: How to add version info resource from commandline?

Post 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
User avatar
skywalk
Addict
Addict
Posts: 4221
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: How to add version info resource from commandline?

Post 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?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: How to add version info resource from commandline?

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: How to add version info resource from commandline?

Post 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!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: How to add version info resource from commandline?

Post 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
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

Re: How to add version info resource from commandline?

Post 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
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: How to add version info resource from commandline?

Post 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/
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
freak
PureBasic Team
PureBasic Team
Posts: 5942
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: How to add version info resource from commandline?

Post 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)
quidquid Latine dictum sit altum videtur
Post Reply