diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/common/13 pch/generated | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/common/13 pch/generated')
6 files changed, 43 insertions, 0 deletions
diff --git a/meson/test cases/common/13 pch/generated/gen_custom.py b/meson/test cases/common/13 pch/generated/gen_custom.py new file mode 100644 index 000000000..650e03c2b --- /dev/null +++ b/meson/test cases/common/13 pch/generated/gen_custom.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +import sys + +with open(sys.argv[1], 'w') as f: + f.write("#define FOO 0") diff --git a/meson/test cases/common/13 pch/generated/gen_generator.py b/meson/test cases/common/13 pch/generated/gen_generator.py new file mode 100644 index 000000000..a245e7aef --- /dev/null +++ b/meson/test cases/common/13 pch/generated/gen_generator.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 +import sys + +with open(sys.argv[1]) as f: + content = f.read() +with open(sys.argv[2], 'w') as f: + f.write(content) diff --git a/meson/test cases/common/13 pch/generated/generated_generator.in b/meson/test cases/common/13 pch/generated/generated_generator.in new file mode 100644 index 000000000..1a00ebd21 --- /dev/null +++ b/meson/test cases/common/13 pch/generated/generated_generator.in @@ -0,0 +1 @@ +#define BAR 0 diff --git a/meson/test cases/common/13 pch/generated/meson.build b/meson/test cases/common/13 pch/generated/meson.build new file mode 100644 index 000000000..ba06bcea8 --- /dev/null +++ b/meson/test cases/common/13 pch/generated/meson.build @@ -0,0 +1,22 @@ +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +if cc_id == 'lcc' + error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') +endif + +# PGI compiler only supports PCH for C++ +if cc_id == 'pgi' + subdir_done() +endif + +generated_customTarget = custom_target('makeheader', + output: 'generated_customTarget.h', + command : [find_program('gen_custom.py'), '@OUTPUT0@']) + +generated_generator = generator(find_program('gen_generator.py'), + output: '@BASENAME@.h', + arguments: ['@INPUT@', '@OUTPUT@']) + +exe = executable('prog', 'prog.c', generated_customTarget, generated_generator.process('generated_generator.in'), + c_pch: 'pch/prog.h') diff --git a/meson/test cases/common/13 pch/generated/pch/prog.h b/meson/test cases/common/13 pch/generated/pch/prog.h new file mode 100644 index 000000000..15fec38ce --- /dev/null +++ b/meson/test cases/common/13 pch/generated/pch/prog.h @@ -0,0 +1,2 @@ +#include "generated_customTarget.h" +#include "generated_generator.h" diff --git a/meson/test cases/common/13 pch/generated/prog.c b/meson/test cases/common/13 pch/generated/prog.c new file mode 100644 index 000000000..6765ac102 --- /dev/null +++ b/meson/test cases/common/13 pch/generated/prog.c @@ -0,0 +1,6 @@ +// No includes here, they need to come from the PCH + +int main(void) { + return FOO + BAR; +} + |