Author Topic: Project Exporter Plugin  (Read 13752 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Project Exporter Plugin
« on: September 02, 2011, 02:53:23 am »
I have written a plugin that will export the active project as a premake 4 script.  Premake has the ability to generate multiple IDE project files and makefiles, so if proper Premake support is achieved, Code::Blocks will in essence be able to export to all of them.
  • Now supports Bakefile export as well.
  • Currently, this plugin generates all of the basic components, drastically reducing the time required to create a new build system, however, some modification of the output is often required.
  • Note that the Project Exporter plugin will overwrite files (in the case of a conflict) without notification.

v0.3 Bakefile support added; GUI cut down to be reasonable; several minor fixes in project reading

v0.2 GUI drafted; upgrade targets to projects option; evaluate variables option; language detection.

v0.1.1 fixed crash on restart.
Here (v0.1) is the initial source code.

Known problems/To-Do's:
  • C language projects are detected, but Premake4 generated makefiles do not compile - Does anyone know why?  I looked at the makefiles and they looked like they should work.
  • Prebuild steps are ignored during Bakefile export
  • Parsing of global variables during Bakefile export sometimes yields invalid Bakefiles
  • Continue adding detection of more properties of Code::Blocks projects (especially dependencies)
  • Add workspace recognition

Note: if you are looking for mature makefile generation, see cbp2make.
« Last Edit: November 15, 2011, 11:42:12 pm by Alpha »

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #1 on: September 05, 2011, 03:15:15 am »
Version 0.2 released.  Please note that although the dialog has many options, only the first two are implemented (the others will do nothing).  Also, the dialog is likely to be completely changed in the next version.

Switched hosting to SkyDrive (sorry, to download, you will need to click twice instead of just once; however, the files should not go offline at the end of the year now).

Does anyone have enough knowledge with premake/makefiles to tell me why C projects do not compile?  Thanks.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #2 on: November 08, 2011, 12:57:24 am »
Version 0.3 released.  This release adds preliminary Bakefile support.  (If you decide to look at the code for this section, be warned that it is quite messy at the moment.)

The Premake options dialog now is condensed to the few essentials.

Does anyone have a favorite build system they would like me to look into next (when I have time)?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Project Exporter Plugin
« Reply #3 on: November 08, 2011, 01:12:10 am »
Autotools of course :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #4 on: November 08, 2011, 11:33:14 pm »
OK, I will see what I can do (this may be a bit more complicated...).

Do you have any suggested reading?  Most of my experience with Autotools has been only what I needed to use through MSYS.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Project Exporter Plugin
« Reply #5 on: November 09, 2011, 01:25:22 am »
You can start with this http://www.flameeyes.eu/autotools-mythbuster/ and then the manual of autotools (automake/autoconf,etc)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #6 on: November 15, 2011, 11:56:05 pm »
oBFusCATed, I have done a lot of Autotools reading (from the page you provided, the manuals, and multiple pages search engines have brought up), and begun work on creation of this system.  Would it be possible for you (or someone) to post/send me an example configure.ac + makefile.am that could be used to build a small Code::Blocks plugin (like this one)?
I believe having this example of something more complex than the standard "hello world", but still extremely small (only a few files in a single directory) will greatly speed my learning (and give me an example of what a well formatted script should look like).  (I have looked through Code::Blocks' Autotools build system, but it is extremely large and interdependent, making it a difficult place to start.)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Project Exporter Plugin
« Reply #7 on: November 16, 2011, 09:38:00 am »
You can try these two:
svn://smrt.is-a-geek.org/cb_gdb_mi/debbugger_gdbmi
svn://smrt.is-a-geek.org/cb_editor_navigation/

Both have working Autotools systems and both are made after reading the link I've posted.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #8 on: November 16, 2011, 11:20:11 pm »
Thank you very much; I have checked out their sources, and they look to be quite helpful in my learning of Autotools and designing of the exporter.
« Last Edit: November 16, 2011, 11:22:13 pm by Alpha »

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #9 on: November 20, 2011, 05:48:17 am »
Does anyone know if there is a function in Code::Blocks that I can call to acquire a list of all the files that are #included?  (Or is do I need to write a function to parse the source files myself?)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Project Exporter Plugin
« Reply #10 on: November 20, 2011, 05:54:45 am »
Once I know that gcc can generate a include files dependency. see:
c++ - Tool to track #include dependencies - Stack Overflow

and:

2.7 Automatic Dependency Generation
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12129
    • Travis build status
Re: Project Exporter Plugin
« Reply #11 on: November 20, 2011, 11:19:01 am »
I think that depslib does this, check the source it is in svn.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #12 on: November 20, 2011, 08:37:34 pm »
Thank you both; I will look to see which option fits my needs.

(By the way, I just managed to compile Code::Blocks with a makefile generated from a Bakefile exported by this plugin :).)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Project Exporter Plugin
« Reply #13 on: November 21, 2011, 06:30:15 pm »
Should the Autotools section of this plugin be dependent on autoscan?
Autoscan already has many of rules for determining which macros should be included.  I am not sure if it would be wise for me to spend a lot of time to attempt to replicate this functionality.

I am considering having this plugin set up everything except for the detection macros autoscan produces; for these, it would read the configure.scan, if it is available, and insert them in the relevant parts.  (The files would still be created if there was no configure.scan, however they would contain a message warning that the user must run autoscan first if they want additional detection macros.)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Project Exporter Plugin
« Reply #14 on: November 22, 2011, 10:16:38 am »
Thank you both; I will look to see which option fits my needs.

(By the way, I just managed to compile Code::Blocks with a makefile generated from a Bakefile exported by this plugin :).)

I just see some other good tools:
include-what-you-use
Quote
include-what-you-use is a tool to ensure that a file directly #includes all .h files that provide a symbol that the file uses. It also removes superfluous #includes from source files.

In the LLVM 3.0 Release Notes page.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.