User forums > Using Code::Blocks

Cross-platform Pre/Post-Build Steps

<< < (2/2)

w1ck3dg0ph3r:

--- Quote from: oBFusCATed on March 08, 2012, 12:03:21 pm ---Have you tried to use http://wiki.codeblocks.org/index.php?title=Global_compiler_variables ?

--- End quote ---
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.


--- Code: ---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"));
    }
}
--- End code ---

Interesting thing, though, even if attached to debug target, script getting executed when release target active. This 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?

oBFusCATed:
In fact you can specify different library names. See the cflags and lflags.
You can use something like #myvar.cflags and #myvar.lflags or even you can define some user fields.
I've not tried the user fields, but I guess they should just work.

Navigation

[0] Message Index

[*] Previous page

Go to full version