2 write meson build so that the language server works..
7 public class Meson : Object {
10 public Meson(Gtk project)
12 this.project = project;
18 var project_name = this.project.name;
19 var project_version = "1.0"; //this.project.version;
20 var project_licence = "LGPL"; // this.project.licence
23 foreach(var p in this.project.packages) {
25 deps += " valac.find_library('" + p + "'),\n";
27 deps += " dependency('" + p + "'),\n";
31 dependency('glib-2.0'),
32 dependency('gobject-2.0'), << for others.. ut will this wrok using find_lib for all?
33 valac.find_library('posix'), << for posix
36 // ?? why use subdir ?? seems pointless?
41 foreach(var p in this.project.vapidirs()) {
42 addvapidir += "add_project_arguments(['--vapidir', meson.current_source_dir() / '" + p + "'], language: 'vala')\n";
44 //vapi_dir = meson.current_source_dir() / 'vapi'
45 //add_project_arguments(['--vapidir', vapi_dir], language: 'vala')
50 foreach(var cg in this.project.compilegroups.values) {
51 targets += this.addTarget(cg);
52 icons += this.addIcons(cg);
53 desktops += this.addDesktop(cg);
57 @"project('$project_name', 'vala', 'c',
58 version: '$project_version',
59 license: '$project_licence',
61 'default_library=static',
62 'c_std=gnu11' # for C subprojects
66 valac = meson.get_compiler('vala')
68 extra_vala_sources = []
76 # let Vala add the appropriate defines for GLIB_X_X
77 add_project_arguments(['--target-glib=auto'], language: 'vala')
81 conf = configuration_data()
82 conf.set('PROJECT_NAME', meson.project_name())
93 GLib.debug("write meson : %s" , data);
94 // removed.. add_project_arguments(['--enable-gobject-tracing', '--fatal-warnings'], language: 'vala')
97 FileUtils.set_contents(this.project.path + "/meson.build", data, data.length);
98 } catch (GLib.Error e) {
99 GLib.error("failed to save file %s", e.message);
104 string addTarget(GtkValaSettings cg)
107 var str = cg.name + "_src = files([\n";
108 foreach(var s in cg.sources) {
109 var f= this.project.getByPath(this.project.path + "/" + s);
113 var add = f.relTargetName();
114 if (add.length > 0) {
115 str += " '" + add + "',\n";
120 str += cg.name +" = executable('" + cg.name + "',\n"+
121 " dependencies: deps,\n"+
122 " sources: [ " + cg.name + "_src ],\n"+
129 string addIcons(GtkValaSettings cg)
133 string[] sizes = { "16x16", "22x22","24x24","32x32", "48x48" } ;
134 foreach(var size in sizes) {
135 GLib.debug("looking for on : %s" , "pixmaps/" + size + "/apps/" + cg.name + ".png");
136 var img = this.project.getByRelPath( "pixmaps/" + size + "/apps/" + cg.name + ".png");
140 var path = img.relpath;
144 install_dir: get_option('datadir') + '/icons/hicolor/$size/apps/'
152 gnome = import('gnome')
153 gnome.post_install(gtk_update_icon_cache : true)
158 string addDesktop(GtkValaSettings cg)
160 // we could actually generate this!?!
161 var d = this.project.getByRelPath( cg.name + ".desktop");
165 var path = d.relpath;
169 install_dir : get_option('datadir') + '/applications/''