File: meson.build

package info (click to toggle)
blop-lv2 1.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 580 kB
  • sloc: ansic: 5,389; makefile: 6
file content (122 lines) | stat: -rw-r--r-- 2,904 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Copyright 2021-2022 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: CC0-1.0 OR MIT

project('blop-lv2', ['c'],
        version: '1.0.4',
        license: 'GPLv2+',
        meson_version: '>= 0.56.0',
        default_options: [
          'b_ndebug=if-release',
          'buildtype=release',
          'c_std=c99',
        ])

#######################
# Compilers and Flags #
#######################

# Load build tools
cc = meson.get_compiler('c')

# Set global warning flags
if get_option('strict') and not meson.is_subproject()
  subdir('meson/warnings')
endif
subdir('meson/suppressions')

##########################
# Platform Configuration #
##########################

sinf_code = '''#include <math.h>
int main(void) { return sinf(0.0f) == 0.0f; }'''

getopt_long_code = '''#include <getopt.h>
int main(int argc, char** argv) {
  const struct option long_options[] = {{"wave", 1, 0, 'w' }, {0, 0, 0, 0}};
  int          option_index = 0;

  return getopt_long(argc, argv, "h", long_options, &option_index);
}'''

if not cc.compiles(getopt_long_code, name: 'getopt_long')
  error('Missing getopt_long() from getopt.h')
endif

platform_defines = [
  '-DHAVE_SINF=@0@'.format(cc.compiles(sinf_code, name: 'sinf').to_int()),
]

################
# Dependencies #
################

m_dep = cc.find_library('m', required: false)
dl_dep = cc.find_library('dl', required: false)

lv2_dep = dependency('lv2',
                     version: '>= 1.16.0',
                     fallback: ['lv2', 'lv2_dep'])

add_project_arguments(['-DHAVE_SINF'], language: ['c'])

#########
# Paths #
#########

lv2dir = get_option('lv2dir')
if lv2dir == ''
  prefix = get_option('prefix')
  if target_machine.system() == 'darwin' and prefix == '/'
    lv2dir = '/Library/Audio/Plug-Ins/LV2'
  elif target_machine.system() == 'haiku' and prefix == '/'
    lv2dir = '/boot/common/add-ons/lv2'
  elif target_machine.system() == 'windows' and prefix == 'C:/'
    lv2dir = 'C:/Program Files/Common/LV2'
  else
    lv2dir = prefix / get_option('libdir') / 'lv2'
  endif
endif

######################
# Waveform Generator #
######################

wavegen = executable(
  'wavegen',
  files('src/wavegen.c', 'src/wdatutil.c'),
  c_args: platform_defines,
  dependencies: [m_dep],
  include_directories: include_directories('src/include'),
  install: false,
  native: true,
)

wavegen_command = [
  wavegen,
  '-f', '12',
  '-g', '1.0',
  '-m', '128',
  '-r', get_option('rate').to_string(),
  '-s', '1',
]

#################
# Plugin Bundle #
#################

subdir('blop.lv2')

#########
# Tests #
#########

if not get_option('tests').disabled() and not meson.is_subproject()
  # Check release metadata
  autoship = find_program('autoship', required: get_option('tests'))
  if autoship.found()
    test('autoship', autoship,
         args: ['test', meson.current_source_dir()],
         suite: 'data')
  endif
endif