[Done] Command line compiler app version info?

Windows specific forum
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

[Done] Command line compiler app version info?

Post by IdeasVacuum »

Via the IDE, Compiler Options, Version Info can be input. How is this data included when using the Command Line Compiler?

Tried these args, which work without the constant:

Code: Select all

 "C:\PROJECTS_DrvC\HELLO WORLD\HelloWorld.pb" /ICON "C:\PROJECTS_DrvC\HELLO WORLD\HelloWorld.ico" /CONSTANT "#PB_Editor_CompanyName=MyCompany" /EXE "C:\PROJECTS_DrvC\HELLO WORLD\HelloWorld.exe"
Last edited by IdeasVacuum on Sat Dec 24, 2016 2:56 pm, edited 1 time in total.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Command line compiler app version info?

Post by Josh »

Start Compiler with a single parameter

Code: Select all

/VERSION
without /STANDBY etc.

Then the compiler will send something like

Code: Select all

PureBasic 5.51 (Windows - x86) - (c) 2016 Fantaisie Software
and after this compiler will ends itself. This is exactly what the ide does when you add a new compiler in the preference
sorry for my bad english
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Command line compiler app version info?

Post by IdeasVacuum »

Hi Josh

...different topic :)

I'm experimenting with the Command Line Compiler and it's unrelated to the "The compiler isn't loaded yet... please try again." post by Mistrel.

For the Command Line compiler to be truly useful to me, I need it to create a Windows exe with the version info, just as the IDE Compiler does:

#PB_Editor_FileVersionNumeric
#PB_Editor_ProductVersionNumeric
#PB_Editor_CompanyName
#PB_Editor_ProductName
#PB_Editor_ProductVersion
#PB_Editor_FileVersion
#PB_Editor_FileDescription
#PB_Editor_InternalName
#PB_Editor_OriginalFilename
#PB_Editor_LegalCopyright
#PB_Editor_LegalTrademarks
#PB_Editor_PrivateBuild
#PB_Editor_SpecialBuild
#PB_Editor_Email
#PB_Editor_Website

via the IDE: Compiler Options/Version Info
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Command line compiler app version info?

Post by Mistrel »

If you're compiling from the command line then these types of values are stored elsewhere in compilation scripts or a makefile. Just pass them in as constant definitions to the compiler.

All of the constants you mentioned are prefixed by "#PB_Editor_". And since you're not using the editor then they wouldn't be defined.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Command line compiler app version info?

Post by IdeasVacuum »

Hi Mistrel

They define the extra info that can be verified in Windows (RMC on the exe, Properties), so to have those fields filled must I think require specifics - I would hope that there is a PB User out there that has done it before.

Edit: It can be included via a resource file
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Command line compiler app version info?

Post by Josh »

IdeasVacuum wrote:For the Command Line compiler to be truly useful to me, I need it to create a Windows exe with the version info, just as the IDE Compiler does
Ahhh, I see. To send constants to the compiler, use the constantname without the leading #-sign.

P.S.: If you use a resource file, you have the disadvantage that you do not have this information available for a possibly About-box.
sorry for my bad english
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Command line compiler app version info?

Post by IdeasVacuum »

Edit: Content removed to avoid confusion, see follow-up post that defines a file that works :wink:
Last edited by IdeasVacuum on Sat Dec 24, 2016 3:01 pm, edited 1 time in total.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Command line compiler app version info?

Post by IdeasVacuum »

OK. PB is using Pelles C (PORC). Following the syntax guidelines in the Pelles C help, I have created a resource file that works, with less constants and C style syntax. The curly brackets can be replaced with BEGIN and END if you prefer. I included the define for VFT_DLL in case you are compiling a DLL instead of an APP (.exe).

HelloWorld.rc

Code: Select all

#define VOS_NT_WINDOWS32 0x4L
#define VFT_DLL 0x2L
#define VFT_APP 0x1L

1 VERSIONINFO
FILEVERSION    	1,2,0,0
PRODUCTVERSION 	1,2,0,0
FILEOS         	VOS_NT_WINDOWS32
FILETYPE       	VFT_APP
{
    BLOCK "StringFileInfo"
    {
        BLOCK "080904B0" // UK English, Unicode
        {
            VALUE "CompanyName", "MyCo\0"
            VALUE "ProductName", "Hello World\0"
            VALUE "ProductVersion", "v1.2\0"
            VALUE "FileVersion", "v1.2\0"
            VALUE "FileDescription", "Hello World App\0"
            VALUE "InternalName", "Hello World\0"
            VALUE "OriginalFilename", "Hello World.exe\0"
            VALUE "LegalCopyright", "(c) 2016 MyCo\0"
            VALUE "LegalTradeMarks", "MyCo\0"
            VALUE "Email", "info@myco.co.uk\0"
            VALUE "Website", "https://www.myco.co.uk\0"
        }
    }
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x0809, 0x4B0  // UK English, Unicode
    }
}
Image

The PB IDE has a list of the country codes supported on Windows. For example 0409 is US English, 0c04 is Chinese Mandarine.
Interestingly, the Email and Website Values do not work (PB 5.51 x86). They do not work via the IDE Compiler either. It may be that Windows 7 does not support them - perhaps they show up on Win8/10.

Command Line Syntax
I'm actually running the Command Line Compiler via a small app using RunProgram() = less typing = less typos = flexibility, plus all info/errors can be displayed in a single MessageRequester.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply