Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: stahta01 on May 09, 2017, 03:58:47 am

Title: Patch to CB Plugin Wizard.
Post by: stahta01 on May 09, 2017, 03:58:47 am
I have created a patch for the CB Plugin Wizard.

Quote
* Plugins Wizard: Added target variables:

WX_CFG
WX_COMPILER
WX_SUFFIX
WX_VERSION

Also, fixed build errors when using wxWidgets 3.0.
NOTE: The user still has to rename the path "devel" to "devel30".

Edit: Removed the part that asks which wxWidgets version (it defaults to 28).

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on May 09, 2017, 09:23:31 am
Have you seen this patch: https://sourceforge.net/p/codeblocks/tickets/481/ ?
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 09, 2017, 11:07:06 am
Have you seen this patch: https://sourceforge.net/p/codeblocks/tickets/481/ ?

Not before I wrote the above patch. It seems to be a much larger and complex patch.

Edit1: I will see which of the below options from that patch will be able to be added to my patch.
I currently consider "5) Add target "to_codeblocks" to make the plugin debuggable" to be big enough for a separate patch.

Quote
bluehazzard - 2017-02-27
Ok, so i reworked the script future:
1) Remove wx2.6 support
2) Add support for wx3.0 and wx3.1, make wx2.8 default
3) Changes for the windows build:
3.1) remove -ansi compiler option
3.2) add -std=gnu++11 compiler option
4) Changes for unix:
4.1) add option to choose system default wx-config parameters
4.2) add --version command line parameter for the different versions of wx
5) Add target "to_codeblocks" to make the plugin debuggable (see the discussion top)
6) Move all target common compiler/linker settings to the project
7) Use platform independent squirrel scripting to copy files

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: BlueHazzard on May 09, 2017, 12:20:45 pm
Have you seen this patch: https://sourceforge.net/p/codeblocks/tickets/481/ ?
any comments on this? especially the linux problems?
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 09, 2017, 05:21:19 pm
Quote
bluehazzard - 2017-02-27
Ok, so i reworked the script future:
1) Remove wx2.6 support
2) Add support for wx3.0 and wx3.1, make wx2.8 default
3) Changes for the windows build:
3.1) remove -ansi compiler option
3.2) add -std=gnu++11 compiler option
4) Changes for unix:
4.1) add option to choose system default wx-config parameters
4.2) add --version command line parameter for the different versions of wx
5) Add target "to_codeblocks" to make the plugin debuggable (see the discussion top)
6) Move all target common compiler/linker settings to the project
7) Use platform independent squirrel scripting to copy files

I did NOT see the "-ansi" option I will check and see if it is there to be removed.
I like the Linux options in step 4.2; will try adding this first.
I also like Step 6 move "Move all target common compiler/linker settings to the project".

After I do those will look at the other features.

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on May 09, 2017, 09:27:13 pm
@bluehazzard: I'll try to find time to test it and if it is fine I'll push it.
@stahta01: I'd rather do the same. Test the patch in the ticket and report any problems with it.
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 10, 2017, 02:13:48 am
@bluehazzard: I'll try to find time to test it and if it is fine I'll push it.
@stahta01: I'd rather do the same. Test the patch in the ticket and report any problems with it.

I have downloaded patch #4; still need to do the testing.

Edit: Decided to test on Linux, first.

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 10, 2017, 02:48:44 am
Is this still valid to use under Linux?

Code
`pkg-config --cflags codeblocks`

Because it is NOT working for me.

Edit: Doing the bootstrap/configure/make/make install route to see if it works that way.
Edit2: The reason is the only codeblocks.pc files on my computer was from old testing done that way.
Edit3: After doing the configure/make and setting PKG_CONFIG_PATH to the correct location I can now build using the wizard.
I have NOT figured out how to debug/run the plugin; but, that could easily be user error on my part; I do NOT debug/run Code::Blocks plugins very much.

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: BlueHazzard on May 10, 2017, 11:26:55 am
Code
`pkg-config --cflags codeblocks`

Because it is NOT working for me.
So pkg-config works for you? I do not use it on linux so i could not test it.

