Page 1 of 1

Prebuild Tutorial

Posted: Wed Apr 01, 2009 8:48 pm
by ironhead
Is there a Prebuild tutorial (or examples) somewhere? I'd like to add a pre-build step to check to see if a file exists, if doesn't, then generate it. I have no idea where to begin though.

Thanx!

Re: Prebuild Tutorial

Posted: Wed Apr 01, 2009 9:46 pm
by eranif
In the 'pre build' tab is you can place simple command like:

Code: Select all

copy <file1> <file2>
or anything similar, you can even execute a script that will do the work for you.

However, you can run some more sophisticated commands using the 'Custom makefile steps', this are actually a makefile command that will be placed as pre build before the build starts.

You can read this:
http://codelite.org/LiteEditor/ProjectSettingsSummary (search for 'Custom Makefile Steps')

Or you can provide some more information here:
- How do u plan to generate the file?
- Which commands?
- etc

And I will help you to fill the missing in the 'custom makefile steps'

Eran

Re: Prebuild Tutorial

Posted: Thu Apr 02, 2009 3:11 pm
by ironhead
Thanx for the heads up! :)

I initially had this as a prebuild step:

Code: Select all

if not exist ../svnversion.h svn info --revision HEAD | findstr Revision > svnversion.tmp
if not exist ../svnversion.d and exit svnversion.tmp for /f "tokens=1,2" %%i in (svnversion.tmp) do echo #define SVN_VERSION %%j > svnversion.h
if exist ../svnversion.h and exist svnversion.tmp for /f "tokens=1,2" %%i in (svnversion.tmp) do echo #define SVN_VERSION_STR "%%j" >> svnversion.h
if exist svnversion.tmp del /q svnversion.tmp
Which is rather ugly, so I implements the custom Makefile step, as per you suggestion which has:

Code: Select all

Dependencies: ../svnversion.h
Rule Action:
../svnversion.h:
	svn info --revision HEAD | findstr Revision > svnversion.tmp &
	for /f "tokens=1,2" %%i in (svnversion.tmp) do echo #define SVN_VERSION %%j > ..\svnversion.h &
	for /f "tokens=1,2" %%i in (svnversion.tmp) do echo #define SVN_VERSION_STR "%%j" >> ..\svnversion.h &
	del /q svnversion.tmp
Which is exactly how I have it defined in the existing Makefile I had for the app.

Yet another excellent feature of CodeLite! :)

Cheers!

Re: Prebuild Tutorial

Posted: Thu Apr 02, 2009 8:55 pm
by jfouche
Hi

You can also use the VersionManager plugin (see my signature).