Compile Code::Blocks plugins based on a nightly

From CodeBlocks
Revision as of 21:28, 22 August 2012 by MortenMacFly (Talk | contribs)

Jump to: navigation, search

First, a general note: This article applies to Windows/MinGW compiler only for the moment, feel free to extend the article, if you see a similar possibility on other platforms.

So, you don't want to compile wxWidgets or Code::Blocks core but still want to be able to modify a certain plugin (for example) and use the modified plugin in your favourite nightly? Its possible. Here is what you need:

  • The wxWidgets sources (!) - no need to compile them, just download from here but exactly the version, the nightly is built on.
  • A nightly of your choice, download from here.
  • The Code::Blocks sources in the revision the nightly is based on from here. You usually get these, if you issue a:
 svn checkout svn://[email protected] working-directory

...on the command line (having the Subversion tools installed properly). For example, to checkout trunk at revision 8150 into the folder you are currently in, issue:

 svn checkout svn://[email protected]
  • The sources of the plugin / component you want to change should be included in this checkout, you can (however) update the specific folder to SVN HEAD, if you like.

One note: This surely only works, if the SDK version is compatible to the plugin. What won't work is, if the plugin makes use of SDK methods not available in the SDK version the nightly is based on.

Now comes the "hard" part: You'll need to adjust the plugin's project file, so it links against the DLL's from the nightly (yes, MinGW can do so!) instead of the import libraries you usually compile.

Do the following:

  • Goto the plugin's build options
  • Goto linker settings
    • change the wxmsw28$(WX_SUFFIX) part to become "wxmsw28u_gcc_cb.dll" (the one shipped with the nightly)
    • change the codeblocks part to become "codeblocks.dll" (the one shipped with the nightly)
  • Goto the "search directories" settings
    • change the compilers C::B related include directories (usually setup relative, like ..\..\..\include) to point to the equivalent path's where you checked out the C::B sources
    • change the compilers wxwidgets related include directories (usually setup like $(#WX.INCLUDE)) to point to the equivalent path's where you extracted the wxWidgets sources, or (in case of global variables like here), just adjust the global compiler variables (GCV's).
    • Do the same with the linker and resource include path's of the plugin (note that i.e. "..\..\..\devel" should not point to the root of your nightly installation folder)
  • Note that you might need to do this at project and target level - depending on how the plugin is setup.
  • Try to compile and resolve any remaining issues which can only occur, in case you didn't do the above steps carefully.
  • Goto the plugin's project options
    • Adjust the objects output folder, if desired
    • Adjust the plugin's output file name and path, if desired
    • Adjust the execution working directory, if desired

Now you should be able to compile and link the plugin successfully. This will create a plugin version compatible to that nightly. Voilà - feel free to share it with others afterwards.