Difference between revisions of "Some examples"

From Code::Blocks
(Add Conditional flags for different OS)
(Fix formatting)
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Scripting Code::Blocks]]
 
[[Category:Scripting Code::Blocks]]
 +
__FORCETOC__
 +
 
== Conditional compiler flags for different OS ==
 
== Conditional compiler flags for different OS ==
 
For example different libraries for X11 and Windows
 
For example different libraries for X11 and Windows
  
 
1) Project->Build options->Select the project name on the left
 
1) Project->Build options->Select the project name on the left
 +
 
2) Linker Settings->Other linker options
 
2) Linker Settings->Other linker options
 +
 
3) Add the squirrel script:
 
3) Add the squirrel script:
  
 
<code>
 
<code>
[[ if(PLATFORM == PLATFORM_MSW  ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11")); ]]
+
<nowiki>
 +
[[if(PLATFORM == PLATFORM_MSW  ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11"));]]
 +
</nowiki>
 
</code>
 
</code>
  

Revision as of 16:47, 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