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/49 custom target/meson.build | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/common/49 custom target/meson.build')
-rw-r--r-- | meson/test cases/common/49 custom target/meson.build | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/meson/test cases/common/49 custom target/meson.build b/meson/test cases/common/49 custom target/meson.build new file mode 100644 index 000000000..52e8630dc --- /dev/null +++ b/meson/test cases/common/49 custom target/meson.build @@ -0,0 +1,67 @@ +project('custom target', 'c') + +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif + +# Note that this will not add a dependency to the compiler executable. +# Code will not be rebuilt if it changes. +comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') +# Test that files() in command: works. The compiler just discards it. +useless = files('test.json') + +mytarget = custom_target('bindat', +output : 'data.dat', +input : 'data_source.txt', +command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +env: {'MY_COMPILER_ENV': 'value'}, +install : true, +install_dir : 'subdir' +) + +has_not_changed = false +if is_disabler(mytarget) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'Custom target has changed.') + +assert(not is_disabler(mytarget), 'Custom target is a disabler.') + +mytarget_disabler = custom_target('bindat', +output : 'data.dat', +input : 'data_source.txt', +command : [disabler(), comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +install : true, +install_dir : 'subdir' +) + +if mytarget_disabler.found() + mytarget_disabled = false +else + mytarget_disabled = true +endif + +assert(mytarget_disabled, 'Disabled custom target should not be found.') + +mytarget_disabler = custom_target('bindat', +output : 'data.dat', +input : disabler(), +command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +install : true, +install_dir : 'subdir' +) + +assert(is_disabler(mytarget_disabler), 'Disabled custom target is not a disabler.') + +if mytarget_disabler.found() + mytarget_disabled = false +else + mytarget_disabled = true +endif + +assert(mytarget_disabled, 'Disabled custom target should not be found.') + +subdir('depfile') |