Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Alpha on September 02, 2011, 02:53:23 am
-
I have written a plugin that will export the active project as a premake 4 (http://industriousone.com/premake) 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 (http://www.bakefile.org/index.html) 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 (https://skydrive.live.com/self.aspx/Public/ProjectExporter.7z?cid=5183ac017415bf92&sc=documents) Bakefile support added; GUI cut down to be reasonable; several minor fixes in project reading
v0.2 (https://skydrive.live.com/self.aspx/Public/ExportProject-3.7z?cid=5183ac017415bf92&sc=documents) GUI drafted; upgrade targets to projects option; evaluate variables option; language detection.
v0.1.1 (http://ngcoding.tech.officelive.com/Documents/ExportProject-2.7z) fixed crash on restart.
Here (http://ngcoding.tech.officelive.com/Documents/ExportProject.7z) (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 (http://forums.codeblocks.org/index.php/topic,13675.0.html).
-
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.
-
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)?
-
Autotools of course :)
-
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.
-
You can start with this http://www.flameeyes.eu/autotools-mythbuster/ and then the manual of autotools (automake/autoconf,etc)
-
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.)
-
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.
-
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.
-
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?)
-
Once I know that gcc can generate a include files dependency. see:
c++ - Tool to track #include dependencies - Stack Overflow (http://stackoverflow.com/questions/42308/tool-to-track-include-dependencies)
and:
2.7 Automatic Dependency Generation (http://www.makelinux.net/make3/make3-CHP-2-SECT-7)
-
I think that depslib does this, check the source it is in svn.
-
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 :).)
-
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.)
-
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 (http://code.google.com/p/include-what-you-use)
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 (http://llvm.org/docs/ReleaseNotes.html) page.
-
I just see some other good tools:
include-what-you-use (http://code.google.com/p/include-what-you-use)
That looks to be a very powerful tool (in progress), but I think it is a bit of overkill for my purposes (aiding pseudo-detection of used libraries). I have ended up (currently) using a regex to scan the files.
-
At work, I had to provide a Premake build script today and tried this plugin. It works pretty well from what I see. Are you still working on this?
If you have no own repository, I would like to integrate this into the official C::B repo. Would that be OK? Hence I would need some help (if you are willing) to adopt the Linux build system and the Linux project file. Did you ever try this on Linux?
-
Yes, I am still working on this, however, I have been very busy with studies, and lacked the time to finish a working Autotools export (which is what I was waiting for before posting the next version).
I do not have my own repository, so that would be great if you could include it in Code::Blocks' repository. Unfortunately, I do not currently have easy access to a Linux computer, so it is untested there.
(If it is integrated, the ProjectsImporter plugin should probably be patched to be made aware of this plugin, so the menu building hack in this plugin can be removed.)
My current code (0.3a (https://skydrive.live.com/redir.aspx?cid=5183ac017415bf92&resid=5183AC017415BF92!131&parid=5183AC017415BF92!123&authkey=!)) contains minor tweaks to Premake, decent accuracy improvement for Bakefile, and preliminary Autotools code (not yet functional).
(Glad to hear that it works.)
-
Attached is my initial attempt at integration with the build systems. I am sure I have missed something, but at least it should help (I hope).