Quote
I have NOT figured out how to debug/run the plugin; but, that could easily be user error on my part; I do NOT debug/run Code::Blocks plugins very much.
As i said in the ticket here i have problems and need help. What are the symptoms you are getting?

Quote
3) If i set Project->Set program's argument->Host application to $(#cb)/devel30/codeblocks the debugger does not find the host application (the log shows a empty host application). If i replace $(#cb)/devel30/codeblocks with /absolute/path/to/codeblocks it works. Can someone on a linux system test this?
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 10, 2017, 06:09:30 pm
When trying to run the wizard created plugin.

Code

-------------- Build: to_codeblocks in test43 (compiler: gcc6)---------------

Target is up to date.
Running target post-build steps
zip -j9 test43.zip manifest.xml
updating: manifest.xml (deflated 52%)
Nothing to be done (all items are up-to-date).


-------------- Run: to_codeblocks in test43 (compiler: gcc6)---------------

Checking for existence: /home/stahta01/devel/open_source_code/version_control/codeblocks_https_metadata-git/src/devel30/share/codeblocks/plugins/libtest43.so
Executing: /home/stahta01/devel/open_source_code/version_control/codeblocks_https_metadata-git/src/devel30/codeblocks --debug-log --multiple-instance --no-splash-screen --verbose -p debug (in /home/stahta01/devel/open_source_code/no_version_control/CB_wizard_testing/test43/.)
Process terminated with status -1 (0 minute(s), 0 second(s))
 

-------------- Run: default in test43 (compiler: gcc6)---------------

Checking for existence: /home/stahta01/devel/open_source_code/no_version_control/CB_wizard_testing/test43/libtest43.so
Executing: /home/stahta01/devel/open_source_code/version_control/codeblocks_https_metadata-git/src/devel30/codeblocks  (in /home/stahta01/devel/open_source_code/no_version_control/CB_wizard_testing/test43/.)
Process terminated with status -1 (0 minute(s), 0 second(s))
 

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: BlueHazzard on May 10, 2017, 11:19:29 pm
Thank you for the report.
What happens if you start the debugger?


Quote
(in /home/stahta01/devel/open_source_code/no_version_control/CB_wizard_testing/test43/.)
i think this is the problem. The base path should be
Quote
/home/stahta01/devel/open_source_code/version_control/codeblocks_https_metadata-git/src/devel30/codeblocks
so codeblocks does not find its libraries...
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 11, 2017, 01:06:22 am
Thank you for the report.
What happens if you start the debugger?

The build log window flashes and that is the only thing I can see that happens.
It looks like it was cleared and the the text re-displayed; but, I have never really used the debugger under Linux so might just be an debugger configuration error.

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 13, 2017, 02:08:45 am
I am thinking using the below command in the wizard is a bad idea, does anyone agree?
Code
`pkg-config --cflags codeblocks`

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on May 13, 2017, 06:06:48 pm
Why do you think it is bad idea?
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 13, 2017, 07:40:56 pm
Why do you think it is bad idea?

1. The CB Projects does not use that method.
2. That method is broken in the Debian installed CB
3. The only way to get it to work is to self build Code::Blocks using configure/make

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: Jenna on May 13, 2017, 08:20:25 pm
Why do you think it is bad idea?

1. The CB Projects does not use that method.
The C::B project can not use it, because it creates the necessary (*.pc) files, but the wizard-created plugins have to use an installed codeblocks(-devel).
But to use it in self-compiled C::B's it might be easier and more flexible to use a global variable.

2. That method is broken in the Debian installed CB
Is it broken in our Debian-files or in the packages from the Debian repo ?

3. The only way to get it to work is to self build Code::Blocks using configure/make
It seems to work with my Fedora (nightly-)packages, so it must be broken in some way on Debian.
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 13, 2017, 08:26:50 pm
Why do you think it is bad idea?

1. The CB Projects does not use that method.
The C::B project can not use it, because it creates the necessary (*.pc) files, but the wizard-created plugins have to use an installed codeblocks(-devel).
But to use it in self-compiled C::B's it might be easier and more flexible to use a global variable.

2. That method is broken in the Debian installed CB
Is it broken in our Debian-files or in the packages from the Debian repo ?

Using the packages from the Debian repo, I believe it does NOT work. No codeblocks.pc files is installed.
I will have to use my dual Linux boot to confirm this; I am building something that will take a few hours before I can reboot.

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: Jenna on May 13, 2017, 08:38:41 pm
Using the packages from the Debian repo, I believe it does NOT work. No codeblocks.pc files is installed.
I will have to use my dual Linux boot to confirm this; I am building something that will take a few hours before I can reboot.
It should be there according to the files-list of codeblocks-dev for testing:
Quote from: https://packages.debian.org/stretch/amd64/codeblocks-dev/filelist
...
/usr/lib/pkgconfig/codeblocks.pc
...
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on May 13, 2017, 10:43:37 pm
@stahta01:
If I remember correctly the new project wizard has two targets one uses the pig-config file and the other is meant to be used with a self compiled cbp based build. For the other points - if some project installs are broken then these are issues that must be reported to the respective bistro maintainers. I use the pkg-config for my personal plugins and it works fine in both centos 6 and gentoo!
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 14, 2017, 02:09:53 am
Using the packages from the Debian repo, I believe it does NOT work. No codeblocks.pc files is installed.
I will have to use my dual Linux boot to confirm this; I am building something that will take a few hours before I can reboot.
It should be there according to the files-list of codeblocks-dev for testing:
Quote from: https://packages.debian.org/stretch/amd64/codeblocks-dev/filelist
...
/usr/lib/pkgconfig/codeblocks.pc
...

Thank you, I was missing "codeblocks-dev" package; I will try the wizard and see if it works better now.

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 14, 2017, 02:11:48 am
@stahta01:
If I remember correctly the new project wizard has two targets one uses the pig-config file and the other is meant to be used with a self compiled cbp based build. For the other points - if some project installs are broken then these are issues that must be reported to the respective bistro maintainers. I use the pkg-config for my personal plugins and it works fine in both centos 6 and gentoo!

The wizard uses pkg-config for both targets; I think one of them should NOT use pkg-config codeblocks and do it using the CB contrib project way or using the CB global variable.

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: stahta01 on May 14, 2017, 03:24:24 am
Using debian built codeblocks.pc:

I had to add "-std=c++11" to get wizard to build; should this be added to the wizard or not?

Tim S.
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on June 09, 2017, 10:58:47 pm
For the record the patch from https://sourceforge.net/p/codeblocks/tickets/481/ is applied in this branch https://github.com/obfuscated/codeblocks_sf/tree/plugin_wizard
Please test and provide suggestions and further patches.

@bluehazzard: I'm not sure I like the current set of targets.
In fact I think that we need 3 or 4 targets:
1. on for linux for the codeblocks installed on the systems that uses pkg-config codeblocks
2. cross platform target for wx2.8 that uses the cb variable
3. cross platform target for wx3.0 that uses the cb variable
4. optional - and another one for wx3.1

This way a plugin developer can test his/her plugin against all versions of codeblocks and the setup will be relatively easy.

I'm not sure that I like the sandbox notifications for the new copy scripts used for copying dlls. Can't we output the file directly where it will be used?

@jens: Do you think it will be a good idea to modify pkg-config codeblocks to return compiler/linker flags related to the proper wxgtk that should be used? This way a plugin will always be build with the correct wxgtk library.

Title: Re: Patch to CB Plugin Wizard.
Post by: BlueHazzard on June 10, 2017, 12:18:14 pm
Quote
2. cross platform target for wx2.8 that uses the cb variable
3. cross platform target for wx3.0 that uses the cb variable
is a cross platform project even possible?
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on June 10, 2017, 06:54:39 pm
Bleh... I've not meant cross platform as working on both windows and linux.
I've wanted to write "target that installs inside the build folder of codeblocks".

I have some fixes which will make it possible to build and debug the plugin on linux...
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on June 11, 2017, 04:35:01 pm
I've pushed two more commits to the branch. I think the wizard now works well on linux. Someone should test and do modifications that make windows work as well.

