Difference between revisions of "Custom compiler"

From Code::Blocks
(Fixed SVN URL)
 
(One intermediate revision by one other user not shown)
Line 24: Line 24:
 
* $file - current file being compiled
 
* $file - current file being compiled
 
* $file_dir - Source file directory without file name and file name extension.
 
* $file_dir - Source file directory without file name and file name extension.
* file_name - Source file name without path info and file name extension.
+
* $file_name - Source file name without path info and file name extension.
* $exe_dir - Directory of executable without file name and file name extension.
 
* $exe_name - File name of executable without path and file name extension.
 
* $exe_ext - File name extension of executable without path and file name.
 
 
* $dep_object
 
* $dep_object
 
* $object
 
* $object
 
* $resource_output
 
* $resource_output
 
* $exe_output
 
* $exe_output
* $exe_output
+
* $exe_dir - Directory of executable without file name and file name extension.
 +
* $exe_name - File name of executable without path and file name extension.
 +
* $exe_ext - File name extension of executable without path and file name.
 
* $link_resobjects
 
* $link_resobjects
 
* $link_objects
 
* $link_objects
Line 46: Line 45:
  
 
Implementation Details can be found here:
 
Implementation Details can be found here:
http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/sdk/compilercommandgenerator.cpp
+
https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/compilercommandgenerator.cpp

Latest revision as of 21:00, 6 September 2020

TODO Text about what custom compiler does.

Bison Example

For example enable Custom Compiler to generate a cpp file form a bison grammatic.

Given a bison file "myparser.ypp" in your source tree. Select properties, go to advanced tab, tick custom compiler and add the line "bison $file".

Note if you use the supplied mingw binaries, you have to define BISON_SIMPLE=%CB%\share\bison.simple, BISON_HAIRY=%CB%\share\bison.hairy as environment variables. Otherwise you could install http://gnuwin32.sourceforge.net/packages/bison.htm (Setup, without binaries has all required DLLs) and just add the "bin" directory to your System's PATH environment variable.
BISON_SIMPLE, BISON_HAIRY information taken from http://board.planetpeer.de/index.php?topic=456.0;prev_next=prev.
More a feature request than working example. It seems difficult to make Code::Blocks put the .cpp file into the source tree.

Compiler Parameters

  • $compiler
  • $linker
  • $lib_linker
  • $rescomp
  • $options
  • $link_options
  • $includes
  • $res_includes
  • $libdirs
  • $libs
  • $file - current file being compiled
  • $file_dir - Source file directory without file name and file name extension.
  • $file_name - Source file name without path info and file name extension.
  • $dep_object
  • $object
  • $resource_output
  • $exe_output
  • $exe_dir - Directory of executable without file name and file name extension.
  • $exe_name - File name of executable without path and file name extension.
  • $exe_ext - File name extension of executable without path and file name.
  • $link_resobjects
  • $link_objects
  • $link_flat_objects
  • $static_output
  • $def_output
  • MACROS - also all macros are applied to the commandline string

The following were added to support the QUICK HACK in compiler plugin: DirectCommands::GetTargetLinkCommands()

  • $+link_objects
  • $-link_objects
  • $-+link_objects
  • $+-link_objects

Implementation Details can be found here: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/compilercommandgenerator.cpp