aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2018-05-07 19:02:49 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2018-05-07 19:02:49 +0200
commit1457b922e1d7c277c558bd3fb247caba6b8df07a (patch)
tree80d2b97cda3be4288c3e4c4096f16c8cf3f5c7fe /meson.build
parent81b2369388cd8a63611b8fe32f1701f73a80b100 (diff)
downloadcanvas_display.lv2-1457b922e1d7c277c558bd3fb247caba6b8df07a.tar.xz
strip canvas headers, migrate to meson.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build105
1 files changed, 105 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..35776d4
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,105 @@
+project('canvas_display.lv2', 'c', default_options : [
+ 'buildtype=release',
+ 'warning_level=1',
+ 'werror=false',
+ 'b_lto=true',
+ 'c_std=c11'])
+
+cc = meson.get_compiler('c')
+
+m_dep = cc.find_library('m')
+lv2_dep = dependency('lv2', version : '>=1.14.0')
+cairo_dep = dependency('cairo', version : '>=1.0.0',
+ static : meson.is_cross_build())
+
+dsp_deps = [m_dep, lv2_dep, cairo_dep]
+ui_deps = [m_dep, lv2_dep, cairo_dep]
+
+pugl_inc = include_directories('pugl')
+canvas_inc = include_directories('canvas.lv2')
+ardour_inc = include_directories('ardour.lv2')
+inc_dir = [pugl_inc, canvas_inc, ardour_inc]
+
+inst_dir = join_paths(get_option('libdir'), 'lv2', meson.project_name())
+
+rawvers = run_command('cat', 'VERSION').stdout().strip()
+version = rawvers.split('.')
+
+conf_data = configuration_data()
+conf_data.set('MAJOR_VERSION', version[0])
+conf_data.set('MINOR_VERSION', version[1])
+conf_data.set('MICRO_VERSION', version[2])
+
+add_project_arguments('-D_GNU_SOURCE', language : 'c')
+add_project_arguments('-DPUGL_HAVE_GL', language : 'c')
+add_project_arguments('-DPUGL_HAVE_CAIRO', language : 'c')
+
+cp = find_program('cp')
+clone = [cp, '@INPUT@', '@OUTPUT@']
+
+dsp_srcs = ['canvas.c']
+
+ui_srcs = ['canvas_ui.c']
+
+c_args = ['-fvisibility=hidden',
+ '-ffast-math']
+
+if host_machine.system() == 'linux'
+ conf_data.set('UI_TYPE', 'X11UI')
+ ui_deps += dependency('gl')
+ ui_deps += dependency('x11', version : '>=1.6.0')
+ ui_deps += dependency('xext', version : '>=1.3.0')
+ ui_srcs += 'pugl/pugl/pugl_x11.c'
+elif host_machine.system() == 'windows'
+ add_languages('cpp')
+ conf_data.set('UI_TYPE', 'WindowsUI')
+ ui_deps += cc.find_library('opengl32')
+ ui_deps += cc.find_library('gdi32')
+ ui_deps += cc.find_library('user32')
+ ui_srcs += 'pugl/pugl/pugl_win.cpp'
+elif host_machine.system() == 'darwin'
+ #add_languages('objc')
+ conf_data.set('UI_TYPE', 'CocoaUI')
+ #ui_deps += cc.find_library('Cocoa')
+ #ui_deps += cc.find_library('gl')
+ #ui_deps += dependency('appleframeworks', modules : 'cocoa')
+ #ui_srcs += 'pugl/pugl/pugl_osx.m'
+endif
+
+mod = shared_module('canvas_display', dsp_srcs,
+ c_args : c_args,
+ include_directories : inc_dir,
+ name_prefix : '',
+ dependencies : dsp_deps,
+ install : true,
+ install_dir : inst_dir)
+
+ui = shared_module('canvas_display_ui', ui_srcs,
+ c_args : c_args,
+ include_directories : inc_dir,
+ name_prefix : '',
+ dependencies : ui_deps,
+ install : true,
+ install_dir : inst_dir)
+
+suffix = mod.full_path().strip().split('.')[-1]
+conf_data.set('MODULE_SUFFIX', '.' + suffix)
+
+configure_file(input : 'manifest.ttl.in', output : 'manifest.ttl',
+ configuration : conf_data,
+ install : true,
+ install_dir : inst_dir)
+
+custom_target('dsp_ttl',
+ input : 'canvas_display.ttl',
+ output : 'canvas_display.ttl',
+ command : clone,
+ install : true,
+ install_dir : inst_dir)
+
+custom_target('ui_ttl',
+ input : 'canvas_display_ui.ttl',
+ output : 'canvas_display_ui.ttl',
+ command : clone,
+ install : true,
+ install_dir : inst_dir)