Re: [anjuta-list] How to: Configure multiple compile targets



On Friday, 26 October, 2012 07:48 AM, bsquared wrote:
Unfortunately, I have not got it compiling in Anjuta yet.  I must have
missed something, but I'll keep on as It does compile via command line
if I set the PKG_CONFIG_PATH and add "'--cc=i686-w64-mingw32-gcc' '-o
gtk_win32_test.exe'". ie.
  export PKG_CONFIG_PATH=/opt/gtk/win32/lib/pkgconfig
  valac --cc=i686-w64-mingw32-gcc --pkg gtk+-2.0 -o hello-world.exe hello-world.vala
Anjuta usually uses Autotools to compile Vala projects. By default, Automake only uses valac to compile Vala sources to C sources. Then gcc is used to compile them into executables. If that's the case, there is no necessary additional options to pass to configure.

If you're directly compiling Vala sources to executables, and you're using Automake, you need to add "--cc=$(CC)" to a target's VALAFLAGS.

for example:

bin_PROGRAMS = mobilect-payroll

mobilect_payroll_SOURCES = \
    main/mobilect-payroll.vala \
    main/application.vala \
    main/window.vala \
    (...)

mobilect_payroll_VALAFLAGS =  \
    --vapidir=$(top_srcdir)/vapi \
    --pkg gtk+-3.0 \
    --pkg gdk-3.0 \
    --pkg glib-2.0 \
    --pkg gobject-2.0 \
    --pkg pango \
    --pkg cairo \
    --pkg pangocairo \
    --pkg libxml-2.0 \
    --pkg libgda-5.0 \
    --pkg $(GEE_MODULE) \
    --debug \
    --cc=$(CC)

(etc.)

This is because valac is only used by Automake to create C source files; Automake doesn't pass the CC variable (which contains the name of the C compiler) to valac.
I wonder though, Is it not possible to use a 'Target' rather than a
'Configuration'?  
Targets are "Configuration-wide". This is because the target also affects other things that happen while compiling (e.g. additional linker options to use, file name extension for executables and libraries to use, etc.), so it is not possible to separate them (in Autotools, at least).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]