Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Tolk to the Meson Build System #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/meson.build
Original file line number Diff line number Diff line change
@@ -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())
10 changes: 10 additions & 0 deletions meson-install.bat
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -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())
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -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')
14 changes: 14 additions & 0 deletions src/dotnet/meson.build
Original file line number Diff line number Diff line change
@@ -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')
9 changes: 9 additions & 0 deletions src/java/meson.build
Original file line number Diff line number Diff line change
@@ -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')
34 changes: 34 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions src/python/meson.build
Original file line number Diff line number Diff line change
@@ -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')