commit
416a6fc235
3 changed files with 108 additions and 28 deletions
@ -0,0 +1,8 @@ |
||||
# LLVM dependency supports both dynamic and static linking |
||||
|
||||
The LLVM dependency has been improved to consistently use dynamic linking. |
||||
Previously recent version (>= 3.9) would link dynamically while older versions |
||||
would link statically. |
||||
|
||||
Now LLVM also accepts the `static` keyword to enable statically linking to LLVM |
||||
modules instead of dynamically linking. |
@ -1,21 +1,31 @@ |
||||
project('llvmtest', ['c', 'cpp'], default_options : ['c_std=c99']) |
||||
|
||||
llvm_dep = dependency( |
||||
'llvm', |
||||
modules : ['bitwriter', 'asmprinter', 'executionengine', 'target', |
||||
'mcjit', 'nativecodegen'], |
||||
required : true, |
||||
) |
||||
|
||||
d = dependency('llvm', modules : 'not-found', required : false) |
||||
assert(d.found() == false, 'not-found llvm module found') |
||||
|
||||
d = dependency('llvm', version : '<0.1', required : false) |
||||
assert(d.found() == false, 'ancient llvm module found') |
||||
|
||||
executable('sum', 'sum.c', dependencies : [ |
||||
llvm_dep, |
||||
dependency('zlib'), |
||||
meson.get_compiler('c').find_library('dl', required : false), |
||||
dependency('tinfo'), |
||||
]) |
||||
d = dependency('llvm', optional_modules : 'not-found', required : false) |
||||
assert(d.found() == true, 'optional module stopped llvm from being found.') |
||||
|
||||
foreach static : [true, false] |
||||
llvm_dep = dependency( |
||||
'llvm', |
||||
modules : ['bitwriter', 'asmprinter', 'executionengine', 'target', |
||||
'mcjit', 'nativecodegen'], |
||||
required : true, |
||||
static : static, |
||||
) |
||||
name = static ? 'static' : 'dynamic' |
||||
executable( |
||||
'sum-@0@'.format(name), |
||||
'sum.c', |
||||
dependencies : [ |
||||
llvm_dep, |
||||
dependency('zlib'), |
||||
dependency('glib-2.0'), |
||||
meson.get_compiler('c').find_library('dl', required : false), |
||||
] |
||||
) |
||||
endforeach |
||||
|
Loading…
Reference in new issue