Skip to content
Snippets Groups Projects
Verified Commit d3ff3ff1 authored by Joe Donofry's avatar Joe Donofry
Browse files

Initial meson build support

parent e9cda740
No related branches found
No related tags found
No related merge requests found
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Build artifacts
/build*/
/generated-docs/
# Editor
tags
compile_commands.json
.exrc
.ccls-cache/
.clangd/
.*.sw*
.vscode
# Synapse data
/data/
# Deps
.third-party
.deps
subprojects/coeurl.wrap
subprojects/coeurl/
subprojects/libevent-*/
subprojects/libevent.wrap
subprojects/olm/
subprojects/packagecache/
subprojects/spdlog-*/
subprojects/lmdb++/
subprojects/lmdb-LMDB_*/
subprojects/nlohmann_json-*/
subprojects/nlohmann_json.wrap
subprojects/openssl-*/
subprojects/openssl.wrap
[submodule "subprojects/mtxclient"]
path = subprojects/mtxclient
url = https://github.com/Nheko-Reborn/mtxclient
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
//
// SPDX-License-Identifier: MIT
#pragma once
#include <mtx/events/event_type.hpp>
#include <mtx/events/presence.hpp>
#include <mtx/responses/crypto.hpp>
#include <mtxclient/crypto/types.hpp>
namespace mtx::responses {
struct Notifications;
}
namespace katzbox {
mtx::events::presence::Presence
presence(const std::string &user_id);
}
\ No newline at end of file
#pragma once
#include <string_view>
namespace katzbox {
namespace utils {
namespace log {
void
log_warning(const std::string_view &msg);
void
log_error(const std::string_view &msg);
}
}
}
#include <katzbox/log.hpp>
#include <iostream>
namespace katzbox::utils::log {
void
log_warning(const std::string_view &msg)
{
std::cerr << "warning:" << msg << "\n";
}
void
log_error(const std::string_view &msg)
{
std::cerr << "error:" << msg << "\n";
}
}
project(
'katzbox',
'cpp',
license: 'MIT',
version: '0.1.0',
default_options: ['cpp_std=c++17', 'default_library=static'],
meson_version: '>=0.59.0'
)
compiler = meson.get_compiler('cpp')
mtxclient_dep = dependency('mtxclient', version: '>= 0.6.0', fallback: ['mtxclient', 'matrix_client_dep'])
lmdb_dep = dependency('lmdb', include_type: 'system')
deps = [
mtxclient_dep,
lmdb_dep
]
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++', include_type: 'system')
endif
if not lmdbxx_dep.found()
error('lmdb++ not found and fallback was disabled. Check https://github.com/hoytech/lmdbxx')
endif
deps += lmdbxx_dep
inc = include_directories('include')
src = [
'lib/log.cpp'
]
katzbox = library('katzbox',
src,
dependencies: deps,
include_directories: inc,
install: true)
katzbox_dep = declare_dependency(
link_with: katzbox,
dependencies: deps,
include_directories: inc
)
meson.override_dependency('katzbox', katzbox_dep)
pkg = import('pkgconfig')
pkg.generate(katzbox,
libraries : [katzbox],
version : meson.project_version(),
filebase : meson.project_name(),
description : 'Nheko Storage Abstraction Layer',
url : 'https://github.com/Nheko-Reborn/katzbox)')
if get_option('examples')
subdir('examples')
endif
if get_option('tests')
subdir('tests')
endif
option('examples', type: 'boolean', value: false)
option('tests', type: 'boolean', value: false)
\ No newline at end of file
[wrap-git]
url = https://github.com/Nheko-Reborn/lmdbxx.git
revision = head
[wrap-file]
directory = lmdb-LMDB_0.9.29
source_url = https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_0.9.28.tar.gz
source_filename = lmdb-LMDB_0.9.29.tar.gz
source_hash = 22054926b426c66d8f2bc22071365df6e35f3aacf19ad943bc6167d4cae3bebb
patch_directory = lmdb
Subproject commit 1ae0f99d803932d4949f9c02850234eefffc0bc1
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('.', 'libraries/liblmdb')
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.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment