Difference between revisions of "Some examples"

From CodeBlocks
Jump to: navigation, search
(Add toc, try to fix formatting)
(Fix formating)
Line 10: Line 10:
  
 
<code>
 
<code>
 +
<nowiki>
 
  [[if(PLATFORM == PLATFORM_MSW  ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11"));]]
 
  [[if(PLATFORM == PLATFORM_MSW  ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11"));]]
 +
</nowiki>
 
</code>
 
</code>
  

Revision as of 17:46, 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