Add some debugging code for mouse drags.
[ardour.git] / gtk2_ardour / wscript
1 #!/usr/bin/env python
2 import autowaf
3 import os
4 import glob
5 import Options
6 import sys
7 import TaskGen
8 import re
9
10 # Version of this package (even if built as a child)
11 MAJOR = '3'
12 MINOR = '0'
13 MICRO = '0'
14 GTK2_ARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
15
16 # Variables for 'waf dist'
17 APPNAME = 'gtk2_ardour'
18 VERSION = GTK2_ARDOUR_VERSION
19
20 # Mandatory variables
21 srcdir = '.'
22 blddir = 'build'
23
24 path_prefix = 'gtk2_ardour/'
25
26 gtk2_ardour_sources = [
27         'about.cc',
28         'actions.cc',
29         'add_midi_cc_track_dialog.cc',
30         'add_route_dialog.cc',
31         'analysis_window.cc',
32         'ardour_dialog.cc',
33         'ardour_ui.cc',
34         'ardour_ui2.cc',
35         'ardour_ui_dependents.cc',
36         'ardour_ui_dialogs.cc',
37         'ardour_ui_ed.cc',
38         'ardour_ui_mixer.cc',
39         'ardour_ui_options.cc',
40         'audio_clock.cc',
41         'audio_region_editor.cc',
42         'audio_region_view.cc',
43         'audio_streamview.cc',
44         'audio_time_axis.cc',
45         'automation_controller.cc',
46         'automation_line.cc',
47         'automation_region_view.cc',
48         'automation_streamview.cc',
49         'automation_time_axis.cc',
50         'axis_view.cc',
51         'bundle_manager.cc',
52         'cairo_widget.cc',
53         'canvas-flag.cc',
54         'canvas-hit.cc',
55         'canvas-note-event.cc',
56         'canvas-note.cc',
57         'canvas-program-change.cc',
58         'canvas-simpleline.c',
59         'canvas-simplerect.c',
60         'canvas-sysex.cc',
61         'canvas-waveview.c',
62         'configinfo.cc',
63         'control_point.cc',
64         'control_point_dialog.cc',
65         'crossfade_edit.cc',
66         'crossfade_view.cc',
67         'curvetest.cc',
68         'debug.cc',
69         'diamond.cc',
70         'edit_note_dialog.cc',
71         'editing.cc',
72         'editor.cc',
73         'editor_actions.cc',
74         'editor_audio_import.cc',
75         'editor_audiotrack.cc',
76         'editor_canvas.cc',
77         'editor_canvas_events.cc',
78         'editor_component.cc',
79         'editor_cursors.cc',
80         'editor_drag.cc',
81         'editor_route_groups.cc',
82         'editor_export_audio.cc',
83         'editor_group_tabs.cc',
84         'editor_keyboard.cc',
85         'editor_keys.cc',
86         'editor_locations.cc',
87         'editor_markers.cc',
88         'editor_mixer.cc',
89         'editor_mouse.cc',
90         'editor_nudge.cc',
91         'editor_ops.cc',
92         'editor_regions.cc',
93         'editor_routes.cc',
94         'editor_rulers.cc',
95         'editor_scrub.cc',
96         'editor_selection.cc',
97         'editor_snapshots.cc',
98         'editor_summary.cc',
99         'editor_tempodisplay.cc',
100         'editor_timefx.cc',
101         'engine_dialog.cc',
102         'enums.cc',
103         'export_channel_selector.cc',
104         'export_dialog.cc',
105         'export_file_notebook.cc',
106         'export_filename_selector.cc',
107         'export_format_dialog.cc',
108         'export_format_selector.cc',
109         'export_preset_selector.cc',
110         'export_timespan_selector.cc',
111         'fft.cc',
112         'fft_graph.cc',
113         'fft_result.cc',
114         'gain_meter.cc',
115         'generic_pluginui.cc',
116         'ghostregion.cc',
117         'global_port_matrix.cc',
118         'group_tabs.cc',
119         'gtk-custom-hruler.c',
120         'gtk-custom-ruler.c',
121         'gtk_pianokeyboard.c',
122         'insert_time_dialog.cc',
123         'interthread_progress_window.cc',
124         'io_selector.cc',
125         'keyboard.cc',
126         'keyeditor.cc',
127         'latency_gui.cc',
128         'led.cc',
129         'level_meter.cc',
130         'lineset.cc',
131         'location_ui.cc',
132         'main.cc',
133         'marker.cc',
134         'midi_automation_line.cc',
135         'midi_channel_selector.cc',
136         'midi_cut_buffer.cc',
137         'midi_list_editor.cc',
138         'midi_port_dialog.cc',
139         'midi_region_view.cc',
140         'midi_scroomer.cc',
141         'midi_streamview.cc',
142         'midi_time_axis.cc',
143         'midi_tracer.cc',
144         'mixer_group_tabs.cc',
145         'mixer_strip.cc',
146         'mixer_ui.cc',
147         'monitor_section.cc',
148         'nag.cc',
149         'option_editor.cc',
150         'opts.cc',
151         'panner.cc',
152         'panner2d.cc',
153         'panner_ui.cc',
154         'piano_roll_header.cc',
155         'playlist_selector.cc',
156         'plugin_eq_gui.cc',
157         'plugin_selector.cc',
158         'plugin_ui.cc',
159         'port_group.cc',
160         'port_insert_ui.cc',
161         'port_matrix.cc',
162         'port_matrix_body.cc',
163         'port_matrix_column_labels.cc',
164         'port_matrix_component.cc',
165         'port_matrix_grid.cc',
166         'port_matrix_labels.cc',
167         'port_matrix_row_labels.cc',
168         'processor_box.cc',
169         'prompter.cc',
170         'public_editor.cc',
171         'quantize_dialog.cc',
172         'rc_option_editor.cc',
173         'region_editor.cc',
174         'region_gain_line.cc',
175         'region_layering_order_editor.cc',
176         'region_selection.cc',
177         'region_view.cc',
178         'return_ui.cc',
179         'rhythm_ferret.cc',
180         'route_group_dialog.cc',
181         'route_group_menu.cc',
182         'route_params_ui.cc',
183         'route_processor_selection.cc',
184         'route_time_axis.cc',
185         'route_ui.cc',
186         'selection.cc',
187         'send_ui.cc',
188         'session_import_dialog.cc',
189         'session_metadata_dialog.cc',
190         'session_option_editor.cc',
191         'sfdb_ui.cc',
192         'simpleline.cc',
193         'simplerect.cc',
194         'splash.cc',
195         'startup.cc',
196         'step_editor.cc',
197         'step_entry.cc',
198         'streamview.cc',
199         'strip_silence_dialog.cc',
200         'tape_region_view.cc',
201         'tempo_dialog.cc',
202         'tempo_lines.cc',
203         'theme_manager.cc',
204         'time_axis_view.cc',
205         'time_axis_view_item.cc',
206         'time_fx_dialog.cc',
207         'time_selection.cc',
208         'track_selection.cc',
209         'track_view_list.cc',
210         'ui_config.cc',
211         'utils.cc',
212         'version.cc',
213         'volume_controller.cc',
214         'waveview.cc',
215         'window_proxy.cc'
216 ]
217
218 def set_options(opt):
219         autowaf.set_options(opt)
220
221 def configure(conf):
222         autowaf.build_version_files(path_prefix+'version.h', path_prefix+'version.cc',
223                         'gtk2_ardour', MAJOR, MINOR, MICRO)
224         autowaf.configure(conf)
225         conf.check_tool('compiler_cxx')
226
227         if re.search ("linux", sys.platform) != None:
228                 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
229                 #
230                 #       TODO: Insert a sanity check for on OS X
231                 #       to ensure that CoreAudio is present....
232                 #       Really shouldn't these checks be in AutoWaf?
233                 #
234         autowaf.check_pkg(conf, 'flac', uselib_store='FLAC', atleast_version='1.2.1')
235         autowaf.check_pkg(conf, 'gthread', uselib_store='GTHREAD', atleast_version='2.10.1')
236         autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK', atleast_version='2.18')
237         autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.18')
238         autowaf.check_pkg(conf, 'libgnomecanvas-2.0', uselib_store='GNOMECANVAS', atleast_version='2.0')
239         autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6', uselib_store='GNOMECANVASMM', atleast_version='2.16')
240         autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
241
242         conf.check_tool('misc') # subst tool
243
244         conf.write_config_header('gtk2ardour-config.h')
245         
246         # Boost headers
247         autowaf.check_header(conf, 'boost/shared_ptr.hpp')
248         autowaf.check_header(conf, 'boost/weak_ptr.hpp')
249
250 # Add a waf `feature' to allow compilation of things using winegcc
251 from TaskGen import feature
252 @feature("wine")
253 def set_winegcc(self):
254         self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
255         self.env.CC = 'winegcc'
256
257 def build(bld):
258         # GTK front-end; if we're using VST we build this as a shared library, otherwise
259         # it's a normal executabale
260         if bld.env['VST_SUPPORT']:
261                 obj = bld.new_task_gen(features = 'cxx cc cshlib')
262         else:
263                 obj = bld.new_task_gen(features = 'cxx cc cprogram')
264
265         obj.includes     = ['.']
266         obj.source       = gtk2_ardour_sources
267         obj.name         = 'gtk2_ardour'
268         if bld.env['VST_SUPPORT']:
269                 obj.target = 'gtk2_ardour'
270                 obj.includes += ['../libs/fst']
271         else:
272                 obj.target = 'ardour-3.0'
273         obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
274         obj.uselib       = 'UUID FLAC GLIBMM GTHREAD GTK GNOMECANVAS OGG ALSA CURL DL'
275         obj.uselib       += ' GTKMM GNOMECANVASMM OSX GTKOSX COREAUDIO'
276         obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp
277                               libgtkmm2ext libtaglib'''
278         obj.cflags       = ['-DPACKAGE="gtk2_ardour"']
279         obj.cxxflags     = ['-DPACKAGE="gtk2_ardour"']
280         obj.cxxflags     += ['-DVERSIONSTRING="' + bld.env['VERSION'] + '"']
281         obj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
282         obj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"']
283         obj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
284         obj.cxxflags     += ['-DLOCALEDIR="' + os.path.join(
285                         os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
286         obj.cxxflags     += ['-DPROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"']
287
288         if bld.env['HAVE_SLV2']:
289                 obj.source += [ 'lv2_plugin_ui.cc' ]
290                 obj.uselib += ' SLV2 '
291
292         if bld.env['FREESOUND']:
293                 obj.source +=  [ 'sfdb_freesound_mootcher.cc' ]
294
295         if bld.env['VST_SUPPORT']:
296                 obj.source += [ 'vst_pluginui.cc' ]
297                 obj.cxxflags += [ '-DVST_SUPPORT' ]
298
299         if bld.env['PHONE_HOME']:
300                 obj.cxxflags += [ '-DPHONE_HOME' ]
301
302         if bld.env['GTKOSX']:
303                 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
304                 obj.source += [ 'cocoacarbon.mm' ]
305
306                 if bld.env['AUDIOUNITS']:
307                         obj.source += [ 'au_pluginui.mm' ]
308                         obj.uselib_local += ' libappleutility '
309
310         else:
311                 obj.source += [ 'x11.cc' ]
312
313         if bld.env['VST_SUPPORT']:
314                 # If we require VST support we build a stub main() and the FST library here using
315                 # winegcc, and link it to the GTK front-end library
316                 obj = bld.new_task_gen (features = 'cxx cc cprogram wine')
317                 obj.source = '''
318                         ../libs/fst/fst.c
319                         ../libs/fst/fstinfofile.c
320                         ../libs/fst/vsti.c
321                         ../libs/fst/vstwin.c
322                         ../vst/winmain.c
323                 '''
324                 obj.includes = '../libs/fst'
325                 obj.target = 'ardour-3.0-vst'
326                 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
327                 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
328                 obj.uselib = 'ALSA'
329                 obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp libgtkmm2ext libtaglib gtk2_ardour'''
330
331         # Wrappers
332
333         wrapper_subst_dict = {
334                 'INSTALL_PREFIX' : bld.env['PREFIX'],
335                 'LIBDIR'         : os.path.normpath(bld.env['LIBDIRNAME']),
336                 'LIBS'           : 'build/default/libs',
337                 'VERSION'        : '3.0',
338                 'EXECUTABLE'     : 'build/default/gtk2_ardour/ardour-3.0'
339         }
340
341         obj              = bld.new_task_gen('subst')
342         obj.source       = 'ardev_common.sh.in'
343         obj.target       = 'ardev_common_waf.sh'
344         obj.chmod        = 0755
345         obj.dict         = wrapper_subst_dict
346
347         obj              = bld.new_task_gen('subst')
348         obj.source       = 'ardour.sh.in'
349         obj.target       = 'ardour3'
350         obj.chmod        = 0755
351         obj.dict         = wrapper_subst_dict
352         obj.install_path = bld.env['BINDIR']
353
354         # Font configuration
355
356         font_subst_dict = {}
357         font_sizes      = {}
358         base_font       = ""
359
360         # Set up font sizes
361         if bld.env['IS_OSX']: # OS X fonts
362                 basefont = "Lucida Grande"
363                 font_sizes = {
364                         'TINY' : '7',
365                         'SMALLER' : '9',
366                         'SMALL' : '10',
367                         'NORMAL' : '11',
368                         'BIG' : '12',
369                         'BIGGER' : '14',
370                         'LARGE' : '18',
371                         'LARGER' : '28',
372                         'HUGER' : '36',
373                         'MASSIVE' : '60'
374                 }
375         else: # Linux/X11 fonts
376                 basefont = "sans"
377                 font_sizes = {
378                         'TINY' : '6',
379                         'SMALLER' : '8',
380                         'SMALL' : '9',
381                         'NORMAL' : '10',
382                         'BIG' : '14',
383                         'BIGGER' : '16',
384                         'LARGE' : '18',
385                         'LARGER' : '24',
386                         'HUGER' : '34',
387                         'MASSIVE' : '60'
388                 }
389
390         # Set up font substitution dictionary
391         for style in ['', 'BOLD', 'ITALIC']:
392                 for sizename,points in font_sizes.iteritems():
393                         if (len (style)):
394                                 key = "_".join (['FONT',style,sizename])
395                                 fontstyle = " ".join ([basefont,style.lower(),points])
396                         else:
397                                 key = "_".join (['FONT',sizename])
398                                 fontstyle = " ".join ([basefont,points])
399                                 
400                         font_subst_dict[key] = fontstyle
401
402         # add normal monospace to font dict
403         font_subst_dict['FONT_MONOSPACE_NORMAL'] = 'monospace 10'
404
405         # RC files
406         obj              = bld.new_task_gen('subst')
407         obj.source       = 'ardour3_ui_dark.rc.in'
408         obj.target       = 'ardour3_ui_dark.rc'
409         obj.dict         = font_subst_dict
410         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
411
412         obj              = bld.new_task_gen('subst')
413         obj.source       = 'ardour3_ui_light.rc.in'
414         obj.target       = 'ardour3_ui_light.rc'
415         obj.dict         = font_subst_dict
416         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
417
418         obj              = bld.new_task_gen('subst')
419         obj.source       = 'ardour3_ui_dark_sae.rc.in'
420         obj.target       = 'ardour3_ui_dark_sae.rc'
421         obj.dict         = font_subst_dict
422         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
423
424         obj              = bld.new_task_gen('subst')
425         obj.source       = 'ardour3_ui_light_sae.rc.in'
426         obj.target       = 'ardour3_ui_light_sae.rc'
427         obj.dict         = font_subst_dict
428         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
429
430         # Menus
431         menus_argv = []
432         if bld.env['GTKOSX']:
433                 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
434         else:
435                 menus_argv = [ '-E', '-P' ]
436         obj = bld.new_task_gen('command-output')
437         obj.command = 'cpp'
438         obj.command_is_external = True
439         obj.no_inputs = True
440         obj.argv = menus_argv
441         obj.stdin = 'ardour.menus.in'
442         obj.stdout = 'ardour.menus'
443         bld.install_files(os.path.join(bld.env['CONFIGDIR'], 'ardour3'), 'ardour.menus')
444
445         # Keybindings
446
447         # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad', 'SAE-us-nokeypad', 'ergonomic-us'
448
449         for b in [ 'mnemonic-us' ] :
450                 obj = bld.new_task_gen (
451                         target = b + '.bindings',
452                         source = b + '.bindings.in',
453                         rule = '../tools/fmt-bindings --winkey="%s" --accelmap <${SRC} >${TGT}' % bld.env['WINDOWS_KEY']
454                         )
455                 obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
456
457         # not modified at present
458         bld.install_files(os.path.join(bld.env['CONFIGDIR'], 'ardour3'), 'step_editing.bindings')
459
460         # Icons/Images
461         bld.install_files('${DATADIR}/ardour3/icons', 'icons/*.png')
462         bld.install_files('${DATADIR}/ardour3/pixmaps', 'pixmaps/*.xpm')
463         bld.install_files('${DATADIR}/ardour3', 'splash.png')
464
465         # Default UI configuration
466         bld.install_files('${CONFIGDIR}/ardour3', 'ardour3_ui_default.conf')
467
468         # i18n
469         if bld.env['ENABLE_NLS']:
470                 mo_files = glob.glob (os.path.join (bld.get_curdir(), 'po/*.mo'))
471                 for mo in mo_files:
472                         lang = os.path.basename (mo).replace ('.mo', '')
473                         bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo)
474
475 def i18n(bld):
476         autowaf.build_i18n (bld, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)
477