Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: cacb on December 30, 2013, 09:48:28 pm

Title: How to add a special purpose compiler?
Post by: cacb on December 30, 2013, 09:48:28 pm
Hi,

I have been looking at Tntnet at tntnet.org (website down at the moment of writing). It has a way of creating web applications using C++, which I find interesting. Even more interesting is that you can create "stand alone" web applications that contain their own web server, it is simply a special form of C++ console application. That means it is possible to use Code::Blocks for such web development.  Tntnet has a special file type *.ecpp which compiles into *.cpp using the ecpp compiler:

Code
ecppc <filename>.ecpp  -o <filename>.cpp 

Obviously, the output *.cpp file is further compiled using the C++ compiler in the normal way. One may do this using makefiles, however, I would much prefer to use the Code::Blocks build system instead.

My question is therefore: What do I need to do in Code::Blocks to make it recognize *.ecpp files. compile them using the ecppc compiler and immediately compile/link the resulting *.cpp file using g++?
Title: Re: How to add a special purpose compiler?
Post by: oBFusCATed on December 30, 2013, 09:59:14 pm
Have you read this: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system
Title: Re: How to add a special purpose compiler?
Post by: ouch on December 30, 2013, 10:13:57 pm
Well go to settings->environment and then file extension handling and add *.ecpp
Then for the project itself, use the Pre-build section on Pre/Post build step tab to run the command to convert the .ecpp files to .cpp. This is in "project build settings".
From there whatever compiler your using should work fine as long as you remember to add any new cpp files that you create to the project.

Or you can use the advanced options in the compiler settings to add proper seamless support like oBFusCATed suggested.
Title: Re: How to add a special purpose compiler?
Post by: cacb on December 30, 2013, 11:16:04 pm
Have you read this: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

Thanks a lot! I searched around quite a bit, but obviously didn't choose the right search words!

I ended up doing this, which seems to work perfectly
(http://arnholm.org/screenshots/ecpp.png)

Notice that the dialog has a confusing description of macros, for example $file_dir is presented as $filedir, that had me fooled for a while. The Windows version of the same dialog is even more deceptive, as no underscores are shown at all. I would not have figured that out without the examples in the link you provided.

The correct path to this configuration dialog  now appears to be
Settings->Compiler->Other settings.  Look for "Advanced options" in lower right, it's easy to miss.

I did a couple of test runs with ecpp files and it really works beautifully in Code::Blocks.
Title: Re: How to add a special purpose compiler?
Post by: stahta01 on December 30, 2013, 11:35:50 pm
Have you read this: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

Thanks a lot! I searched around quite a bit, but obviously didn't choose the right search words!

I ended up doing this, which seems to work perfectly


Notice that the dialog has a confusing description of macros, for example $file_dir is presented as $filedir, that had me fooled for a while. The Windows version of the same dialog is even more deceptive, as no underscores are shown at all. I would not have figured that out without the examples in the link you provided.

The correct path to this configuration dialog  now appears to be
Settings->Compiler->Other settings.  Look for "Advanced options" in lower right, it's easy to miss.

I did a couple of test runs with ecpp files and it really works beautifully in Code::Blocks.

Please report the CB version and OS info and maybe a CB Dev will look into the display issue.

Note: I confirm the lack of Underscores in Windows 7 using CB 13.12.

Edit: I am guessing that advanced_compiler_options.xrc is the cause of the issue.


Tim S.
Title: Re: How to add a special purpose compiler?
Post by: oBFusCATed on December 30, 2013, 11:52:52 pm
The description in the dialog should be fixed in SVN HEAD. Thanks for the report.

The correct path to this configuration dialog  now appears to be
Settings->Compiler->Other settings.  Look for "Advanced options" in lower right, it's easy to miss.
Are you talking about the wiki? If you're then you can fix this yourself. To log in the wiki you can use your forum username/password.
Title: Re: How to add a special purpose compiler?
Post by: cacb on December 31, 2013, 12:18:51 am
Are you talking about the wiki? If you're then you can fix this yourself. To log in the wiki you can use your forum username/password.

Thanks, done. First time ever I edited a Wiki  ;D
Title: Re: How to add a special purpose compiler?
Post by: cacb on December 31, 2013, 12:37:01 am
Please report the CB version and OS info and maybe a CB Dev will look into the display issue.

Note: I confirm the lack of Underscores in Windows 7 using CB 13.12.

Edit: I am guessing that advanced_compiler_options.xrc is the cause of the issue.

Tim S.

On Linux Kubuntu 13.10 (amd64) I am using Code::Blocks svn 9492 built from Jens Lody's tarball
On Win7 I am using Nightly Build svn 9455