Author Topic: Advice please on mixed languages  (Read 11560 times)

Offline johne53

  • Regular
  • ***
  • Posts: 253
Advice please on mixed languages
« on: September 14, 2007, 01:28:50 pm »
I'd like to compile a Linux Shared Object for which I have the source code. Almost all the modules are in C++ - except for one module which is x86 assembly code. This one module needs to be compiled with different compiler settings from the C++ stuff - but ultimately, it needs to end up in the same Shared Object. What is the best way of organising this within C::B? Is it possible to create a project with mixed languages and have different compiler settings for the assembly module? Or should I put the assembly module into its own separate branch? If I were to put it into its own separate branch, how would I then tell C::B to include that branch's object code when linking the main branch?

Hope that makes sense.....  :)

mariocup

  • Guest
Re: Advice please on mixed languages
« Reply #1 on: September 14, 2007, 01:45:58 pm »
Hi,

you can use own settings for assembler files. Select assembler file in the project view and select context menu properties then follow the steps described in (see http://codeblocks.org/manual.shtml)


Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Advice please on mixed languages
« Reply #2 on: September 14, 2007, 06:12:41 pm »
Thanks. I followed the instructions but I don't seem to have a 'buildable' file (in other words, if I right-click on the file I don't see any 'build' option in the popup menu.

This source file happens to have the extension ".s"  Is that normal for an assembly language source under Linux? I'm used to seeing Microsoft's ".asm" extension.  Could it be the extension that's causing this file to be unrecognised....  :?

mariocup

  • Guest
Re: Advice please on mixed languages
« Reply #3 on: September 14, 2007, 10:00:39 pm »
Hi,

select the file name.s in the project view and select properties from the context menu. Then use tab build and check compile file and link file. Then select tab advanced and check use custom command to build file.
Add entry

$compiler $options <asmopts> $includes -c $file -o $object

and replace it <asmopts> by your assembler options.

If it does not work, please attach your project file.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Advice please on mixed languages
« Reply #4 on: September 14, 2007, 11:33:37 pm »
Thanks. AFAIK, those are the options that I already tried when I followed the instruction manual. However, there's still no build option in the popup menu. I've attached the CBP project and my C::B version details are below, in case that helps.

svn build rev 4349 (2007-08-05 14:35:58) gcc 4.1.2 Linux/unicode

P.S. I had to change the project's extension to ".txt" because ".cbp" isn't allowed

[attachment deleted by admin]

mariocup

  • Guest
Re: Advice please on mixed languages
« Reply #5 on: September 15, 2007, 01:12:30 pm »
Hi johne53,

you can not set Build options for assembler files using the project properties. The only way to set different options from the project settings, to select a file and can the properties in the way that you have already done. If you need to set a list of assembler options just define a customer variable asmopts in your project and use as special command.

$compiler $asmopts $includes -c $file -o $object

I do not understand why you want to get build option popup menu. Do you mean the project properties/build options????

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Advice please on mixed languages
« Reply #6 on: September 15, 2007, 02:04:07 pm »
Thanks Mariocup. I might not be describing my requirement very well. What I mean is this.... let's say I open a workspace - within which are several projects. On the left-hand side of C::B I can then select any project where I can then see its Source files, Header files and Other files. If I now right-click on a source file, a menu appears with these options:- Open / Open With / Rename file / Remove file from project / Build file / Properties. This is the menu that I usually use for building a single source module (the same as CTRL+SHIFT+F9).

However, with this particular source file, the options offered are:- Open / Open With / Rename file / Remove file from project / Properties (note: there is no option to Build file). I hope that makes it a bit clearer....  :)

mariocup

  • Guest
Re: Advice please on mixed languages
« Reply #7 on: September 16, 2007, 12:04:11 am »
Hi johne53,

ok now I understand. Since a few weeks, assembler sources are listed under the Resource ASM Sources and if you select a assembler file e.g name.s you get the entry build file in the context menu, but this works only after a cleanup. The file types and the the type of resources are saved in the configuration file default.conf. So if you want to get ASM Sources entries in the project view and the correct context menu do the following steps:
Copy the default.conf to default.conf.org (Home directory .codeblocks or APPDATA under windows). Start codeblocks and test if your assembler file is listed under ASM Sources and if you have the context menu entry: build file.

Another possibility to restore your settings after renaming default.conf is using the application cb_share_console, which is useful to get settings from a configuration file and save them to a new one.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Advice please on mixed languages
« Reply #8 on: September 16, 2007, 11:12:23 am »
Another possibility to restore your settings after renaming default.conf is using the application cb_share_console, [...]
I guess you mean cb_share config. ;-)
Anyway - anther possibility is to to the following:
- open C::B
- click menu "project" -> "project tree" -> "edit filetypes and categories"
- select "Set default" and hit OK.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Advice please on mixed languages
« Reply #9 on: September 17, 2007, 12:08:29 pm »
Sorry guys, I must have missed something with those suggestions....

Since a few weeks, assembler sources are listed under the Resource ASM Sources and if you select a assembler file e.g name.s you get the entry build file in the context menu, but this works only after a cleanup.
How long ago is "a few weeks"? My current copy is dated 5th August 2007 but even though I tried your suggestions, I couldn't make any ASM Sources appear.


Anyway - anther possibility is to to the following:
- open C::B
- click menu "project" -> "project tree" -> "edit filetypes and categories"
- select "Set default" and hit OK.
I don't have a "Set default" option in that dialog. Is it something that appeared since August 5th?

mariocup

  • Guest
Re: Advice please on mixed languages
« Reply #10 on: September 17, 2007, 12:23:13 pm »
Hi johne53,

please download a current nightly that contains support for assembler files, otherwise you can not build a single assembler file. Then backup your configuration file default.conf and delete it, so you will get a clean installation with the correct resourcses.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Advice please on mixed languages
« Reply #11 on: September 17, 2007, 12:33:21 pm »
How long ago is "a few weeks"? My current copy is dated 5th August 2007 but even though I tried your suggestions, I couldn't make any ASM Sources appear.

If you're keen to know when it got changed refer the following link.
Quote
http://svn.berlios.de/wsvn/codeblocks/?op=log&rev=0&sc=0&isdir=1

"A few weeks" means 1-2 weeks back Not 1-1.5 months back.
Be a part of the solution, not a part of the problem.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Advice please on mixed languages
« Reply #12 on: September 17, 2007, 12:36:27 pm »
Hi johne53,

please download a current nightly that contains support for assembler files
This bit, I'm happy enough to do....

Then backup your configuration file default.conf and delete it
When I tried to do that earlier, I lost all my user variables and global search paths that I'd set up. Is there a way to achieve the assembler support without losing things that have taken me weeks to set up?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Advice please on mixed languages
« Reply #13 on: September 17, 2007, 04:36:27 pm »
When I tried to do that earlier, I lost all my user variables and global search paths that I'd set up. Is there a way to achieve the assembler support without losing things that have taken me weeks to set up?

Use Share_config plugin.
Be a part of the solution, not a part of the problem.

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Advice please on mixed languages
« Reply #14 on: September 17, 2007, 06:37:05 pm »
Thanks Biplap. Is that a separate plugin that I need to download - or part of my downloaded package?

Also (slightly dumb question here....) the thread about downloading nightlies talks a lot about binary files and DLL's. In fact, it rather gives the impression that the nightlies are only relevant to the Windows version of Code::Blocks. Firstly, I assume this probably isn't true?? Secondly, I'd like to get to the stage of building C::B from source. Can Code::Blocks be downloaded as a C::B project? If so, where from?