Difference between revisions of "Some examples"

From Code::Blocks
(Add Conditional flags for different OS)
Line 1: Line 1:
 
[[Category:Scripting Code::Blocks]]
 
[[Category:Scripting Code::Blocks]]
 +
== 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:
 +
 +
<code>
 +
[[ if(PLATFORM == PLATFORM_MSW  ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11")); ]]
 +
</code>
 +
 +
be aware, this has to be in one line of the other liner options...
  
 
== After build ==
 
== After build ==

Revision as of 15:56, 14 November 2019

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