diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 0000000..f4defa3 --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,21 @@ +pandoc = find_program('pandoc', required: get_option('docs')) +if pandoc.found() + doctitle = meson.project_name() + docauthor = 'Davy Kager' + + tolk_docs = custom_target('docs', + output : 'README.html', + input : 'README.md', + command : [pandoc, + '-s', '--toc', + '-M', 'title="@0@"'.format(doctitle), + '-M', 'author="@0@"'.format(docauthor), + '-r', 'markdown', '-w', 'html5', + '-o', '@OUTPUT@', '@INPUT@' + ], + install : true, + install_dir : get_option('datadir') / 'doc' / meson.project_name() + ) +endif + +summary('Documentation', pandoc.found()) diff --git a/meson-install.bat b/meson-install.bat new file mode 100644 index 0000000..46feb1e --- /dev/null +++ b/meson-install.bat @@ -0,0 +1,10 @@ +@echo off + +if %1 == x86_64 ( + set arch=x64 +) else ( + set arch=%1 +) + +copy %MESON_SOURCE_ROOT%\libs\%arch%\* %MESON_INSTALL_DESTDIR_PREFIX%\bin +copy %MESON_SOURCE_ROOT%\LICENSE* %MESON_INSTALL_DESTDIR_PREFIX%\share\doc\tolk diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..fdc5dd7 --- /dev/null +++ b/meson.build @@ -0,0 +1,21 @@ +project('tolk', ['c', 'cpp'], + version: '1.0', + license: 'lgpl-3-or-later', + default_options: ['warning_level=3'], + meson_version: '>=0.59.0', +) + +windows = import('windows') + +# Determine if we need JNI support +building_java = add_languages('java', native: false, required: get_option('java')) +building_jni = get_option('jni') or building_java +summary('JNI support', building_jni) + +subdir('src') + subdir('src/dotnet') + subdir('src/java') + subdir('src/python') + subdir('docs') + +meson.add_install_script('meson-install.bat', build_machine.cpu_family()) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..b0f07d1 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,5 @@ +option('jni', type : 'boolean', value : false, description: 'Build with Java Native Interface support') +option('dotnet', type : 'feature', value : 'auto', description: 'Build DotNet bindings') +option('python', type : 'feature', value : 'auto', description: 'Install Python bindings') +option('java', type : 'feature', value : 'auto', description: 'Build Java bindings. Implies -Djni=true') +option('docs', type : 'feature', value : 'auto', description: 'Build documentation using Pandoc') diff --git a/src/dotnet/meson.build b/src/dotnet/meson.build new file mode 100644 index 0000000..113fc73 --- /dev/null +++ b/src/dotnet/meson.build @@ -0,0 +1,14 @@ +building_dotnet = add_languages('cs', native: false, required: get_option('dotnet')) +if building_dotnet + tolkdotnet_srcs = ['Tolk.cs'] + tolkdotnet_res = windows.compile_resources('TolkDotNet.rc') + tolkdotnet_srcs += tolkdotnet_res + + tolkdotnet_lib = library('TolkDotNet', + sources: tolkdotnet_srcs, + cs_args: '/nologo', + install: true + ) +endif + +summary('DotNet', building_dotnet, section: 'Bindings') diff --git a/src/java/meson.build b/src/java/meson.build new file mode 100644 index 0000000..cf5fd24 --- /dev/null +++ b/src/java/meson.build @@ -0,0 +1,9 @@ +if building_java + tolk_jar_srcs = ['com/davykager/tolk/Tolk.java'] + tolk_jar = jar('Tolk', + sources: tolk_jar_srcs, + install: true + ) +endif + +summary('Java', building_java, section: 'Bindings') diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..17cc68a --- /dev/null +++ b/src/meson.build @@ -0,0 +1,34 @@ +tolk_srcs = [ + 'fsapi.c', + 'ScreenReaderDriverJAWS.cpp', + 'ScreenReaderDriverNVDA.cpp', + 'ScreenReaderDriverSA.cpp', + 'ScreenReaderDriverSAPI.cpp', + 'ScreenReaderDriverSNova.cpp', + 'ScreenReaderDriverWE.cpp', + 'ScreenReaderDriverZT.cpp', + 'Tolk.cpp', + 'wineyes.c', + 'zt.c', +] +tolk_cflags = ['-D_EXPORTING', '-DUNICODE'] +tolk_incdir = include_directories('.') + +if building_jni + tolk_cflags += ['-D_WITH_JNI'] + tolk_srcs += 'TolkJNI.cpp' +endif + +tolk_res = windows.compile_resources('Tolk.rc') +tolk_srcs += tolk_res + + tolk_lib = library('Tolk', + sources: tolk_srcs, + c_args: tolk_cflags, + cpp_args: tolk_cflags, + include_directories: tolk_incdir, + install: true +) + + # Make this project usable as a Meson subproject +tolk_dep = declare_dependency(link_with: tolk_lib, include_directories: tolk_incdir) diff --git a/src/python/meson.build b/src/python/meson.build new file mode 100644 index 0000000..26c87e6 --- /dev/null +++ b/src/python/meson.build @@ -0,0 +1,9 @@ +pymod = import('python', required: get_option('python')) +if pymod.found() + python = pymod.find_installation('python3', required: get_option('python')) + if python.found() + python.install_sources('Tolk.py') + endif +endif + +summary('Python', pymod.found() and python.found(), section: 'Bindings')