@@ 8,16 8,11 @@ project('props.lv2', 'c', default_options : [
'b_lto=true',
'c_std=c11'])
+build_tests = get_option('build-tests')
lv2libdir = get_option('lv2libdir')
inst_dir = join_paths(lv2libdir, meson.project_name())
-reuse = find_program('reuse', required : false)
-cp = find_program('cp')
-lv2_validate = find_program('lv2_validate', native : true, required : false)
-sord_validate = find_program('sord_validate', native : true, required : false)
-lv2lint = find_program('lv2lint', required : false)
-
add_project_arguments('-D_GNU_SOURCE', language : 'c')
conf_data = configuration_data()
@@ 26,96 21,111 @@ cc = meson.get_compiler('c')
m_dep = cc.find_library('m')
lv2_dep = dependency('lv2', version : '>=1.14.0')
-lib_deps = []
-lib_deps += m_dep
-lib_deps += lv2_dep
+lib_deps = [
+ m_dep,
+ lv2_dep
+]
-lib_incs = []
-lib_incs += include_directories('')
+lib_incs = [
+ include_directories('')
+]
-lib_srcs = []
-lib_srcs += join_paths('src', 'props.c')
+lib_srcs = [
+ join_paths('src', 'props.c')
+]
props_lv2 = declare_dependency(
include_directories : lib_incs,
dependencies : lib_deps,
sources : lib_srcs)
-test_args = []
-test_args += '-fvisibility=hidden'
-test_args += '-ffast-math'
-
-test_deps = []
-test_deps += props_lv2
-
-test_srcs = []
-test_srcs += join_paths('test', 'props.c')
-
-check_srcs = []
-check_srcs += join_paths('test', 'props_test.c')
-
-install = not meson.is_subproject()
-
-mod = shared_module('props', test_srcs,
- c_args : test_args,
- name_prefix : '',
- dependencies : test_deps,
- install : install,
- install_dir : inst_dir)
-
-version = get_option('version').split('.')
-conf_data.set('MAJOR_VERSION', version[0])
-conf_data.set('MINOR_VERSION', version[1])
-conf_data.set('MICRO_VERSION', version[2])
-
-suffix = mod.full_path().strip().split('.')[-1]
-conf_data.set('MODULE_SUFFIX', '.' + suffix)
-
-manifest_ttl = configure_file(
- input : join_paths('test', 'manifest.ttl.in'),
- output : 'manifest.ttl',
- configuration : conf_data,
- install : install,
- install_dir : inst_dir)
-
-dsp_ttl = configure_file(
- input : join_paths('test', 'props.ttl'),
- output : 'props.ttl',
- copy : true,
- install : install,
- install_dir : inst_dir)
-
-chunk_bin = configure_file(
- input : join_paths('test', 'chunk.bin'),
- output : 'chunk.bin',
- copy : true,
- install : install,
- install_dir : inst_dir)
-
-props_test = executable('props_test', check_srcs,
- c_args : test_args,
- dependencies : test_deps,
- install : false)
-
-test('Test', props_test,
- timeout : 240)
-
-if lv2_validate.found() and sord_validate.found()
- test('LV2 validate', lv2_validate,
- args : [manifest_ttl, dsp_ttl])
-endif
-
-if lv2lint.found()
- test('LV2 lint', lv2lint,
- args : ['-M', 'pack',
- '-E', 'warn',
- '-I', meson.current_build_dir(),
- 'http://open-music-kontrollers.ch/lv2/props#test'])
-endif
-
-if reuse.found()
- test('REUSE', reuse, args : [
- '--root', meson.current_source_dir(),
- 'lint'
- ])
+if build_tests
+ reuse = find_program('reuse', required : false)
+ lv2_validate = find_program('lv2_validate', native : true, required : false)
+ sord_validate = find_program('sord_validate', native : true, required : false)
+ lv2lint = find_program('lv2lint', required : false)
+
+ test_args = [
+ '-fvisibility=hidden',
+ '-ffast-math'
+ ]
+
+ test_deps = [
+ props_lv2
+ ]
+
+ test_srcs = [
+ join_paths('test', 'props.c')
+ ]
+
+ check_srcs = [
+ join_paths('test', 'props_test.c')
+ ]
+
+ install = not meson.is_subproject()
+
+ mod = shared_module('props', test_srcs,
+ c_args : test_args,
+ name_prefix : '',
+ dependencies : test_deps,
+ install : install,
+ install_dir : inst_dir)
+
+ version = get_option('version').split('.')
+ conf_data.set('MAJOR_VERSION', version[0])
+ conf_data.set('MINOR_VERSION', version[1])
+ conf_data.set('MICRO_VERSION', version[2])
+
+ suffix = mod.full_path().strip().split('.')[-1]
+ conf_data.set('MODULE_SUFFIX', '.' + suffix)
+
+ manifest_ttl = configure_file(
+ input : join_paths('test', 'manifest.ttl.in'),
+ output : 'manifest.ttl',
+ configuration : conf_data,
+ install : install,
+ install_dir : inst_dir)
+
+ dsp_ttl = configure_file(
+ input : join_paths('test', 'props.ttl'),
+ output : 'props.ttl',
+ copy : true,
+ install : install,
+ install_dir : inst_dir)
+
+ chunk_bin = configure_file(
+ input : join_paths('test', 'chunk.bin'),
+ output : 'chunk.bin',
+ copy : true,
+ install : install,
+ install_dir : inst_dir)
+
+ props_test = executable('props_test', check_srcs,
+ c_args : test_args,
+ dependencies : test_deps,
+ install : false)
+
+ test('Test', props_test,
+ timeout : 240,
+ suite: ['memcheck'])
+
+ if lv2_validate.found() and sord_validate.found()
+ test('LV2 validate', lv2_validate,
+ args : [manifest_ttl, dsp_ttl])
+ endif
+
+ if lv2lint.found()
+ test('LV2 lint', lv2lint,
+ args : ['-M', 'pack',
+ '-E', 'warn',
+ '-I', meson.current_build_dir(),
+ 'http://open-music-kontrollers.ch/lv2/props#test'])
+ endif
+
+ if reuse.found()
+ test('REUSE', reuse, args : [
+ '--root', meson.current_source_dir(),
+ 'lint'
+ ])
+ endif
endif