mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
Also: - Add fallback subprojects so that auto_features can take effect. - Remove -Dall option. auto_features can be used instead. - Add _dep suffix to dependency names. - Capitalize dependencies that are used in other meson.build files.
73 lines
2.1 KiB
Meson
73 lines
2.1 KiB
Meson
project('netconf')
|
|
cpp = meson.get_compiler('cpp')
|
|
SYSTEM = build_machine.system()
|
|
|
|
netconf_deps = {}
|
|
|
|
foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
|
|
netconf_deps = netconf_deps + {dep: dependency(dep, required: false)}
|
|
if netconf_deps[dep].found()
|
|
continue
|
|
endif
|
|
|
|
# Try adding lib to it. libyang and libyang-cpp define the wrong pkg-config.
|
|
netconf_deps = netconf_deps + {
|
|
dep: dependency('lib' + dep, required: false),
|
|
}
|
|
if netconf_deps[dep].found()
|
|
continue
|
|
endif
|
|
|
|
# Search in /opt.
|
|
foreach prefix : ['', 'lib']
|
|
path = f'/opt/@prefix@@dep@'
|
|
lib = cpp.find_library(dep, dirs: [f'/@path@/lib'], required: false)
|
|
if lib.found()
|
|
netconf_deps = netconf_deps + {
|
|
dep: declare_dependency(
|
|
dependencies: [lib],
|
|
include_directories: include_directories(f'/@path@/include'),
|
|
variables: {'prefix': f'@path@'},
|
|
),
|
|
}
|
|
if SYSTEM == 'darwin'
|
|
add_project_link_arguments(
|
|
f'-Wl,-rpath,@path@/lib',
|
|
language: 'cpp',
|
|
)
|
|
else
|
|
add_project_link_arguments(
|
|
f'-Wl,-rpath=@path@/lib',
|
|
language: 'cpp',
|
|
)
|
|
endif
|
|
endif
|
|
endforeach
|
|
endforeach
|
|
|
|
all_deps_found = true
|
|
foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
|
|
if not netconf_deps[dep].found()
|
|
all_deps_found = false
|
|
break
|
|
endif
|
|
endforeach
|
|
|
|
if all_deps_found
|
|
netconf = declare_dependency(
|
|
dependencies: [
|
|
netconf_deps['yang'],
|
|
netconf_deps['yang-cpp'],
|
|
netconf_deps['sysrepo'],
|
|
netconf_deps['sysrepo-cpp'],
|
|
],
|
|
variables: {
|
|
'libyang_prefix': netconf_deps['yang'].found() ? netconf_deps['yang'].get_variable('prefix') : 'unknown',
|
|
'sysrepo_prefix': netconf_deps['sysrepo'].found() ? netconf_deps['sysrepo'].get_variable('prefix') : 'unknown',
|
|
},
|
|
)
|
|
else
|
|
netconf = disabler()
|
|
endif
|
|
|