Difference between revisions of "Some examples"
Bluehazzard (talk | contribs) (Create this page as collection of useful scripts) |
Bluehazzard (talk | contribs) (Fix formatting) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Scripting Code::Blocks]] | ||
+ | __FORCETOC__ | ||
+ | |||
+ | == 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> | ||
+ | <nowiki> | ||
+ | [[if(PLATFORM == PLATFORM_MSW ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11"));]] | ||
+ | </nowiki> | ||
+ | </code> | ||
+ | |||
+ | be aware, this has to be in one line of the other liner options... | ||
== After build == | == After build == | ||
Line 8: | Line 27: | ||
This is in one line, so you can copy and paste it in the post build step (but don't forget to add the <code>[[ ]]</code> ) | This is in one line, so you can copy and paste it in the post build step (but don't forget to add the <code>[[ ]]</code> ) | ||
+ | |||
+ | == See also == | ||
+ | |||
+ | * [[Scripting Code::Blocks|Scripting index]] |
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 [[ ]]
)