mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 19:38:48 +03:00
lmdb and lmdb++ wraps
This commit is contained in:
parent
db4b8bc473
commit
cbe41e649e
5 changed files with 198 additions and 3 deletions
19
.gitignore
vendored
19
.gitignore
vendored
|
@ -8,6 +8,25 @@ cscope*
|
|||
.gdb_history
|
||||
.hunter
|
||||
|
||||
# subprojects
|
||||
|
||||
subprojects/Olm.wrap
|
||||
subprojects/Olm/
|
||||
subprojects/coeurl.wrap
|
||||
subprojects/coeurl/
|
||||
subprojects/curl-7.77.0/
|
||||
subprojects/curl.wrap
|
||||
subprojects/libevent-2.1.12-stable/
|
||||
subprojects/libevent.wrap
|
||||
subprojects/lmdb++/
|
||||
subprojects/lmdb-LMDB_0.9.29/
|
||||
subprojects/nlohmann_json-3.9.1/
|
||||
subprojects/nlohmann_json.wrap
|
||||
subprojects/openssl-1.1.1l/
|
||||
subprojects/openssl.wrap
|
||||
subprojects/packagecache/
|
||||
subprojects/spdlog-1.9.2/
|
||||
|
||||
# GTAGS
|
||||
GTAGS
|
||||
GRTAGS
|
||||
|
|
26
meson.build
26
meson.build
|
@ -3,9 +3,12 @@ project(
|
|||
'cpp',
|
||||
license: 'GPL-3.0-or-later',
|
||||
version: '0.9.0',
|
||||
default_options: ['cpp_std=c++17', 'b_pie=true', 'default_library=static']
|
||||
default_options: ['cpp_std=c++17', 'b_pie=true', 'default_library=static'],
|
||||
meson_version: '>=0.59.0'
|
||||
)
|
||||
|
||||
compiler = meson.get_compiler('cpp')
|
||||
|
||||
qt5 = import('qt5')
|
||||
qt5_dep = dependency('qt5', modules: ['Core', 'Qml', 'Quick', 'QuickWidgets', 'Widgets', 'DBus', 'Multimedia', 'Svg'], include_type: 'system')
|
||||
inc = include_directories('src', 'includes', 'third_party/cpp-httplib-0.5.12')
|
||||
|
@ -16,7 +19,7 @@ deps = [
|
|||
dependency('blurhash'),
|
||||
dependency('spdlog'),
|
||||
dependency('cmark'),
|
||||
dependency('lmdb'),
|
||||
dependency('lmdb', fallback: ['lmdb', 'lmdb_dep']),
|
||||
dependency('Qt5Keychain'),
|
||||
dependency('threads'),
|
||||
]
|
||||
|
@ -25,7 +28,24 @@ single_app_dep = subproject('SingleApplication-3.3.0').get_variable('singleappli
|
|||
|
||||
deps += [single_app_dep]
|
||||
|
||||
compiler = meson.get_compiler('cpp')
|
||||
lmdbxx_dep = dependency('', required : false)
|
||||
if compiler.has_header('lmdb++.h')
|
||||
lmdbxx_dep = declare_dependency()
|
||||
elif compiler.has_header('lmdbxx/lmdb++.h')
|
||||
lmdbxx_dep = declare_dependency(include_directories: 'lmdbxx')
|
||||
endif
|
||||
|
||||
if (not lmdbxx_dep.found()
|
||||
or get_option('wrap_mode') == 'forcefallback'
|
||||
or 'lmdbxx' in get_option('force_fallback_for'))
|
||||
lmdbxx_dep = dependency('lmdb++', fallback: 'lmdb++')
|
||||
endif
|
||||
|
||||
if not lmdbxx_dep.found()
|
||||
error('lmdb++ not found and fallback was disabled. Check https://github.com/hoytech/lmdbxx')
|
||||
endif
|
||||
deps += lmdbxx_dep
|
||||
|
||||
backtrace_check = '''#include<execinfo.h>
|
||||
#ifndef HAVE_BACKTRACE_SYMBOLS_FD
|
||||
#error "No backtrace support"
|
||||
|
|
4
subprojects/lmdb++.wrap
Normal file
4
subprojects/lmdb++.wrap
Normal file
|
@ -0,0 +1,4 @@
|
|||
[wrap-git]
|
||||
url = https://github.com/Nheko-Reborn/lmdbxx.git
|
||||
revision = head
|
||||
|
9
subprojects/lmdb.wrap
Normal file
9
subprojects/lmdb.wrap
Normal file
|
@ -0,0 +1,9 @@
|
|||
[wrap-file]
|
||||
directory = lmdb-LMDB_0.9.29
|
||||
|
||||
source_url = https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_0.9.29.tar.gz
|
||||
source_filename = lmdb-LMDB_0.9.29.tar.gz
|
||||
source_hash = 22054926b426c66d8f2bc22071365df6e35f3aacf19ad943bc6167d4cae3bebb
|
||||
|
||||
patch_directory = lmdb
|
||||
|
143
subprojects/packagefiles/lmdb/meson.build
Normal file
143
subprojects/packagefiles/lmdb/meson.build
Normal file
|
@ -0,0 +1,143 @@
|
|||
project(
|
||||
'liblmdb', 'c',
|
||||
version: '0.9.28',
|
||||
default_options: [
|
||||
'warning_level=2'
|
||||
],
|
||||
license: 'OpenLDAP',
|
||||
meson_version: '>= 0.54.0'
|
||||
)
|
||||
|
||||
liblmdb_name = meson.project_name()
|
||||
liblmdb_version = meson.project_version()
|
||||
liblmdb_soversion = 0
|
||||
liblmdb_libversion = '0.0.0'
|
||||
|
||||
message('Building ' + liblmdb_name + ' ' + liblmdb_version)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
host_system = host_machine.system()
|
||||
arch = host_machine.cpu_family()
|
||||
|
||||
# Compiler flags
|
||||
if cc.get_id() == 'msvc'
|
||||
test_cflags = []
|
||||
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
test_cflags = [
|
||||
'-Wno-unused-parameter',
|
||||
'-Wbad-function-cast',
|
||||
'-Wuninitialized',
|
||||
]
|
||||
else
|
||||
test_cflags = []
|
||||
endif
|
||||
|
||||
common_cflags = []
|
||||
foreach cflag: test_cflags
|
||||
if cc.has_argument(cflag)
|
||||
common_cflags += [ cflag ]
|
||||
endif
|
||||
endforeach
|
||||
|
||||
extra_args = []
|
||||
if cc.get_id() == 'msvc'
|
||||
extra_args += '-D_CRT_SECURE_NO_WARNINGS'
|
||||
endif
|
||||
|
||||
thread_dep = dependency('threads')
|
||||
|
||||
lmdb_public_headers = files(
|
||||
'libraries/liblmdb/lmdb.h',
|
||||
)
|
||||
|
||||
lmdb_headers = files(
|
||||
'libraries/liblmdb/midl.h'
|
||||
)
|
||||
|
||||
lmdb_sources = files(
|
||||
'libraries/liblmdb/mdb.c',
|
||||
'libraries/liblmdb/midl.c',
|
||||
)
|
||||
|
||||
install_headers(lmdb_public_headers)
|
||||
|
||||
lmdb_name_suffix = []
|
||||
if cc.get_id() == 'msvc'
|
||||
lmdb_name_suffix = 'lib'
|
||||
endif
|
||||
|
||||
lmdb_inc = include_directories('.')
|
||||
lmdb = library(
|
||||
'lmdb',
|
||||
[ lmdb_public_headers, lmdb_headers, lmdb_sources ],
|
||||
include_directories: lmdb_inc,
|
||||
dependencies: thread_dep,
|
||||
version: liblmdb_libversion,
|
||||
soversion: liblmdb_soversion,
|
||||
install: true,
|
||||
c_args: common_cflags,
|
||||
vs_module_defs: 'libraries/liblmdb/lmdb.def',
|
||||
)
|
||||
|
||||
lmdb_dep = declare_dependency(
|
||||
link_with: lmdb,
|
||||
include_directories: lmdb_inc,
|
||||
)
|
||||
meson.override_dependency('lmdb', lmdb_dep)
|
||||
|
||||
programs = []
|
||||
if host_system != 'windows'
|
||||
programs += [
|
||||
'mdb_stat',
|
||||
'mdb_copy',
|
||||
'mdb_dump',
|
||||
'mdb_load',
|
||||
]
|
||||
endif
|
||||
|
||||
foreach program: programs
|
||||
executable(
|
||||
program, 'libraries/liblmdb/' + program + '.c',
|
||||
dependencies: lmdb_dep,
|
||||
include_directories: lmdb_inc,
|
||||
install: true,
|
||||
c_args: common_cflags,
|
||||
)
|
||||
endforeach
|
||||
|
||||
test_programs = [
|
||||
'mtest',
|
||||
'mtest2',
|
||||
'mtest3',
|
||||
'mtest4',
|
||||
'mtest5',
|
||||
]
|
||||
|
||||
foreach test_program: test_programs
|
||||
exe = executable(
|
||||
test_program, 'libraries/liblmdb/' + test_program + '.c',
|
||||
dependencies: lmdb_dep,
|
||||
include_directories: lmdb_inc,
|
||||
c_args: common_cflags + extra_args,
|
||||
)
|
||||
test(test_program, exe, args: [ '--tap', '-k' ])
|
||||
endforeach
|
||||
|
||||
if host_system != 'windows'
|
||||
man_files = files(
|
||||
'libraries/liblmdb/mdb_stat.1',
|
||||
'libraries/liblmdb/mdb_copy.1',
|
||||
'libraries/liblmdb/mdb_dump.1',
|
||||
'libraries/liblmdb/mdb_load.1',
|
||||
)
|
||||
|
||||
install_man(man_files)
|
||||
endif
|
||||
|
||||
# Generate pc file
|
||||
pkg = import('pkgconfig')
|
||||
|
||||
pkg.generate(lmdb,
|
||||
name: liblmdb_name,
|
||||
filebase: 'lmdb',
|
||||
description: 'Lightning Memory-Mapped Database.')
|
Loading…
Reference in a new issue