Author Topic: How to add a special purpose compiler?  (Read 4771 times)

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
How to add a special purpose compiler?
« 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++?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(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 ouch

  • Almost regular
  • **
  • Posts: 223
Re: How to add a special purpose compiler?
« Reply #2 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.
« Last Edit: December 30, 2013, 10:18:25 pm by ouch »

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: How to add a special purpose compiler?
« Reply #3 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


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.
« Last Edit: December 30, 2013, 11:21:44 pm by cacb »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7602
    • My Best Post
Re: How to add a special purpose compiler?
« Reply #4 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.
« Last Edit: December 31, 2013, 12:01:40 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to add a special purpose compiler?
« Reply #5 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.
(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 cacb

  • Lives here!
  • ****
  • Posts: 536
Re: How to add a special purpose compiler?
« Reply #6 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

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: How to add a special purpose compiler?
« Reply #7 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