forked from enlightenment/edi
meson: add a option where to find the clang library and header
with having them people can just specify where the clang stuff is installed, if its not possible to find it in the default location. This fixes a bug where clang was not found, dirs: is meant as exclusive parameter, so if you specify there a custom directory, then only THIS specific directory will be used for the search. This fixes also that bug and only specifies that argument if a custom location is given.
This commit is contained in:
parent
70a5ee304b
commit
39203334d4
30
meson.build
30
meson.build
|
@ -40,17 +40,37 @@ else
|
|||
config_h.set_quoted('BEAR_COMMAND', '')
|
||||
endif
|
||||
|
||||
if get_option('libclang') == true and cc.has_header('clang-c/Index.h')
|
||||
has_clang_header = true
|
||||
clang = cc.find_library('clang', dirs : ['/usr/local/opt/llvm/lib'])
|
||||
opt_clang_header_dir = get_option('libclang-libdir')
|
||||
opt_clang_link_dir = get_option('libclang-headerdir')
|
||||
|
||||
if get_option('libclang') == true
|
||||
|
||||
#check for the header
|
||||
found = false
|
||||
if opt_clang_header_dir != ''
|
||||
found = cc.has_header('clang-c/Index.h', args : '-I'+opt_clang_header_dir)
|
||||
else
|
||||
found = cc.has_header('clang-c/Index.h')
|
||||
endif
|
||||
|
||||
if found == false
|
||||
error('Clang header not found!')
|
||||
endif
|
||||
|
||||
clang_inc = include_directories(opt_clang_header_dir)
|
||||
|
||||
#check for the library to link
|
||||
if opt_clang_link_dir != ''
|
||||
clang = cc.find_library('clang', dirs : [opt_clang_link_dir])
|
||||
else
|
||||
clang = cc.find_library('clang')
|
||||
endif
|
||||
|
||||
clang_include_dir_command = run_command(find_program('scripts/clang_include_dir.sh'))
|
||||
clang_include_dir = clang_include_dir_command.stdout().strip()
|
||||
|
||||
config_h.set_quoted('CLANG_INCLUDES', clang_include_dir)
|
||||
config_h.set('HAVE_LIBCLANG', '1')
|
||||
else
|
||||
has_clang_header = false
|
||||
endif
|
||||
|
||||
subdir('po')
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
option('libclang', type : 'boolean', value : true, description : 'Weather to have libclang support')
|
||||
option('bear', type : 'boolean', value : true, description : 'Weather to have bear support')
|
||||
option('libclang-libdir', type : 'string', value : '', description : 'Specify a none default location for your clang installation')
|
||||
option('libclang-headerdir', type : 'string', value : '', description : 'Specify a none default location for your clang installation')
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [[ -d /usr/local/opt/llvm ]]; then
|
||||
echo "/usr/local/opt/llvm/include"
|
||||
fi
|
||||
|
|
@ -28,14 +28,9 @@ endforeach
|
|||
deps = [elm, edi_lib, intl]
|
||||
incls = []
|
||||
|
||||
if get_option('libclang') == true and has_clang_header == true
|
||||
if get_option('libclang') == true
|
||||
deps += [clang]
|
||||
|
||||
clang_build_include_dir_command = run_command(find_program('../../scripts/clang_build_include_dir.sh'))
|
||||
clang_build_include_dir = clang_build_include_dir_command.stdout().strip()
|
||||
if clang_build_include_dir != ''
|
||||
incls += include_directories(clang_build_include_dir)
|
||||
endif
|
||||
incls += [clang_inc]
|
||||
endif
|
||||
|
||||
executable('edi', src,
|
||||
|
|
|
@ -13,8 +13,9 @@ check = dependency('check')
|
|||
|
||||
deps = [elm, check, edi_lib]
|
||||
|
||||
if get_option('libclang') == true and has_clang_header == true
|
||||
if get_option('libclang') == true
|
||||
deps += [clang]
|
||||
incls += [clang_inc]
|
||||
endif
|
||||
|
||||
exe = executable('edi_suite', src,
|
||||
|
|
Loading…
Reference in New Issue