mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-02 13:47:42 +00:00
Add meson.build scripts
This is a temporary set of build scripts for the keyboard processor work, until a cross platform build system is settled on for the whole keyman project.
This commit is contained in:
parent
0fd8a7d18b
commit
9aa6e7a70d
7 changed files with 117 additions and 5 deletions
|
|
@ -54,9 +54,9 @@ All calls, types and enums are prefixed with the namespace identifier `km_kbp_`
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define KM_KBP_LIB_CURRENT 0
|
||||
#define KM_KBP_LIB_AGE 0
|
||||
#define KM_KBP_LIB_REVISION 0
|
||||
#define KM_KBP_LIB_CURRENT @lib_curr@
|
||||
#define KM_KBP_LIB_AGE @lib_age@
|
||||
#define KM_KBP_LIB_REVISION @lib_rev@
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
|
|
@ -572,8 +572,6 @@ km_kbp_option_set *km_kpb_state_options(km_kbp_state const *);
|
|||
*/
|
||||
km_kbp_action_item const * km_kbp_state_action_items(km_kbp_state const *,
|
||||
size_t *num_items);
|
||||
/*```
|
||||
*/
|
||||
|
||||
/*
|
||||
```
|
||||
15
keyboardprocessor/include/meson.build
Normal file
15
keyboardprocessor/include/meson.build
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
ver = meson.project_version().split('.')
|
||||
|
||||
cfg = configuration_data()
|
||||
cfg.set('lib_curr', ver[0])
|
||||
cfg.set('lib_age', ver[1])
|
||||
cfg.set('lib_rev', ver[2])
|
||||
|
||||
configure_file(
|
||||
configuration: cfg,
|
||||
input: 'keyboardprocessor.h.in',
|
||||
output: 'keyboardprocessor.h',
|
||||
)
|
||||
|
||||
install_headers(join_paths(meson.current_build_dir(), 'keyboardprocessor.h'),
|
||||
subdir: 'keyman')
|
||||
15
keyboardprocessor/meson.build
Normal file
15
keyboardprocessor/meson.build
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
project('keyboardprocessor', 'cpp', 'c',
|
||||
version: '0.0.0',
|
||||
license: 'MIT',
|
||||
default_options : ['buildtype=release',
|
||||
'cpp_std=c++14'])
|
||||
|
||||
compiler = meson.get_compiler('cpp')
|
||||
|
||||
py = import('python3')
|
||||
python = py.find_python()
|
||||
|
||||
inc = include_directories('include', is_system: true)
|
||||
subdir('include')
|
||||
subdir('src')
|
||||
subdir('tests')
|
||||
60
keyboardprocessor/src/meson.build
Normal file
60
keyboardprocessor/src/meson.build
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
defns = []
|
||||
|
||||
if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang'
|
||||
warns = [
|
||||
'-Wall',
|
||||
'-Wctor-dtor-privacy',
|
||||
'-Wdouble-promotion',
|
||||
'-Wendif-labels',
|
||||
'-Wextra',
|
||||
'-Wno-unknown-pragmas',
|
||||
'-Wnon-virtual-dtor',
|
||||
'-Wshadow'
|
||||
]
|
||||
flags = [
|
||||
'-fvisibility=hidden',
|
||||
'-fvisibility-inlines-hidden'
|
||||
]
|
||||
|
||||
if compiler.get_id() == 'clang'
|
||||
warns += [
|
||||
'-Wimplicit-fallthrough',
|
||||
'-Wno-double-promotion',
|
||||
'-Wshorten-64-to-32'
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'darwin'
|
||||
warns += ['-Wno-ctor-dtor-privacy', '-Wno-non-virtual-dtor ']
|
||||
endif
|
||||
endif
|
||||
|
||||
if compiler.get_id() == 'msvc'
|
||||
warns = []
|
||||
flags = []
|
||||
defns = [
|
||||
'-D_SCL_SECURE_NO_WARNINGS',
|
||||
'-D_CRT_SECURE_NO_WARNINGS',
|
||||
'-DUNICODE'
|
||||
]
|
||||
endif
|
||||
|
||||
pkg = import('pkgconfig')
|
||||
pkg.generate(
|
||||
name: 'keyman_kmn_processor',
|
||||
version: meson.project_version(),
|
||||
description: 'Keyman processor for KMN keyboards.')
|
||||
|
||||
lib = library('kmnkbp0',
|
||||
'keyboardprocessor.cpp',
|
||||
'km_kbp_context_api.cpp',
|
||||
'km_kbp_keyboard_api.cpp',
|
||||
'km_kbp_options_api.cpp',
|
||||
'json.cpp',
|
||||
cpp_args: defns + warns + flags,
|
||||
link_args: ['-lstdc++fs'],
|
||||
version: meson.project_version(),
|
||||
include_directories: inc,
|
||||
install: true)
|
||||
|
||||
#kmnkbd = declare_dependency(link_with: lib, include_directories: inc)
|
||||
16
keyboardprocessor/tests/meson.build
Normal file
16
keyboardprocessor/tests/meson.build
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
cmpfiles = ['-c', 'import sys, filecmp; exit(not filecmp.cmp(*sys.argv[1:]))']
|
||||
stnds = join_paths(meson.source_root(), 'tests', 'standards')
|
||||
|
||||
libsrc = include_directories(join_paths('../', 'src'))
|
||||
|
||||
if get_option('default_library') != 'static'
|
||||
ctypes_void_p_size = ['-c', 'import ctypes; print(ctypes.sizeof(ctypes.c_void_p))']
|
||||
r = run_command(python, ctypes_void_p_size)
|
||||
python_ctypes_compatible = r.stdout().to_int() == compiler.sizeof('void *')
|
||||
if not python_ctypes_compatible
|
||||
message('Python ctypes is incompatible with built shared object. Disabling some tests.')
|
||||
endif
|
||||
endif
|
||||
|
||||
subdir('unit/json')
|
||||
subdir('unit/utftest')
|
||||
6
keyboardprocessor/tests/unit/json/meson.build
Normal file
6
keyboardprocessor/tests/unit/json/meson.build
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
e = executable('jsontest', 'jsontest.cpp',
|
||||
include_directories: [inc, libsrc],
|
||||
objects: lib.extract_objects('json.cpp'))
|
||||
test('jsontest', e, args: 'jsontest.json')
|
||||
test('jsontestOutput', python, is_parallel: false, args:
|
||||
cmpfiles + ['jsontest.json', join_paths(stnds, 'jsontest.json')])
|
||||
2
keyboardprocessor/tests/unit/utftest/meson.build
Normal file
2
keyboardprocessor/tests/unit/utftest/meson.build
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
e = executable('utftest', 'utftest.cpp', include_directories: [inc, libsrc])
|
||||
test('utftest', e)
|
||||
Loading…
Add table
Reference in a new issue