What I've done:
1. Make only the default target to use the supplied wxversion option
2. Create two targets to_codeblocks_wx28 and wx30. They use hardcoded wx-config --version commands, because they are targeting specific version of CB. Also don't use `pkg-config codeblocks` for them, only for the default target. Instead use paths inside the cb folder.
3. Change the objs folder.
4. Remove the IO.Copy. I don't like it, because every time it asks for permissions, if there are errors it doesn't print anything in the log and lastly we can output the file where it is supposed to go.
5. Add no-undefined and --no-ipc flags.
6. Add All target that can be used to build everything in one go.

So please test and patches welcome...

Edit: See the attached for the project that is generated on linux with the changed version of the wizard.
Title: Re: Patch to CB Plugin Wizard.
Post by: BlueHazzard on June 14, 2017, 01:17:45 am
Ok, i tested the windows script of the plugin.
Here some things i found:
1) On windows the to_codeblocks28 and to_codeblocks30 does not work with this configuration, because both builds use the "wx" global variable for the wx library path. So for the to_codeblocks30 there is a global variable with the name "wx30" needed and used for the library and include search paths
2) Same for the library path to the codeblocks library. Now it is "$(#cb)\devel" for both targets, but it should be "$(#cb)\devel" for "to_codeblocks28" and  "$(#cb)\devel30" for "to_codeblocks30"

I see that the correct libraries and paths are used if i select a other wx configuration. So The question is how should this be handled? Simply do not make a choose between different wx configuration and use all targets?

In general all seems to work. I can build, run and debug the generated projects
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on June 14, 2017, 09:21:03 am
For to_codeblocks_wx28 and wx30 the choice of wx should not matter. They should use the correct variables, which are the same used for the version of cb that is targeted. The choice of wx should be important only for the default target.
Title: Re: Patch to CB Plugin Wizard.
Post by: BlueHazzard on June 21, 2017, 12:03:20 am
Ok, i made a pull request https://github.com/obfuscated/codeblocks_sf/pull/7

A other thing to add would be the possibility to import a existing plugin, or to create a empty plugin, for the platform, so that it gets easy to import a existing plugin project from a other target system.
The easiest way would be to simply create a empty project with all needed compiler settings but no files. The user can then import all the files he needs at once.

any thoughts on this?
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on June 21, 2017, 01:16:07 am
any thoughts on this?
I'm not sure what problem you have in mind.
We need a way to add targets to existing projects, but I think we have more serious problems to tackle.
Creating plugin project is not something cb users do everyday.
Title: Re: Patch to CB Plugin Wizard.
Post by: BlueHazzard on June 21, 2017, 01:54:10 pm
Quote
I'm not sure what problem you have in mind.
I want to create a plugin for msw and unix. So i start on the msw system and create a project with the wizard. Now i have to bring this to the unix system. The current way is either to
1) Create a plugin with the same name, and parameter and copy the project file to the msw project
2) Copy a project file from a other plugin and modify it until it fits the project
3) Copy the msw project file and modify it until it is usable under linux

All this ways are not ideal. And if we work on the plugin script i would at least to try it to fix this issue. I know there are 1000 other parts to work on, but lets finish one thing an make it usable for the end user....

I think, with the current implementation of the script binding it is not possible to read a project file and extract all needed information (name of the project, name of the output files) to create a project by using a base project from a other platform. But to make things a bit easier we could simply add a option, that does not generate any source files, just the empty project with all the needed compiler and linker flags and paths. This is quite easy to implement and i think it helps a lot, if we put a bit of documentation in it. (i know... no one reads the documentation). The only needed options are the name of the plugin and the wxVersion. All other steps can be skiped (like the kind of the plugin, or the name of the author and so on)

So the final steps would look like this:
1) Create a plugin project on msw
2) Copy the plugin project to the unix system
3) Create a empty unix plugin project in the same folder as the msw project. The wizard will only ask for the plugin name and wx version...
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on June 21, 2017, 08:20:55 pm
I don't think this is a good idea.
We can try to implement the File -> New -> Target (which calls the SetupTarget function) and this might be a bit better.
The other option is to just create all targets for both windows and linux in on go...
The problems is that we will always have a target named "default".
Title: Re: Patch to CB Plugin Wizard.
Post by: oBFusCATed on June 21, 2017, 08:34:15 pm
All changes have been committed. If you do further changes please rebase you branch on master/trunk and provide patches against that branch.