meson: Move ABI compliance check alongside library target
In the spirit of keeping-things-that-are-together-together.
Change-Id: I8e75beae84da06fe1f9a32de569a1816ae093be9
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/meson.build b/meson.build
index 529884b..932a7ad 100644
--- a/meson.build
+++ b/meson.build
@@ -50,50 +50,6 @@
if get_option('tests').allowed()
subdir('tests')
-
- c_suite = meson.get_compiler('c').get_id()
- cpp_suite = meson.get_compiler('cpp').get_id()
-
- if get_option('abi-compliance-check').allowed() and c_suite == cpp_suite and c_suite == 'gcc'
- host = host_machine.cpu_family()
- baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(c_suite)
-
- abi_dumper = find_program('abi-dumper',
- native: true,
- required: get_option('abi-compliance-check'))
- abi_compliance_checker = find_program('abi-compliance-checker',
- native: true,
- required: get_option('abi-compliance-check'))
-
- test_abi_compliance = abi_dumper.found() and \
- abi_compliance_checker.found() and \
- import('fs').is_file(baseline_dump)
-
- if test_abi_compliance
- current_dump = custom_target('abi-dump',
- input: libpldm,
- output: 'current.dump',
- command: [ abi_dumper,
- '-public-headers',
- meson.project_source_root() / 'include',
- '@INPUT@',
- '-o',
- '@OUTPUT@',
- '-lver',
- meson.project_version()])
- abi_compliance = custom_target('abi-compliance',
- input: [baseline_dump, current_dump],
- output: 'abi-compliance',
- command: [ abi_compliance_checker,
- '-l',
- meson.project_name(),
- '-old',
- '@INPUT0@',
- '-new',
- '@INPUT1@' ],
- build_by_default: true)
- endif
- endif
endif
install_subdir('instance-db',
diff --git a/src/meson.build b/src/meson.build
index 77fd629..421af50 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -39,3 +39,49 @@
description: 'PLDM protocol encode/decode C lib',
version: meson.project_version(),
libraries: libpldm)
+
+if get_option('tests').allowed()
+ c_suite = meson.get_compiler('c').get_id()
+ cpp_suite = meson.get_compiler('cpp').get_id()
+
+ if get_option('abi-compliance-check').allowed() and c_suite == cpp_suite and c_suite == 'gcc'
+ host = host_machine.cpu_family()
+ baseline_dump = meson.project_source_root() / 'abi' / host / '@0@.dump'.format(c_suite)
+
+ abi_dumper = find_program('abi-dumper',
+ native: true,
+ required: get_option('abi-compliance-check'))
+ abi_compliance_checker = find_program('abi-compliance-checker',
+ native: true,
+ required: get_option('abi-compliance-check'))
+
+ test_abi_compliance = abi_dumper.found() and \
+ abi_compliance_checker.found() and \
+ import('fs').is_file(baseline_dump)
+
+ if test_abi_compliance
+ current_dump = custom_target('abi-dump',
+ input: libpldm,
+ output: 'current.dump',
+ command: [ abi_dumper,
+ '-public-headers',
+ meson.project_source_root() / 'include',
+ '@INPUT@',
+ '-o',
+ '@OUTPUT@',
+ '-lver',
+ meson.project_version()])
+ abi_compliance = custom_target('abi-compliance',
+ input: [baseline_dump, current_dump],
+ output: 'abi-compliance',
+ command: [ abi_compliance_checker,
+ '-l',
+ meson.project_name(),
+ '-old',
+ '@INPUT0@',
+ '-new',
+ '@INPUT1@' ],
+ build_by_default: true)
+ endif
+ endif
+endif