summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2008-08-10 14:39:24 +0000
committerJürg Billeter <juergbi@src.gnome.org>2008-08-10 14:39:24 +0000
commit8552a486802fe4c15d7abfaaf24fb72e66aec730 (patch)
treec72dceabb1df84098103dec20b9c41b4c3d69cba /compiler
parentf4b41fad825f0440206318edb24f9f40c6eccfe1 (diff)
downloadvala-8552a486802fe4c15d7abfaaf24fb72e66aec730.tar.gz
Add --target-glib command-line option, default to 2.12, based on patch by
2008-08-10 Jürg Billeter <j@bitron.ch> * vala/valacodecontext.vala: * gobject/valaccodeclassbinding.vala: * gobject/valaccodeinterfacebinding.vala: * gobject/valaclassregisterfunction.vala: * gobject/valainterfaceregisterfunction.vala: * gobject/valatyperegisterfunction.vala: * compiler/valacompiler.vala: Add --target-glib command-line option, default to 2.12, based on patch by Jared Moore, fixes bug 544990 svn path=/trunk/; revision=1746
Diffstat (limited to 'compiler')
-rw-r--r--compiler/valacompiler.vala14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index b806244e6..69da0b355 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -34,6 +34,7 @@ class Vala.Compiler : Object {
static string library;
[NoArrayLength ()]
static string[] packages;
+ static string target_glib;
static bool ccode_only;
static bool compile_only;
@@ -75,6 +76,7 @@ class Vala.Compiler : Object {
{ "Xcc", 'X', 0, OptionArg.STRING_ARRAY, ref cc_options, "Pass OPTION to the C compiler", "OPTION..." },
{ "save-temps", 0, 0, OptionArg.NONE, ref save_temps, "Keep temporary files", null },
{ "quiet", 'q', 0, OptionArg.NONE, ref quiet_mode, "Do not print messages to the console", null },
+ { "target-glib", 0, 0, OptionArg.STRING, ref target_glib, "Target version of glib for code generation", "MAJOR.MINOR" },
{ "", 0, 0, OptionArg.FILENAME_ARRAY, ref sources, null, "FILE..." },
{ null }
};
@@ -168,6 +170,18 @@ class Vala.Compiler : Object {
context.thread = thread;
context.save_temps = save_temps;
+ int glib_major = 2;
+ int glib_minor = 12;
+ if (target_glib != null && target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
+ Report.error (null, "Invalid format for --target-glib");
+ }
+
+ context.target_glib_major = glib_major;
+ context.target_glib_minor = glib_minor;
+ if (context.target_glib_major != 2) {
+ Report.error (null, "This version of valac only supports GLib 2");
+ }
+
if (defines != null) {
foreach (string define in defines) {
context.add_define (define);