feat(core): update icu dependencies 🙀

- enable icui18n
- .. without breaking anything else in ldml tests

For: #9121
This commit is contained in:
Steven R. Loomis 2023-08-08 18:45:03 -05:00
parent 1472bc56b1
commit 5c38b18395
6 changed files with 40 additions and 27 deletions

View file

@ -11,6 +11,16 @@
#include <string>
#include "kmx/kmx_xstring.h"
#if defined(HAVE_ICU4C)
// TODO-LDML: Needed this for some compiler warnings
#define U_FALLTHROUGH
#include "unicode/uniset.h"
#include "unicode/usetiter.h"
#include "unicode/regex.h"
#else
#error icu4c is required for this code
#endif
#ifndef assert
#define assert(x) // TODO-LDML

View file

@ -21,6 +21,27 @@ if cpp_compiler.get_id() == 'emscripten'
defns += ['-DKMN_KBP']
endif
# ICU4C is used for repertoire tests and core implementation
if target_machine.system() == 'linux'
# use pkg-config when targetting linux
pkgconfig = 'pkg-config'
icu_uc = dependency('icu-uc', required: true)
icu_i18n = dependency('icu-i18n', required: true)
else
# load ICU from wrap
# Requires meson of about 0.57+
icu4c = subproject('icu-minimal', default_options: [ 'default_library=static', 'cpp_std=c++17', 'warning_level=0',
'werror=false']) # TODO-LDML: options: static, no data (these are in the meson build files)
icu_uc = icu4c.get_variable('icuuc_dep')
icu_i18n = icu4c.get_variable('icui18n_dep')
endif
if icu_uc.found()
defns += '-DHAVE_ICU4C'
endif
kmx_files = files(
'option.cpp',
'keyboard.cpp',
@ -85,11 +106,13 @@ lib = library('kmnkbp0',
version: lib_version,
include_directories: inc,
pic: true,
install: true)
install: true,
dependencies: [icu_uc, icu_i18n],
)
headerdirs = [ '.', 'keyman' ] # subdirectories of ${prefix}/include to add to header path
kmnkbp = declare_dependency(link_with: lib, include_directories: inc)
kmnkbp = declare_dependency(link_with: lib, include_directories: inc, dependencies: [icu_uc, icu_i18n])
pkg = import('pkgconfig')
pkg.generate(

View file

@ -10,5 +10,4 @@ patch_directory = icu
[provide]
icu-uc = icuuc_dep
# TODO-LDML: not including i18n at present
#icu-i18n = icui18n_dep
icu-i18n = icui18n_dep

View file

@ -9,8 +9,7 @@ endif
subdir('stubdata')
subdir('common')
# TODO-LDML: Not used now, will need for regex
# subdir('i18n')
subdir('i18n')
## Note: The following subdirs are not used by Keyman (at present)

View file

@ -25,7 +25,6 @@
#include "ldml/keyboardprocessor_ldml.h"
#include "ldml/ldml_processor.hpp"
#include "path.hpp"
#include "state.hpp"
#include "utfcodec.hpp"

View file

@ -4,25 +4,6 @@
# Authors: Marc Durdin
#
# ICU4C is used for repertoire tests
if target_machine.system() == 'linux'
# use pkg-config when targetting linux
pkgconfig = 'pkg-config'
icu_uc = dependency('icu-uc', required: true)
else
# load ICU from wrap
# Requires meson of about 0.57+
icu4c = subproject('icu-minimal', default_options: [ 'default_library=static', 'cpp_std=c++17', 'warning_level=0',
'werror=false']) # TODO-LDML: options: static, no data (these are in the meson build files)
icu_uc = icu4c.get_variable('icuuc_dep')
endif
if icu_uc.found()
defns += '-DHAVE_ICU4C'
endif
# TODO -- why are these differing from the standard.meson.build flags?
if cpp_compiler.get_id() == 'gcc' or cpp_compiler.get_id() == 'clang' or cpp_compiler.get_id() == 'emscripten'
warns = [
@ -75,8 +56,9 @@ ldml = executable('ldml',
cpp_args: defns + warns,
include_directories: [inc, libsrc, '../../../../developer/src/ext/json'],
link_args: links + tests_flags,
objects: lib.extract_all_objects(recursive: false),
dependencies: [icu_uc],
# link_with: [lib],
objects: lib.extract_all_objects(recursive: false),
)
# Run tests on all keyboards (`tests` defined in keyboards/meson.build)
@ -110,5 +92,6 @@ t = executable('test_transforms', 'test_transforms.cpp',
cpp_args: defns + warns,
include_directories: [inc, libsrc, '../../../../developer/src/ext/json'],
link_args: links + tests_flags,
dependencies: [icu_uc],
objects: lib.extract_all_objects(recursive: false))
test('test_transforms', t, suite: 'ldml')