2019-09-08 23:38:59 +02:00
|
|
|
project('Aegisub', ['c', 'cpp'],
|
|
|
|
license: 'BSD-3-Clause',
|
2019-01-30 23:07:39 +01:00
|
|
|
meson_version: '>=0.49.0',
|
2019-09-08 23:38:59 +02:00
|
|
|
default_options: ['c_std=c11', 'cpp_std=c++11', 'b_lto=true'],
|
|
|
|
version: '3.2.2')
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2019-01-30 23:47:33 +01:00
|
|
|
if host_machine.system() == 'windows'
|
2019-02-12 01:27:48 +01:00
|
|
|
version_sh = find_program('tools/version.ps1')
|
2019-01-30 23:47:33 +01:00
|
|
|
else
|
2019-02-12 01:27:48 +01:00
|
|
|
version_sh = find_program('tools/version.sh')
|
2019-01-30 23:47:33 +01:00
|
|
|
endif
|
|
|
|
version_inc = include_directories('.')
|
|
|
|
version_h = custom_target('git_version.h',
|
|
|
|
command: [version_sh, meson.source_root()],
|
|
|
|
build_by_default: true,
|
|
|
|
build_always_stale: true, # has internal check whether target file will be refreshed
|
|
|
|
output: ['git_version.h', 'git_version.xml'])
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2019-01-30 23:07:39 +01:00
|
|
|
dataroot = get_option('prefix') / get_option('datadir') / 'aegisub'
|
2019-01-30 22:58:31 +01:00
|
|
|
add_project_arguments('-DP_DATA="@0@"'.format(dataroot), language: 'cpp')
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2019-02-17 18:27:37 +01:00
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
add_project_arguments('-DNOMINMAX', '-D_WIN32_WINNT=0x0602', language: 'cpp')
|
|
|
|
endif
|
|
|
|
|
2017-11-15 17:25:11 +01:00
|
|
|
conf = configuration_data()
|
|
|
|
conf.set_quoted('P_DATA', dataroot)
|
2019-07-21 21:08:41 +02:00
|
|
|
if get_option('credit') != ''
|
|
|
|
conf.set_quoted('BUILD_CREDIT', get_option('credit'))
|
2017-11-15 17:25:11 +01:00
|
|
|
endif
|
|
|
|
conf.set('WITH_UPDATE_CHECKER', get_option('enable_update_checker'))
|
|
|
|
|
|
|
|
deps = []
|
2019-02-17 18:29:23 +01:00
|
|
|
deps_inc = []
|
2017-11-15 17:25:11 +01:00
|
|
|
|
|
|
|
if host_machine.system() == 'darwin'
|
2019-09-08 23:38:59 +02:00
|
|
|
add_languages('objc', 'objcpp')
|
|
|
|
add_project_arguments('-DGL_SILENCE_DEPRECATION', language: 'cpp')
|
|
|
|
# meson does not currently support objcpp_std
|
|
|
|
add_project_arguments('-std=c++11', language: 'objcpp')
|
2019-01-28 22:44:07 +01:00
|
|
|
elif host_machine.system() != 'windows'
|
2019-02-10 00:26:50 +01:00
|
|
|
deps += dependency('fontconfig')
|
2017-11-15 17:25:11 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
cxx = meson.get_compiler('cpp')
|
|
|
|
cc = meson.get_compiler('c')
|
2019-01-30 22:58:31 +01:00
|
|
|
deps += cc.find_library('m', required: false)
|
|
|
|
deps += cc.find_library('dl', required: false)
|
2019-02-17 18:24:35 +01:00
|
|
|
iconv_dep = cc.find_library('iconv', required: false)
|
|
|
|
if not iconv_dep.found() and host_machine.system() == 'windows'
|
|
|
|
iconv_sp = subproject('iconv') # this really needs to be replaced with a proper port
|
|
|
|
deps_inc += iconv_sp.get_variable('iconv_incs')
|
|
|
|
iconv_dep = iconv_sp.get_variable('libiconv_dep')
|
|
|
|
endif
|
|
|
|
deps += iconv_dep
|
2019-01-30 22:58:31 +01:00
|
|
|
|
2019-07-21 21:14:26 +02:00
|
|
|
deps += dependency('libass', version: '>=0.9.7',
|
|
|
|
fallback: ['libass', 'libass_dep'])
|
2019-02-10 00:26:50 +01:00
|
|
|
deps += dependency('boost', version: '>=1.50.0',
|
2019-01-30 22:58:31 +01:00
|
|
|
modules: ['chrono', 'filesystem', 'locale', 'regex',
|
|
|
|
'system', 'thread'])
|
2019-07-21 21:14:26 +02:00
|
|
|
deps += dependency('zlib', fallback: ['zlib', 'zlib_dep'])
|
|
|
|
|
2019-09-08 23:38:59 +02:00
|
|
|
wx_dep = dependency('wxWidgets', version: '>=3.0.0',
|
|
|
|
required: cxx.get_id() != 'msvc',
|
2019-07-21 21:14:26 +02:00
|
|
|
modules: ['std', 'stc', 'gl'])
|
2019-09-08 23:38:59 +02:00
|
|
|
if not wx_dep.found() # this will only be hit with msvc
|
|
|
|
if get_option('wx_path') != ''
|
|
|
|
deps_inc += include_directories(get_option('wx_path') / 'include' / 'msvc', get_option('wx_path') / 'include')
|
|
|
|
add_project_arguments('-DUNICODE', '-D_UNICODE', language: 'cpp')
|
|
|
|
add_project_arguments('-DwxMSVC_VERSION_AUTO', '-DWXUSINGDLL', language: 'cpp')
|
|
|
|
else
|
|
|
|
error('wxWidgets not found and no wx_path defined.')
|
|
|
|
endif
|
2019-07-21 21:14:26 +02:00
|
|
|
endif
|
|
|
|
deps += wx_dep
|
2019-02-10 00:26:50 +01:00
|
|
|
|
2019-09-08 23:38:59 +02:00
|
|
|
icu_uc_dep = dependency('icu-uc', version: '>=4.8.1.1', required: cxx.get_id() != 'msvc')
|
|
|
|
icu_i18n_dep = dependency('icu-i18n', version: '>=4.8.1.1', required: cxx.get_id() != 'msvc')
|
2019-07-21 21:14:26 +02:00
|
|
|
if not (icu_uc_dep.found() and icu_i18n_dep.found())
|
2019-09-08 23:38:59 +02:00
|
|
|
if get_option('icu_path') != ''
|
|
|
|
deps_inc += include_directories(get_option('icu_path') / 'include')
|
|
|
|
else
|
|
|
|
error('ICU not found and no icu_path defined.')
|
|
|
|
endif
|
2019-07-21 21:14:26 +02:00
|
|
|
endif
|
2019-09-08 23:38:59 +02:00
|
|
|
if not icu_uc_dep.found()
|
2019-07-21 21:14:26 +02:00
|
|
|
icu_uc_dep = cxx.find_library('icuuc', dirs: get_option('icu_path') / 'lib64')
|
|
|
|
endif
|
2019-02-10 00:26:50 +01:00
|
|
|
deps += icu_uc_dep
|
2019-07-21 21:14:26 +02:00
|
|
|
if not icu_i18n_dep.found()
|
|
|
|
icu_i18n_dep = cxx.find_library('icuin', dirs: get_option('icu_path') / 'lib64')
|
|
|
|
endif
|
2019-02-10 00:26:50 +01:00
|
|
|
deps += icu_i18n_dep
|
2017-11-15 17:25:11 +01:00
|
|
|
|
|
|
|
dep_avail = []
|
2019-01-30 22:58:31 +01:00
|
|
|
foreach dep: [
|
2017-11-15 17:25:11 +01:00
|
|
|
# audio, in order of precedence
|
|
|
|
['libpulse', '', 'PulseAudio'],
|
|
|
|
['alsa', '', 'ALSA'],
|
|
|
|
['portaudio-2.0', '', 'PortAudio'],
|
|
|
|
['openal', '>=0.0.8', 'OpenAL'],
|
|
|
|
# video
|
2019-07-21 21:14:26 +02:00
|
|
|
['ffms2', '', 'FFMS2'], # needs a proper port
|
2017-11-15 17:25:11 +01:00
|
|
|
# other
|
|
|
|
['fftw3', '', 'FFTW3'],
|
2019-07-21 21:14:26 +02:00
|
|
|
['hunspell', '', 'Hunspell'], # needs a proper port
|
|
|
|
['uchardet', '', 'uchardet'], # needs a proper port
|
2017-11-15 17:25:11 +01:00
|
|
|
]
|
2019-01-30 22:58:31 +01:00
|
|
|
d = dependency(dep[0], version: dep[1] != '' ? dep[1]: '>=0',
|
2019-02-10 00:26:50 +01:00
|
|
|
required: false)
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2019-02-17 18:27:06 +01:00
|
|
|
optname = dep[0].split('-')[0]
|
2019-02-10 00:28:32 +01:00
|
|
|
if d.found() and not get_option(optname).disabled()
|
2017-11-15 17:25:11 +01:00
|
|
|
deps += d
|
|
|
|
conf.set('WITH_@0@'.format(dep[0].split('-')[0].to_upper()), '1')
|
|
|
|
dep_avail += dep[2]
|
2019-02-10 00:28:32 +01:00
|
|
|
elif get_option(optname).enabled()
|
2017-11-15 17:25:11 +01:00
|
|
|
error('@0@ enabled but not found'.format(dep[2]))
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2019-02-17 18:25:57 +01:00
|
|
|
if host_machine.system() == 'windows' and not get_option('directsound').disabled()
|
|
|
|
dsound_dep = cc.find_library('dsound', required: get_option('directsound'))
|
|
|
|
winmm_dep = cc.find_library('winmm', required: get_option('directsound'))
|
|
|
|
ole32_dep = cc.find_library('ole32', required: get_option('directsound'))
|
|
|
|
have_dsound_h = cc.has_header('dsound.h')
|
|
|
|
if not have_dsound_h and get_option('directsound').enabled()
|
|
|
|
error('DirectSound enabled but dsound.h not found')
|
|
|
|
endif
|
|
|
|
if dsound_dep.found() and winmm_dep.found() and ole32_dep.found() and have_dsound_h
|
|
|
|
deps += [dsound_dep, winmm_dep, ole32_dep]
|
|
|
|
conf.set('WITH_DIRECTSOUND', '1')
|
|
|
|
dep_avail += 'DirectSound'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-09-08 23:38:59 +02:00
|
|
|
if host_machine.system() == 'darwin'
|
|
|
|
frameworks_dep = dependency('appleframeworks', modules : ['CoreText', 'CoreFoundation'])
|
|
|
|
deps += frameworks_dep
|
|
|
|
endif
|
|
|
|
|
2017-11-15 17:25:11 +01:00
|
|
|
# TODO: OSS
|
|
|
|
|
|
|
|
def_audio = get_option('default_audio_output')
|
|
|
|
if def_audio != 'auto'
|
|
|
|
if not dep_avail.contains(def_audio)
|
|
|
|
error('Default audio output "@0@" selected but not available'.format(def_audio))
|
|
|
|
endif
|
|
|
|
elif dep_avail.length() != 0
|
|
|
|
def_audio = dep_avail[0]
|
|
|
|
else
|
|
|
|
def_audio = ''
|
|
|
|
endif
|
|
|
|
|
|
|
|
conf_platform = configuration_data()
|
|
|
|
conf_platform.set('DEFAULT_PLAYER_AUDIO', def_audio)
|
|
|
|
|
2019-01-30 22:58:31 +01:00
|
|
|
luajit = dependency('luajit', version: '>=2.0.0', required: get_option('system_luajit'))
|
2017-11-15 17:25:11 +01:00
|
|
|
if luajit.found()
|
|
|
|
luajit_test = cc.run('''#include <lauxlib.h>
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
lua_State *L = luaL_newstate();
|
|
|
|
if (!L) return 1;
|
|
|
|
// This is valid in lua 5.2, but a syntax error in 5.1
|
|
|
|
const char testprogram[] = "function foo() while true do break return end end";
|
|
|
|
return luaL_loadstring(L, testprogram) == LUA_ERRSYNTAX;
|
2019-01-30 22:58:31 +01:00
|
|
|
}''', dependencies: luajit)
|
2017-11-15 17:25:11 +01:00
|
|
|
|
|
|
|
if luajit_test.returncode() == 1
|
|
|
|
if get_option('system_luajit')
|
|
|
|
error('System luajit found but not compiled in 5.2 mode')
|
|
|
|
else
|
|
|
|
message('System luajit found but not compiled in 5.2 mode; using built-in luajit')
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
deps += luajit
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
message('System luajit not found; using built-in luajit')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if not deps.contains(luajit)
|
|
|
|
luajit_sp = subproject('luajit')
|
|
|
|
luajit_inc = luajit_sp.get_variable('incdir')
|
|
|
|
deps += luajit_sp.get_variable('luajit_dep')
|
|
|
|
else
|
|
|
|
luajit_inc = include_directories(luajit.get_pkgconfig_variable('includedir'))
|
|
|
|
endif
|
|
|
|
subdir('vendor/luabins/src')
|
|
|
|
|
2019-01-30 22:58:31 +01:00
|
|
|
dep_gl = dependency('gl', required: false)
|
2017-11-15 17:25:11 +01:00
|
|
|
if not dep_gl.found()
|
|
|
|
if host_machine.system() == 'windows'
|
2019-01-30 22:58:31 +01:00
|
|
|
dep_gl = cc.find_library('opengl32', required: false)
|
2017-11-15 17:25:11 +01:00
|
|
|
else
|
2019-01-30 22:58:31 +01:00
|
|
|
dep_gl = cc.find_library('GL', required: false)
|
2017-11-15 17:25:11 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
if not cc.has_header('GL/gl.h')
|
2019-01-30 22:58:31 +01:00
|
|
|
dep_gl = dependency('', required: false)
|
2017-11-15 17:25:11 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if not dep_gl.found()
|
|
|
|
error('OpenGL implementation not found')
|
|
|
|
endif
|
|
|
|
|
|
|
|
deps += dep_gl
|
|
|
|
|
2019-09-08 23:38:59 +02:00
|
|
|
# TODO: csri
|
2019-07-21 21:14:26 +02:00
|
|
|
|
2019-01-30 22:58:31 +01:00
|
|
|
acconf = configure_file(output: 'acconf.h', configuration: conf)
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2017-11-15 19:20:08 +01:00
|
|
|
subdir('automation')
|
2017-11-15 17:25:11 +01:00
|
|
|
subdir('libaegisub')
|
2017-11-15 19:20:08 +01:00
|
|
|
subdir('packages')
|
2017-11-15 19:41:04 +01:00
|
|
|
subdir('po')
|
2017-11-15 17:25:11 +01:00
|
|
|
subdir('src')
|