User forums > Using Code::Blocks

Cross-platform Pre/Post-Build Steps

(1/2) > >>

w1ck3dg0ph3r:
Hola!
Is there a way to make pre-build script cross-platform? I've looked into attaching a build script like that:

--- Code: ---function SetBuildOptions(base)
{
    if (PLATFORM == PLATFORM_MSW) {
        IO.Execute(_T("blahblah.bat"));
    } else {
        IO.Execute(_T("blahblah.sh"))
    }
}
--- End code ---
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.

Jenna:
You can use something like

--- Code: ---$if(PLATFORM == PLATFORM_MSW){ [[ print(_T("ls -l")); ]] }{ [[ print(_T("pwd")); ]] }
--- End code ---
as pre- or post-build step.

MortenMacFly:

--- Quote from: jens on March 07, 2012, 11:30:25 pm ---
--- Code: ---$if(PLATFORM == PLATFORM_MSW){ [[ print(_T("ls -l")); ]] }{ [[ print(_T("pwd")); ]] }
--- End code ---

--- End quote ---
Besides the fact that ls -l is not a proper Windows command (except i.e. you have GnuWin32 installed) this is correct.

w1ck3dg0ph3r:
Thanks, didn't knew that, could be useful.
But still, since build script is the only (am I wrong?) way to automatically build against different libs for different platforms, it would be nice to do abovementioned in build script too.

oBFusCATed:
Have you tried to use http://wiki.codeblocks.org/index.php?title=Global_compiler_variables ?

Navigation

[0] Message Index

[#] Next page

Go to full version