Prebuild Tutorial

General questions regarding the usage of CodeLite
ironhead
CodeLite Enthusiast
Posts: 22
Joined: Mon Mar 30, 2009 3:15 pm
Contact:

Prebuild Tutorial

Post 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!
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Prebuild Tutorial

Post 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
Make sure you have read the HOW TO POST thread
ironhead
CodeLite Enthusiast
Posts: 22
Joined: Mon Mar 30, 2009 3:15 pm
Contact:

Re: Prebuild Tutorial

Post 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!
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Prebuild Tutorial

Post by jfouche »

Hi

You can also use the VersionManager plugin (see my signature).
Jérémie
Post Reply