Welcome to mirror list, hosted at ThFree Co, Russian Federation.

meson.build - github.com/GStreamer/orc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 705cac836b6412d3272583039cd4e9966831e62e (plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
project ('orc', 'c', version : '0.4.29',
                     meson_version : '>= 0.47.0',
                     default_options : ['buildtype=debugoptimized',
                                        'warning_level=1',
                                        'c_std=gnu99'] )

orc_api = '0.4'
orc_version_major = meson.project_version().split('.')[0]
orc_version_minor = meson.project_version().split('.')[1]
orc_version_micro = meson.project_version().split('.')[2]

# maintaining compatibility with the previous libtool versioning
soversion = 0
curversion = orc_version_micro.to_int()
libversion = '@0@.@1@.0'.format(soversion, curversion)
osxversion = curversion + 1

add_project_arguments('-DHAVE_CONFIG_H', language : 'c')

orc_inc = include_directories('.')

cc = meson.get_compiler('c')

cdata = configuration_data()      # config.h
pc_conf = configuration_data()    # orc.pc

# -Bsymbolic-functions
if meson.version().version_compare('>= 0.46.0')
  if cc.has_link_argument('-Wl,-Bsymbolic-functions')
    add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
  endif
endif

# Symbol visibility
if cc.get_id() == 'msvc'
  export_define = '__declspec(dllexport) extern'
elif cc.has_argument('-fvisibility=hidden')
  add_project_arguments('-fvisibility=hidden', language: 'c')
  export_define = 'extern __attribute__ ((visibility ("default")))'
else
  export_define = 'extern'
endif
# Passing this through the command line would be too messy
cdata.set('ORC_API_EXPORT', export_define)

all_backends = ['sse', 'mmx', 'altivec', 'neon', 'mips', 'c64x'] # 'arm'

backend = get_option('orc-backend')
foreach b : all_backends
  if backend == 'all' or backend == b
    cdata.set('ENABLE_BACKEND_' + b.to_upper(), 1)
  endif
endforeach

cpu_family = host_machine.cpu_family()
if cpu_family == 'x86'
  cdata.set('HAVE_I386', true)
elif cpu_family == 'x86_64'
  cdata.set('HAVE_AMD64', true)
elif cpu_family == 'powerpc'
  cdata.set('HAVE_POWERPC', true)
elif cpu_family == 'arm'
  cdata.set('HAVE_ARM', true)
elif cpu_family == 'mips' and host_machine.endian() == 'little'
  cdata.set('HAVE_MIPSEL', true)
endif

libm = cc.find_library('m', required : false)

librt = []
pc_conf.set('LIBRT', '')
if cc.has_function('clock_gettime')
  cdata.set('HAVE_CLOCK_GETTIME', true)
else
  # On glibc older than 2.17, clock_gettime is provided by time.h and -lrt
  librt = cc.find_library('rt', required : false)
  if librt.found() and cc.has_function('clock_gettime', dependencies : librt)
    pc_conf.set('LIBRT', '-lrt')
  endif
endif

liblog = []
if cc.has_header_symbol('android/log.h', '__android_log_print')
  cdata.set('HAVE_ANDROID_LIBLOG', true)
  liblog = [cc.find_library('log', required : true)]
endif

host_os = host_machine.system()
if host_os == 'windows'
  cdata.set('HAVE_CODEMEM_VIRTUALALLOC', true)
  cdata.set('HAVE_OS_WIN32', true)
  cdata.set('HAVE_THREAD_WIN32', true)
  pc_conf.set('EXEEXT', '.exe')
  pc_conf.set('PTHREAD_LIBS', '')
else
  # If it is not windows, we just assume it is a unix of sorts for now.
  cdata.set('HAVE_CODEMEM_MMAP', true)
  cdata.set('HAVE_THREAD_PTHREAD', true)
  pc_conf.set('EXEEXT', '')
  if host_os == 'android'
    pc_conf.set('PTHREAD_LIBS', '')
  else
    pc_conf.set('PTHREAD_LIBS', '-lpthread')
  endif
endif

monotonic_test = '''
#include <time.h>
#include <unistd.h>
int main() {
  #if !(defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 && defined(CLOCK_MONOTONIC))
  #error No monotonic clock
  #endif
  return 0;
}
'''
cdata.set('HAVE_MONOTONIC_CLOCK', cc.compiles(monotonic_test))
cdata.set('HAVE_GETTIMEOFDAY', cc.has_function('gettimeofday'))
cdata.set('HAVE_POSIX_MEMALIGN', cc.has_function('posix_memalign', prefix : '#include <stdlib.h>'))
cdata.set('HAVE_MMAP', cc.has_function('mmap'))

cdata.set('HAVE_SYS_TIME_H', cc.has_header('sys/time.h'))
cdata.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
cdata.set('HAVE_VALGRIND_VALGRIND_H', cc.has_header('valgrind/valgrind.h'))

cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
cdata.set_quoted('VERSION', meson.project_version())

subdir('orc')

opt_examples = get_option('examples')
opt_orctest = get_option('orc-test')
opt_tests = get_option('tests')
opt_tools = get_option('tools')

if not opt_orctest.disabled()
  subdir('orc-test')
else
  if opt_tests.enabled()
    error('Tests were enabled explicitly, but the orc-test library was disabled.')
  endif
  orc_test_dep = disabler() # for testsuites + orc-bugreport
endif

if not opt_tools.disabled()
  subdir('tools')
else
  orcc = disabler() # for testsuite/orcc/
endif

if not opt_examples.disabled()
  subdir('examples')
endif

if not opt_tests.disabled()
  subdir('testsuite')
endif

if build_machine.system() == 'windows'
  message('Disabling gtk-doc while building on Windows')
else
  if find_program('gtkdoc-scan', required : get_option('gtk_doc')).found()
    subdir('doc')
  else
    message('Not building documentation as gtk-doc was not found')
  endif
endif

# FIXME: use pkg-config module
pc_conf.set('prefix', get_option('prefix'))
pc_conf.set('exec_prefix', get_option('prefix'))
pc_conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
pc_conf.set('includedir', join_paths(get_option('prefix'), 'include'))
pc_conf.set('VERSION', meson.project_version())
pc_conf.set('ORC_MAJORMINOR', orc_api)
pc_conf.set('LIBM', libm.found() ? '-lm' : '')

pkgconfigdir = join_paths (get_option('libdir'), 'pkgconfig')
configure_file(input : 'orc.pc.in',
  output : 'orc-' + orc_api + '.pc',
  configuration : pc_conf,
  install_dir : pkgconfigdir)

# Install m4 macro that other projects use
install_data('orc.m4', install_dir : 'share/aclocal')

configure_file(output : 'config.h', configuration : cdata)