|
| 1 | +project('poc', 'c', version : '0.1.0', default_options: ['c_std=c11']) |
| 2 | +pkg = import('pkgconfig') |
| 3 | +gnome = import('gnome') |
| 4 | + |
| 5 | +pocsource = [ |
| 6 | + 'poc.h', |
| 7 | + 'pocaxis.c', |
| 8 | + 'pocaxis.h', |
| 9 | + 'pocbag.c', |
| 10 | + 'pocbag.h', |
| 11 | + 'pocdataset.c', |
| 12 | + 'pocdataset.h', |
| 13 | + 'pocdatasetspline.c', |
| 14 | + 'pocdatasetspline.h', |
| 15 | + 'poclegend.c', |
| 16 | + 'poclegend.h', |
| 17 | + 'pocplot.c', |
| 18 | + 'pocplot.h', |
| 19 | + 'pocsample.c', |
| 20 | + 'pocsample.h', |
| 21 | + 'pocspline.c', |
| 22 | + 'pocspline.h', |
| 23 | + 'poctypes.c', |
| 24 | + 'poctypes.h', |
| 25 | +] |
| 26 | + |
| 27 | +cflags = [ |
| 28 | + '-D__poc_compile__=1', |
| 29 | + '-DGSEAL_ENABLE', |
| 30 | + '-DG_DISABLE_DEPRECATED', |
| 31 | + '-DG_DISABLE_SINGLE_INCLUDES', |
| 32 | + '-DGDK_DISABLE_DEPRECATED', |
| 33 | + '-DGTK_DISABLE_DEPRECATED', |
| 34 | + '-DGDK_DISABLE_SINGLE_INCLUDES', |
| 35 | + '-DGTK_DISABLE_SINGLE_INCLUDES', |
| 36 | + '-DGTK_MULTIDEVICE_SAFE=1', |
| 37 | +] |
| 38 | + |
| 39 | +cflags_warnings = [ |
| 40 | + '-Wstrict-prototypes', |
| 41 | + '-Wmissing-prototypes', |
| 42 | + '-Wnested-externs', |
| 43 | + '-Walloc-zero', |
| 44 | + '-Wduplicated-branches', |
| 45 | + '-Wpointer-arith', |
| 46 | + '-Wcast-align', |
| 47 | + '-Wwrite-strings', |
| 48 | + '-Wdeclaration-after-statement', |
| 49 | + '-Wshadow', |
| 50 | + '-Wredundant-decls', |
| 51 | + '-Wpacked', |
| 52 | + '-Wbad-function-cast', |
| 53 | +] |
| 54 | + |
| 55 | +cc = meson.get_compiler('c') |
| 56 | +if get_option('warning_level') == '3' |
| 57 | + cflags += cflags_warnings |
| 58 | +endif |
| 59 | +add_project_arguments(cc.get_supported_arguments(cflags), language: 'c') |
| 60 | + |
| 61 | +mdep = cc.find_library('m', required: false) |
| 62 | +gtkdep = dependency('gtk+-3.0') |
| 63 | + |
| 64 | +mapfile = 'pocplot.map' |
| 65 | +vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) |
| 66 | + |
| 67 | +lib = library('poc', pocsource, |
| 68 | + link_args : vflag, |
| 69 | + link_depends : mapfile, |
| 70 | + dependencies : [gtkdep, mdep], |
| 71 | + soversion : meson.project_version(), |
| 72 | + install : true) |
| 73 | + |
| 74 | +host_os = host_machine.system() |
| 75 | +os_win32 = host_os.contains('mingw') or host_os.contains('windows') |
| 76 | + |
| 77 | +if get_option('introspection') |
| 78 | + gir = gnome.generate_gir(lib, |
| 79 | + sources : pocsource, |
| 80 | + nsversion : '0.1', |
| 81 | + namespace : 'Poc', |
| 82 | + identifier_prefix: 'Poc', |
| 83 | + symbol_prefix: 'poc', |
| 84 | + includes: ['GLib-2.0', 'GObject-2.0', 'Gtk-3.0'], |
| 85 | + install: true |
| 86 | + ) |
| 87 | + |
| 88 | + if get_option('vapi') |
| 89 | + vapi = gnome.generate_vapi('poc-0.1', |
| 90 | + sources: gir[0], |
| 91 | + packages: [ 'gtk+-3.0' ], |
| 92 | + install: true, |
| 93 | + metadata_dirs: [ meson.current_source_dir() ], |
| 94 | + ) |
| 95 | + endif |
| 96 | +endif |
| 97 | + |
| 98 | +if get_option('docs') |
| 99 | + subdir ('docs') |
| 100 | +endif |
| 101 | + |
| 102 | +mathextra = configuration_data() |
| 103 | +mathextra.set('HAVE_EXP10', cc.has_function('exp10', prefix : '#include <math.h>')) |
| 104 | +configure_file(input : 'mathextra.h.in', |
| 105 | + output : 'mathextra.h', |
| 106 | + configuration : mathextra) |
| 107 | + |
| 108 | +install_headers(['poc.h', 'pocplot.h', 'pocdataset.h', 'pocaxis.h', 'pocsample.h', |
| 109 | + 'pocdatasetspline.h', 'poclegend.h', 'pocspline.h', 'poctypes.h']) |
| 110 | +pkg.generate(lib) |
| 111 | + |
| 112 | +install_data(['poc-catalog.xml'], install_dir: 'share/glade/catalogs') |
0 commit comments