diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2021-06-22 15:56:34 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-06-22 15:56:46 +0200 |
| commit | bd75e0398fc66a71ecab297fefe68d0066c38a81 (patch) | |
| tree | 89cd30daa8e2a7cbb7d052def4d66e021a26bce9 /test cases/common | |
| parent | a656febccf6614008086bf124858826615924df7 (diff) | |
| download | meson-bd75e0398fc66a71ecab297fefe68d0066c38a81.tar.gz | |
extract_objects: skip headers when building custom_target command line
As seen in the testcase, passing objects to custom_target does not work
if headers are passed extract_objects(), or if extract_all_objects() is used
and the sources include any header files. To fix this, use the code that
already exists for unity build to filter out the nonexistent ".h.o" files.
This already gives for free the handling of genlist, which was mentioned
in a TODO comment.
Diffstat (limited to 'test cases/common')
| -rw-r--r-- | test cases/common/22 object extraction/header.h | 1 | ||||
| -rw-r--r-- | test cases/common/22 object extraction/meson.build | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/test cases/common/22 object extraction/header.h b/test cases/common/22 object extraction/header.h new file mode 100644 index 000000000..50403ce3c --- /dev/null +++ b/test cases/common/22 object extraction/header.h @@ -0,0 +1 @@ +/* Check that extract_all_objects works with headers. */ diff --git a/test cases/common/22 object extraction/meson.build b/test cases/common/22 object extraction/meson.build index 407c5e83b..fd4af8c60 100644 --- a/test cases/common/22 object extraction/meson.build +++ b/test cases/common/22 object extraction/meson.build @@ -4,20 +4,24 @@ if meson.is_unity() message('Skipping extraction test because this is a Unity build.') else lib1 = shared_library('somelib', 'src/lib.c') - lib2 = shared_library('somelib2', 'lib.c', 'lib2.c') + lib2 = shared_library('somelib2', 'lib.c', 'header.h', 'lib2.c') obj1 = lib1.extract_objects('src/lib.c') obj2 = lib2.extract_objects(['lib.c']) obj3 = lib2.extract_objects(files('lib.c')) obj4 = lib2.extract_objects(['lib.c', 'lib.c']) + obj5 = lib2.extract_objects(['lib.c', 'header.h']) + obj6 = lib2.extract_all_objects(recursive: true) e1 = executable('main1', 'main.c', objects : obj1) e2 = executable('main2', 'main.c', objects : obj2) e3 = executable('main3', 'main.c', objects : obj3) e4 = executable('main4', 'main.c', objects : obj4) + e5 = executable('main5', 'main.c', objects : obj5) + e6 = executable('main6', 'main.c', objects : obj6) custom_target('custom_target with object inputs', output: 'objs', - input: [obj1, obj2, obj3], + input: [obj1, obj2, obj3, obj5, obj6], build_by_default: true, command: [find_program('check-obj.py'), meson.backend(), '@INPUT@'], capture: true) @@ -26,4 +30,6 @@ else test('extraction test 2', e2) test('extraction test 3', e3) test('extraction test 4', e4) + test('extraction test 5', e5) + test('extraction test 6', e6) endif |
