Some examples

From Code::Blocks
Revision as of 16:46, 14 November 2019 by Bluehazzard (talk | contribs) (Fix formating)


Conditional compiler flags for different OS

For example different libraries for X11 and Windows

1) Project->Build options->Select the project name on the left 2) Linker Settings->Other linker options 3) Add the squirrel script:

[[if(PLATFORM == PLATFORM_MSW ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11"));]]

be aware, this has to be in one line of the other liner options...

After build

Copy the build log after compilation to a new location and rename it with target name and compiler id.

IO.CopyFile(_("$(PROJECTNAME)_build_log.html"), _("$(PROJECTNAME)_build_log_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetTitle() + _("_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetCompilerID() + _(".html"), true );

This is in one line, so you can copy and paste it in the post build step (but don't forget to add the [[ ]] )

See also