Author Topic: Is there an instruction list to setup wxWidgets for compiling plugins?  (Read 3262 times)

MichaelAgarkov

  • Guest
Hello, wonderful people behind Code::Blocks. I searched the wiki, but didn't find any information on how to compile wxWidgets to be able to make plugins for Code::Blocks. As I understand, it needs to be built as a monolithic unicode dll, but what version is supported? It also mentioned CodeBlocks.cbp, do I need to download the Code::Blocks source code to do it? Is there any ready precompiled setup available?
Thanks for help.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1487
Re: Is there an instruction list to setup wxWidgets for compiling plugins?
« Reply #1 on: September 12, 2023, 09:58:02 am »
You must compile the plugin with the same compiler used to compile C::B and link with the same wxWidgets used to compile C::B (shared/monolithic). This is because different compilers generate incompatible C++ DLL.

If you use the same compiler that created the release (or nightly, see compiler info in the last nightly post) you do not need to compile C::B and your plugin can be deployed in binary form.

MichaelAgarkov

  • Guest
Re: Is there an instruction list to setup wxWidgets for compiling plugins?
« Reply #2 on: September 12, 2023, 03:51:03 pm »
I see, thank you for help. I would also like to know if there is a ready and precompiled environment for compiling plugins for the latest stable release (20.03) available for download anywhere, since this seems to be what people would commonly want to do.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2659
Re: Is there an instruction list to setup wxWidgets for compiling plugins?
« Reply #3 on: September 12, 2023, 07:54:02 pm »
I see, thank you for help. I would also like to know if there is a ready and precompiled environment for compiling plugins for the latest stable release (20.03) available for download anywhere, since this seems to be what people would commonly want to do.

A new stable release will be out soon, so you might want to code for that.

See: https://forums.codeblocks.org/index.php/topic,25516.msg173682.html#msg173682 for the latest Nightly build.

There you can download a compiled CodeBlocks, wxWidgets and the compiler that builds both.
« Last Edit: September 12, 2023, 07:56:05 pm by Pecan »

MichaelAgarkov

  • Guest
Re: Is there an instruction list to setup wxWidgets for compiling plugins?
« Reply #4 on: September 12, 2023, 08:00:04 pm »
Alright, thanks a lot for the help! I wish Code::Blocks will become more recognised one day, it's a really good IDE, even if it lacks some small things.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2659
Re: Is there an instruction list to setup wxWidgets for compiling plugins?
« Reply #5 on: September 13, 2023, 06:00:48 pm »
To build a CB plugin you'll need the CB sdk which you can
obtain by compiling the SVN source with the cbNightly.

But the "New Plugin" script also refers to the wxWidgets source. It asks for the values of Global varables "cb", "cb_release_type" and "wx".

By compiling CB, you'll have the "cb" variable that should point to the CB src folder. Or just enter ]"$(COEBLOCKS\..)" for a value that already will resolve to the source folder.
See:
https://wiki.codeblocks.org/index.php/Variable_expansion

The cb_release var should == "-g" for debugging.
But you'll need to compile wxWidgets 3221 to get the "wx" value.

This older URL explains the source installation of CB and wxWidets.
https://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Windows

But it's a bit outdated for  wxWidgets 3221.
To compile wxWidgets 3221 I use the following compile command in a .cmd file:
Code
:DoClean
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb CXXFLAGS+="-std=c++11" clean

:DoCompilesOnly
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb CXXFLAGS+="-std=c++11"

Note that when using the "File/New/CB plugin" script, your plugin output ends up in the devel32 folder
( $(#cb)\devel32\share\codeblocks\plugins\ )
whereas CB on Windows looks for plugins in the devel32_64 folder. So you need to change the output destination or copy the plugin dll to the correct folder.

Hope this helps.

Edit: After testing the "New CB plugin", I see that $(CODEBLOCK) is pointing to a folder with no source (namely the nightly).
The script will get a linker error which can be resolved by adding "$(CODEBLOCKS)" to the seach directory for the linker.
« Last Edit: September 13, 2023, 07:24:46 pm by Pecan »