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/58 multiple generators | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/common/58 multiple generators')
6 files changed, 47 insertions, 0 deletions
diff --git a/meson/test cases/common/58 multiple generators/data2.dat b/meson/test cases/common/58 multiple generators/data2.dat new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/meson/test cases/common/58 multiple generators/data2.dat @@ -0,0 +1 @@ +2 diff --git a/meson/test cases/common/58 multiple generators/main.cpp b/meson/test cases/common/58 multiple generators/main.cpp new file mode 100644 index 000000000..f1a01bd5f --- /dev/null +++ b/meson/test cases/common/58 multiple generators/main.cpp @@ -0,0 +1,6 @@ +#include"source1.h" +#include"source2.h" + +int main(void) { + return func1() + func2(); +} diff --git a/meson/test cases/common/58 multiple generators/meson.build b/meson/test cases/common/58 multiple generators/meson.build new file mode 100644 index 000000000..66f7fa9c1 --- /dev/null +++ b/meson/test cases/common/58 multiple generators/meson.build @@ -0,0 +1,13 @@ +project('trickier generator', 'cpp') + +comp = find_program('mygen.py') +subdir('subdir') + +generated2 = custom_target('generated2', + output : ['source2.h', 'source2.cpp'], + input : 'data2.dat', + command : [comp, '@INPUT0@', '@OUTDIR@']) + +exe = executable('prog', 'main.cpp', generated, generated2, + include_directories : include_directories('subdir')) + test('generated test', exe) diff --git a/meson/test cases/common/58 multiple generators/mygen.py b/meson/test cases/common/58 multiple generators/mygen.py new file mode 100755 index 000000000..99dc33136 --- /dev/null +++ b/meson/test cases/common/58 multiple generators/mygen.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import sys, os + +if len(sys.argv) != 3: + print("You is fail.") + sys.exit(1) + +with open(sys.argv[1]) as f: + val = f.read().strip() +outdir = sys.argv[2] + +outhdr = os.path.join(outdir, 'source%s.h' % val) +outsrc = os.path.join(outdir, 'source%s.cpp' % val) + +with open(outhdr, 'w') as f: + f.write('int func%s();\n' % val) +with open(outsrc, 'w') as f: + f.write('''int func%s() { + return 0; +} +''' % val) diff --git a/meson/test cases/common/58 multiple generators/subdir/data.dat b/meson/test cases/common/58 multiple generators/subdir/data.dat new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/meson/test cases/common/58 multiple generators/subdir/data.dat @@ -0,0 +1 @@ +1 diff --git a/meson/test cases/common/58 multiple generators/subdir/meson.build b/meson/test cases/common/58 multiple generators/subdir/meson.build new file mode 100644 index 000000000..2456ecb6d --- /dev/null +++ b/meson/test cases/common/58 multiple generators/subdir/meson.build @@ -0,0 +1,4 @@ +generated = custom_target('generated', +output : ['source1.h', 'source1.cpp'], +input : 'data.dat', +command : [comp, '@INPUT0@', '@OUTDIR@']) |