User forums > Using Code::Blocks

Vala language

(1/3) > >>

epsilon_da:
Hi.
I like proramming portable applications in GTK with Codeblocks and someday i would like to try Vala.
So, ¿Is there any support for Vala planned?


epsilon_da:
Vala is a new multiplatform compiler similar to C# based on GObject.
It is quickly growing and is being adopted by many GNOME projects.

It can also generate Code in C using GLib objects.

http://live.gnome.org/Vala

Sadly i cant find a way to setup it as a Compiler, because it is not a classical C compiler.
It can do many tasks:

 - Generate C/GLib Code, for libraries, clases, or the entire app, and be completely usable from C.
 - Compile the entire Vala project.
 - Compile directly without linking.
 - Handle dependencies when posible.

If i set as a C and C++ compiler "valac" then i get the next message:

"Linking stage skipped (build target has no object files to link)
Nothing to be done."

I think that CB is not calling the compiler properly.

To compile an entire Vala Project execute the next command:
  valac -o output main.vala file1.vala file2.vala ... -pkg dependency1-1.0 dependency2-1.0 ...
And this will compile the entire project. So there is not much to do more than having 3 variables:
  $output_name
  $vala_file_list
  $vala_dependency_list

then
  valac -o $output_name $vala_file_list -pkg $vala_dependency_list

But i dont know how to automate this process in codeblocks.



In a GTK project could also be useful to convert a class implemented in Vala in a .c/.h pair to be used from the C project.
  valac -C myclass.vala --directory ./myclass/ -H ./myclass/myclass.h

This can be done in "Pre build steps" but the result files, should be compiled by codeblocks, and so, added to the project before compiling, but should not be directly edited because will be overwriten by valac.


There are a few IDEs being developed for Vala. But any of them are close to CodeBlocks.
CB could make an step forward in the next version and easily add the Vala compiler and projects.

dmoore:
quick response. have you looked at: http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

epsilon_da:
Thanks dmoore.

Yes that wiki page would be what i was finding.
I always find this wikis a total mess. ^^

But i have 2 questions.

 - There isnt any macro definning a space separated list of source files. Only for objects. Vala compilates the entire project without the need to handle object files with an IDE.
The command should be like:
  $compiler $libdirs $libs -o $exe_output $sources_files
where $libdirs, is a list of paths prepended with --vapidir and $libs is a list of vala libs without writing the extension (.vapi) and prepended by --pkg , and $sources_files is a space-separated list of vala files.
That will produce the final output file, but "compiler" gets executed for each file, which is not valid in this case for vala.
I also tryed to configure it as a linker, but linker seems to require the existence of object files.
How can i tell codeblocks that it should take each $file as a $link_object on the "compiler" part.(Append each .vala to the link_objects list without generating new files)
And then use valac as a linker with all this files.

 - The second question, is that if i use valac to generate C code instead of as a compiler, i would need to change the configuration of "GNU GCC Compiler" is there a better project-portable solution?
Any way, this is the least critical part. I can just place the instructions in "pre build steps", but the generated file would need to be manually added to the project.


epsilon_da:
Or i can make a build script:

function SetBuildOptions(base) // base = target
{

ShowMessage( base.GetOutputFilename() );

project = GetProjectManager();
GetCompilerFactory

if ( ! IO.DirectoryExists( base.GetOutputFilename() ) )
   IO.CreateDirectory( base.GetOutputFilename(), 777 );

vala_cmd <- _T("valac -o "+ base.GetOutputFilename()+" main.vala hello.vala");

Log( IO.ExecuteAndGetOutput ( vala_cmd ) );

}


The problem here is that the Output filename is not the setted in the project.
The message dialog will show "output", but the output filename is set to bin/Debug-Unix/output

I cant find any ther function to define, except for "SetBuildOptions".
Is there any other or a way to get the correct Options in the project?

Navigation

[0] Message Index

[#] Next page

Go to full version