Я создаю приложение, которое включает библиотеки gtk и libhandy. Я пытаюсь связать libhandy со своим проектом. Я использую систему сборки мезон. Чтобы добавить зависимость к meson, я выполнил следующую документацию отсюда: 1 < / а>
Я клонировал библиотеку libhandy в свой проект в project_root/subprojects/libhandy/
Вот мой project_root/meson.build
файл
project('githandytest', 'c',
version: '0.1.0',
meson_version: '>= 0.50.0',
default_options: [ 'warning_level=2',
'c_std=gnu11',
],
)
libhandy_dep = dependency('libhandy-0.0', version: '>= 0.0.13')
if not libhandy_dep.found()
libhandy = subproject(
'libhandy',
install: false,
default_options: [
'examples=false',
'package_subdir=my-project-name',
'tests=false',
]
)
libhandy_dep = libhandy.get_variable('libhandy_dep')
endif
i18n = import('i18n')
config_h = configuration_data()
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('GETTEXT_PACKAGE', 'githandytest')
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
configure_file(
output: 'githandytest-config.h',
configuration: config_h,
)
add_project_arguments([
'-I' + meson.build_root(),
], language: 'c')
subdir('data')
subdir('src')
subdir('po')
subdir('subprojects')
meson.add_install_script('build-aux/meson/postinstall.py')
Файл, в который я включаю <libhandy.h>
, - это main.c, расположенный в project_root/src
Вот project_root/src/meson.build
githandytest_sources = [
'main.c'
]
githandytest_deps = [
dependency('gio-2.0', version: '>= 2.50'),
dependency('gtk+-3.0', version: '>= 3.22'),
dependency('libhandy-0.0')
]
gnome = import('gnome')
executable('githandytest', githandytest_sources,
dependencies: githandytest_deps,
install: true,
)
Я также добавил исходники в манифест проекта, так как распространяю с помощью flatpak.
{
"app-id" : "org.example.App",
"runtime" : "org.gnome.Platform",
"runtime-version" : "3.38",
"sdk" : "org.gnome.Sdk",
"command" : "githandytest",
"finish-args" : [
"--share=network",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland"
],
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"*.la",
"*.a"
],
"modules" : [
{
"name" : "githandytest",
"builddir" : true,
"buildsystem" : "meson",
"sources" : [
{
"type" : "git",
"url" : "file:///home/davtyan/Projects/githandytest"
}
]
},
{
"name" : "libhandy",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"-Dexamples=false",
"-Dtests=false"
],
"sources" : [
{
"type" : "git",
"url" : "https://source.puri.sm/Librem5/libhandy.git"
}
]
}
]
}
При запуске проекта у меня возникает следующая проблема: project_root/meson.build:9:0: ERROR: Dependency "libhandy-0.0" not found, tried pkgconfig and cmake
Прошу прощения за такой расплывчатый вопрос. Я очень новичок в системе сборки мезонов и не могу понять, почему это происходит. Я использую среду разработки gnome-builder, если это помогает.