Hola!
Is there a way to make pre-build script cross-platform? I've looked into attaching a build script like that:
function SetBuildOptions(base)
{
if (PLATFORM == PLATFORM_MSW) {
IO.Execute(_T("blahblah.bat"));
} else {
IO.Execute(_T("blahblah.sh"))
}
}
But the problem is it gets executed three times during build process. Which could be a huge bummer, given script execution time. Maybe there is a way to determine which execution it is from the script that I've missed?
Thanks in advance.
You can use something like
$if(PLATFORM == PLATFORM_MSW){ [[ print(_T("ls -l")); ]] }{ [[ print(_T("pwd")); ]] }
as pre- or post-build step.
Have you tried to use http://wiki.codeblocks.org/index.php?title=Global_compiler_variables ?
Sure thing. But it doesn't cover different lib names. Anyhow, I ended up using smth like the following for now, and putting up with it being executed thrice.
function SetBuildOptions(base)
{
if (PLATFORM == PLATFORM_MSW)
{
IO.Execute(_T("qrc.bat"));
base.AddLinkLib(_T("QtCore4"));
base.AddLinkLib(_T("QtGui4"));
base.AddLinkLib(_T("sqlite3"));
}
else if (PLATFORM == PLATFORM_GTK)
{
IO.Execute(_T("qrc.sh"))
base.AddLinkLib(_T("QtCore"));
base.AddLinkLib(_T("QtGui"));
base.AddLinkLib(_T("sqlite3"));
}
}
Interesting thing, though, even if attached to debug target, script getting executed when release target active. This (http://wiki.codeblocks.org/index.php?title=Build_scripts) one says "SetBuildOptions(base) is called before the project/target is built". I can assume it is called for every build target and project itself. Still maybe theres a way, that I don't know of, to tell which is the case for current execution?