hi,
first of all, sorry for disturbing you but I couldn't find info what I'm lookin for.
Ok, I'm developing some patches for embedded systems(ARM7 based on). My project consist of *.gif/*.rtttl files as well as C source code too. System I'm developing requires to "compile" such files (precisely, to convert it to other format). IDE which I was using before, based on standard makefile so it was easy to do it.
Currently I'm using CB and have no idea how to do it :?
In Advanced options I set behaviour for gif/rtttl files, e.g.:
Command: Compile single file to object file
Extension: rtttl
Macro: rtttl2re $file -o $objects_output_dir/$file_name.re
Generated files:
and it works fine but only in case when I manually set the compiler flag(Properties...>>Build>>Compile file)
but it's real embarrassing to set this flag by hand for 100 files or more :shock:
so my question is - how to do it automatically?
thanks in advance
regards,
bartek
Yes, only possible through scripting currently. I know it's not optimal but, as you 'll see, it's pretty easy. Not to mention that you 'll learn something new ;).
Here:
local project = GetProjectManager().GetActiveProject();
if (IsNull(project))
{
ShowError(_T("No active project!"));
return;
}
local count = project.GetFilesCount();
for (local i = 0; i < count; ++i)
{
local project_file = project.GetFile(i);
if (project_file.file.GetExt().Matches(_T("rtttl")))
project_file.compile = true;
}
project.SetModified(true);
GetProjectManager().RebuildTree();
Save it as "something.script". You can use it in one of two ways:
- With your project already open, open this script file in the editor, right-click (the editor) and select "Run blah-blah.script"
- Or, better, you can add it to the menus using Settings->Scripting (try something like "Project/Update RTTL files" as the "Register in menus" value).
gee, thanks mate!
huh, I have ever supposed scripting is such powerful tool in CB :shock:
I though scripts are basic alike and here we have syntax quite similar to C++ :!:
regards,
Bartek
oh, one more question - I want to modify your sample a little bit. How can I add checking compiler ID?
I found GetCompilerID function but I'm not sure how to use it :?
if (BLAHBLAHBLAH.GetCompilerID().Matches(_T("NokiX SDK")))
// do something...
and what should I put instead of BLAHBLAHBLAH... :(
yeah, I admit - object languages it's not my favourite ones - I prefer some low-level ones :D