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/frameworks/15 llvm/meson.build | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/frameworks/15 llvm/meson.build')
-rw-r--r-- | meson/test cases/frameworks/15 llvm/meson.build | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/15 llvm/meson.build b/meson/test cases/frameworks/15 llvm/meson.build new file mode 100644 index 000000000..3855fae33 --- /dev/null +++ b/meson/test cases/frameworks/15 llvm/meson.build @@ -0,0 +1,51 @@ +project('llvmtest', ['c', 'cpp'], default_options : ['c_std=c99']) + +method = get_option('method') +static = get_option('link-static') +d = dependency('llvm', required : false, method : method, static : static) +if not d.found() + error('MESON_SKIP_TEST llvm not found.') +endif + +d = dependency('llvm', modules : 'not-found', required : false, static : static, method : method) +assert(d.found() == false, 'not-found llvm module found') + +d = dependency('llvm', version : '<0.1', required : false, static : static, method : method) +assert(d.found() == false, 'ancient llvm module found') + +d = dependency('llvm', optional_modules : 'not-found', required : false, static : static, method : method) +assert(d.found() == true, 'optional module stopped llvm from being found.') + +# Check we can apply a version constraint +d = dependency('llvm', version : ['< 500', '>=@0@'.format(d.version())], required: false, static : static, method : method) +assert(d.found() == true, 'Cannot set version constraints') + +dep_tinfo = dependency('tinfo', required : false) +if not dep_tinfo.found() + cpp = meson.get_compiler('cpp') + dep_tinfo = cpp.find_library('tinfo', required: false) +endif + +llvm_dep = dependency( + 'llvm', + modules : ['bitwriter', 'asmprinter', 'executionengine', 'target', + 'mcjit', 'nativecodegen', 'amdgpu'], + required : false, + static : static, + method : method, +) + +if not llvm_dep.found() + error('MESON_SKIP_TEST required llvm modules not found.') +endif + +executable( + 'sum', + 'sum.c', + dependencies : [ + llvm_dep, dep_tinfo, + # zlib will be statically linked on windows + dependency('zlib', required : host_machine.system() != 'windows'), + meson.get_compiler('c').find_library('dl', required : false), + ] + ) |