Be able to create a wrapper for java.

Android is a specific wrapper.
Java is another one.
This commit is contained in:
Matthieu Gautier 2020-01-27 15:38:50 +01:00
parent df9ddd5451
commit f09c739c1f
29 changed files with 27 additions and 16 deletions

View File

@ -5,13 +5,19 @@ project('kiwix-lib', 'cpp',
compiler = meson.get_compiler('cpp')
static_deps = get_option('android') or get_option('default_library') == 'static'
if get_option('android')
wrapper = get_option('wrapper')
static_deps = 'android' in wrapper or 'java' in wrapper or get_option('default_library') == 'static'
if 'android' in wrapper
extra_libs = ['-llog']
else
extra_libs = []
endif
if 'java' in wrapper
add_languages('java')
endif
thread_dep = dependency('threads')
libicu_dep = dependency('icu-i18n', static:static_deps)
libzim_dep = dependency('libzim', version : '>=5.0.0', static:static_deps)

View File

@ -1,2 +1,2 @@
option('android', type : 'boolean', value : false,
description : 'Do we make a kiwix-lib for android')
option('wrapper', type:'array', choices:['java', 'android'], value:[],
description: 'The wrapper to generate.')

View File

@ -32,13 +32,16 @@ else
kiwix_sources += 'subprocess_unix.cpp'
endif
if get_option('android')
subdir('android')
if 'android' in wrapper
install_dir = 'kiwix-lib/jniLibs/' + meson.get_cross_property('android_abi')
else
install_dir = get_option('libdir')
endif
if 'android' in wrapper or 'java' in wrapper
subdir('wrapper/java')
endif
config_h = configure_file(output : 'kiwix_config.h',
configuration : conf,
input : 'config.h.in')

View File

@ -25,16 +25,18 @@ kiwix_jni = custom_target('jni',
command:['javac', '-d', '@OUTDIR@', '-h', '@OUTDIR@', '@INPUT@']
)
kiwix_sources += [
'android/kiwixicu.cpp',
'android/book.cpp',
'android/kiwixreader.cpp',
'android/library.cpp',
'android/manager.cpp',
'android/filter.cpp',
'android/kiwixsearcher.cpp',
'android/kiwixserver.cpp',
kiwix_jni]
java_sources = files([
'kiwixicu.cpp',
'book.cpp',
'kiwixreader.cpp',
'library.cpp',
'manager.cpp',
'filter.cpp',
'kiwixsearcher.cpp',
'kiwixserver.cpp',
])
kiwix_sources += java_sources + [kiwix_jni]
install_subdir('org', install_dir: 'kiwix-lib/java')
install_subdir('res', install_dir: 'kiwix-lib')