2019-09-08 23:38:59 +02:00
|
|
|
project('Aegisub', ['c', 'cpp'],
|
|
|
|
license: 'BSD-3-Clause',
|
2023-10-13 23:46:11 +02:00
|
|
|
meson_version: '>=1.0.0',
|
2021-05-24 15:47:34 +02:00
|
|
|
default_options: ['cpp_std=c++14', 'buildtype=debugoptimized'],
|
2019-09-08 23:38:59 +02:00
|
|
|
version: '3.2.2')
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2020-04-11 01:27:16 +02:00
|
|
|
cmake = import('cmake')
|
|
|
|
|
2020-10-28 05:15:02 +01:00
|
|
|
if host_machine.system() == 'windows'
|
2022-08-10 15:09:41 +02:00
|
|
|
add_project_arguments('-DNOMINMAX', language: 'cpp')
|
2023-07-24 20:35:38 +02:00
|
|
|
add_project_arguments('-DUNICODE', language: 'cpp')
|
2021-01-30 15:12:13 +01:00
|
|
|
|
|
|
|
if not get_option('csri').disabled()
|
|
|
|
add_global_arguments('-DCSRI_NO_EXPORT', language: 'c')
|
|
|
|
endif
|
2021-01-30 18:11:34 +01:00
|
|
|
|
|
|
|
sys_nasm = find_program('nasm', required: false)
|
|
|
|
if not sys_nasm.found()
|
|
|
|
nasm = subproject('nasm').get_variable('nasm')
|
|
|
|
meson.override_find_program('nasm', nasm)
|
|
|
|
endif
|
2020-10-28 05:15:02 +01:00
|
|
|
endif
|
|
|
|
|
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',
|
2020-10-27 20:31:58 +01:00
|
|
|
command: [version_sh, meson.current_build_dir(), meson.current_source_dir()],
|
2019-01-30 23:47:33 +01:00
|
|
|
build_by_default: true,
|
|
|
|
build_always_stale: true, # has internal check whether target file will be refreshed
|
2020-11-19 18:33:20 +01:00
|
|
|
output: ['git_version.h'])
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2020-11-08 18:33:37 +01:00
|
|
|
if host_machine.system() == 'darwin' and get_option('build_osx_bundle')
|
|
|
|
prefix = meson.current_build_dir() / 'Aegisub.app' / 'Contents'
|
|
|
|
bindir = prefix / 'MacOS'
|
|
|
|
datadir = prefix / 'SharedSupport'
|
|
|
|
localedir = prefix / 'Resources'
|
2021-01-30 22:22:05 +01:00
|
|
|
dataroot = datadir
|
2020-11-08 18:33:37 +01:00
|
|
|
else
|
|
|
|
prefix = get_option('prefix')
|
|
|
|
bindir = prefix / get_option('bindir')
|
|
|
|
datadir = prefix / get_option('datadir')
|
|
|
|
localedir = prefix / get_option('localedir')
|
2021-01-30 22:22:05 +01:00
|
|
|
dataroot = datadir / 'aegisub'
|
2020-11-08 18:33:37 +01:00
|
|
|
endif
|
|
|
|
docdir = prefix / 'doc'
|
2017-11-15 17:25:11 +01:00
|
|
|
|
2020-12-24 22:57:08 +01:00
|
|
|
# MSVC sets this automatically with -MDd, but it has a different meaning on other platforms
|
|
|
|
if get_option('debug') and host_machine.system() != 'windows'
|
2020-11-19 19:37:41 +01:00
|
|
|
add_project_arguments('-D_DEBUG', language: 'cpp')
|
|
|
|
endif
|
|
|
|
|
2023-01-26 21:04:04 +01:00
|
|
|
if get_option('buildtype') == 'release'
|
|
|
|
add_project_arguments('-DNDEBUG', language: 'cpp')
|
|
|
|
endif
|
|
|
|
|
2017-11-15 17:25:11 +01:00
|
|
|
conf = configuration_data()
|
2023-04-21 16:23:01 +02:00
|
|
|
conf.set_quoted('P_BIN', bindir)
|
2017-11-15 17:25:11 +01:00
|
|
|
conf.set_quoted('P_DATA', dataroot)
|
2021-01-21 10:56:47 +01:00
|
|
|
conf.set_quoted('P_LOCALE', localedir)
|
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
|
2023-04-21 16:23:01 +02:00
|
|
|
if get_option('build_appimage')
|
|
|
|
conf.set('APPIMAGE_BUILD', 1)
|
|
|
|
endif
|
2017-11-15 17:25:11 +01:00
|
|
|
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')
|
2021-01-09 09:18:11 +01:00
|
|
|
# meson neither supports objcpp_std nor inherits cpp_std https://github.com/mesonbuild/meson/issues/5495
|
2019-09-08 23:38:59 +02:00
|
|
|
add_project_arguments('-std=c++11', language: 'objcpp')
|
2019-01-28 22:44:07 +01:00
|
|
|
elif host_machine.system() != 'windows'
|
2021-01-30 14:56:01 +01:00
|
|
|
conf.set('WITH_FONTCONFIG', 1)
|
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)
|
2021-02-22 18:25:36 +01:00
|
|
|
|
meson: use best practices lookup for iconv support
Meson 0.60.0 adds support for an "iconv" dependency that always does the
right thing for you, so that you don't need to think about it. It also
has some side advantages:
- you can do dependency fallback, and --force-fallback-for=iconv works
- it logs one line, not two, and that is "dependency found? yes or no"
Since Aegisub doesn't mandate the use of such new versions of Meson, we
cannot assume the dependency works. Instead, adapt to the version of
Meson being used: on new enough versions of Meson, use the new
dependency, but on older versions of Meson, use the pre-existing logic,
which isn't as nice but has been producing correct results so far.
2022-07-07 06:03:22 +02:00
|
|
|
if meson.version().version_compare('>=0.60.0')
|
|
|
|
iconv_dep = dependency('iconv', fallback: ['iconv', 'libiconv_dep'])
|
|
|
|
else
|
|
|
|
iconv_dep = cc.find_library('iconv', required: false)
|
|
|
|
if not (iconv_dep.found() or cc.has_function('iconv_open'))
|
|
|
|
iconv_sp = subproject('iconv') # this really needs to be replaced with a proper port
|
|
|
|
iconv_dep = iconv_sp.get_variable('libiconv_dep')
|
|
|
|
endif
|
2019-02-17 18:24:35 +01:00
|
|
|
endif
|
2021-02-22 18:25:36 +01:00
|
|
|
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-10-27 02:29:31 +01:00
|
|
|
|
2020-10-27 18:13:11 +01:00
|
|
|
boost_modules = ['chrono', 'filesystem', 'thread', 'locale', 'regex']
|
|
|
|
if not get_option('local_boost')
|
2023-04-21 16:23:01 +02:00
|
|
|
boost_dep = dependency('boost', version: '>=1.60.0',
|
2020-11-15 18:43:26 +01:00
|
|
|
modules: boost_modules + ['system'],
|
2020-11-15 18:42:12 +01:00
|
|
|
required: false,
|
2020-10-27 18:13:11 +01:00
|
|
|
static: get_option('default_library') == 'static')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('local_boost') or not boost_dep.found()
|
|
|
|
boost_dep = []
|
|
|
|
boost = subproject('boost')
|
|
|
|
foreach module: boost_modules
|
|
|
|
boost_dep += boost.get_variable('boost_' + module + '_dep')
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
|
|
|
deps += boost_dep
|
2019-10-27 02:29:31 +01:00
|
|
|
if host_machine.system() == 'windows'
|
2021-01-30 14:56:01 +01:00
|
|
|
conf.set('BOOST_USE_WINDOWS_H', 1)
|
2019-10-27 02:29:31 +01:00
|
|
|
endif
|
|
|
|
|
2020-10-27 18:02:31 +01:00
|
|
|
deps += dependency('zlib')
|
2019-07-21 21:14:26 +02:00
|
|
|
|
2021-04-09 22:51:14 +02:00
|
|
|
wx_minver = '>=' + get_option('wx_version')
|
2021-01-09 09:18:11 +01:00
|
|
|
if host_machine.system() == 'darwin'
|
|
|
|
wx_minver = '>=3.1.0'
|
|
|
|
endif
|
|
|
|
wx_dep = dependency('wxWidgets', version: wx_minver,
|
2020-11-08 19:04:16 +01:00
|
|
|
required: false,
|
2019-07-21 21:14:26 +02:00
|
|
|
modules: ['std', 'stc', 'gl'])
|
2020-04-11 01:27:16 +02:00
|
|
|
|
|
|
|
if wx_dep.found()
|
|
|
|
deps += wx_dep
|
2020-11-08 18:58:07 +01:00
|
|
|
else
|
2021-05-24 15:47:34 +02:00
|
|
|
build_shared = true
|
2020-11-08 18:58:07 +01:00
|
|
|
if get_option('default_library') == 'static'
|
2021-05-24 15:47:34 +02:00
|
|
|
build_shared = false
|
2020-11-08 18:58:07 +01:00
|
|
|
endif
|
2020-11-22 22:30:18 +01:00
|
|
|
build_type = 'Release'
|
|
|
|
if get_option('buildtype') == 'debug'
|
|
|
|
build_type = 'Debug'
|
|
|
|
endif
|
2020-04-11 01:27:16 +02:00
|
|
|
|
2021-05-24 15:47:34 +02:00
|
|
|
opt_var = cmake.subproject_options()
|
|
|
|
opt_var.add_cmake_defines({
|
|
|
|
'wxBUILD_INSTALL': false,
|
2023-07-24 20:35:38 +02:00
|
|
|
'wxBUILD_PRECOMP': 'OFF', # otherwise breaks project generation w/ meson
|
2021-05-24 15:47:34 +02:00
|
|
|
'wxBUILD_SHARED': build_shared,
|
|
|
|
|
|
|
|
'wxUSE_WEBVIEW': false, # breaks build on linux
|
2023-07-24 20:35:38 +02:00
|
|
|
'wxUSE_REGEX': 'builtin',
|
2021-05-24 15:47:34 +02:00
|
|
|
'CMAKE_BUILD_TYPE': build_type,
|
|
|
|
'wxUSE_IMAGE': true,
|
|
|
|
'wxBUILD_MONOLITHIC': true # otherwise breaks project generation w/ meson
|
|
|
|
})
|
|
|
|
|
2023-07-24 20:35:38 +02:00
|
|
|
if get_option('wx_version').version_compare('>=3.3.0')
|
|
|
|
wx = cmake.subproject('wxWidgets-master', options: opt_var)
|
|
|
|
else
|
|
|
|
wx = cmake.subproject('wxWidgets', options: opt_var)
|
|
|
|
endif
|
2021-05-24 15:47:34 +02:00
|
|
|
|
2020-11-08 18:58:07 +01:00
|
|
|
deps += [
|
|
|
|
wx.dependency('wxmono'),
|
|
|
|
wx.dependency('wxregex'),
|
|
|
|
wx.dependency('wxscintilla')
|
|
|
|
]
|
|
|
|
|
2023-07-24 20:35:38 +02:00
|
|
|
if get_option('wx_version').version_compare('>=3.3.0')
|
|
|
|
deps += [
|
|
|
|
wx.dependency('wxlexilla')
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2021-01-09 09:18:11 +01:00
|
|
|
if host_machine.system() == 'windows' or host_machine.system() == 'darwin'
|
|
|
|
deps += [
|
|
|
|
wx.dependency('wxpng'),
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-11-08 18:58:07 +01:00
|
|
|
if host_machine.system() == 'windows'
|
2020-11-22 19:21:23 +01:00
|
|
|
deps += [
|
|
|
|
wx.dependency('wxzlib'),
|
2021-01-09 09:18:11 +01:00
|
|
|
wx.dependency('wxexpat'),
|
2020-11-22 19:21:23 +01:00
|
|
|
]
|
|
|
|
|
2020-11-08 18:58:07 +01:00
|
|
|
if cc.has_header('rpc.h')
|
|
|
|
deps += cc.find_library('rpcrt4', required: true)
|
|
|
|
else
|
|
|
|
error('Missing Windows SDK RPC Library (rpc.h / rpcrt4.lib)')
|
|
|
|
endif
|
|
|
|
if cc.has_header('commctrl.h')
|
|
|
|
deps += cc.find_library('comctl32', required: true)
|
|
|
|
else
|
|
|
|
error('Missing Windows SDK Common Controls Library (commctrl.h / comctl32.lib)')
|
2020-04-12 21:51:28 +02:00
|
|
|
endif
|
2019-09-08 23:38:59 +02:00
|
|
|
endif
|
2019-07-21 21:14:26 +02:00
|
|
|
endif
|
2019-02-10 00:26:50 +01:00
|
|
|
|
2020-10-27 18:09:32 +01:00
|
|
|
deps += dependency('icu-uc', version: '>=4.8.1.1')
|
|
|
|
deps += dependency('icu-i18n', version: '>=4.8.1.1')
|
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
|
2021-11-11 01:18:24 +01:00
|
|
|
['libpulse', [], 'PulseAudio', [], []],
|
|
|
|
['alsa', [], 'ALSA', [], []],
|
|
|
|
['portaudio-2.0', [], 'PortAudio', [], []],
|
|
|
|
['openal', '>=0.0.8', 'OpenAL', [], ['OpenAL']],
|
2017-11-15 17:25:11 +01:00
|
|
|
# video
|
2021-11-11 01:18:24 +01:00
|
|
|
['ffms2', '>=2.22', 'FFMS2', ['ffms2', 'ffms2_dep'], []],
|
2017-11-15 17:25:11 +01:00
|
|
|
# other
|
2021-11-11 01:18:24 +01:00
|
|
|
['fftw3', [], 'FFTW3', [], []],
|
|
|
|
['hunspell', [], 'Hunspell', ['hunspell', 'hunspell_dep'], []],
|
|
|
|
['uchardet', [], 'uchardet', ['uchardet', 'uchardet_dep'], []],
|
2017-11-15 17:25:11 +01:00
|
|
|
]
|
2019-02-17 18:27:06 +01:00
|
|
|
optname = dep[0].split('-')[0]
|
2021-11-11 00:39:44 +01:00
|
|
|
if not get_option(optname).disabled()
|
|
|
|
# [provide] section is ignored if required is false;
|
|
|
|
# must provided define fallback explicitly
|
|
|
|
# (with meson 0.56 you can do allow_fallback: true):
|
2021-11-11 01:02:35 +01:00
|
|
|
#d = dependency(dep[0], version: dep[1],
|
2021-11-11 00:39:44 +01:00
|
|
|
# required: false, allow_fallback: true)
|
|
|
|
if dep[3].length() > 0
|
2021-11-11 01:02:35 +01:00
|
|
|
d = dependency(dep[0], version: dep[1], fallback: dep[3])
|
2021-11-11 00:39:44 +01:00
|
|
|
else
|
2021-11-11 01:02:35 +01:00
|
|
|
d = dependency(dep[0], version: dep[1], required: false)
|
2021-11-11 00:39:44 +01:00
|
|
|
endif
|
|
|
|
|
2021-11-11 01:18:24 +01:00
|
|
|
if not d.found() and dep[4].length() > 0 and host_machine.system() == 'darwin'
|
|
|
|
d = dependency('appleframeworks', modules: dep[4], required: false)
|
|
|
|
endif
|
|
|
|
|
2021-11-11 00:39:44 +01:00
|
|
|
if d.found()
|
|
|
|
deps += d
|
|
|
|
conf.set('WITH_@0@'.format(dep[0].split('-')[0].to_upper()), 1)
|
|
|
|
dep_avail += dep[2]
|
|
|
|
elif get_option(optname).enabled()
|
|
|
|
error('@0@ enabled but not found'.format(dep[2]))
|
|
|
|
endif
|
2017-11-15 17:25:11 +01:00
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2022-08-08 02:14:31 +02:00
|
|
|
needs_ffmpeg = false
|
|
|
|
|
|
|
|
if get_option('bestsource').enabled()
|
|
|
|
conf.set('WITH_BESTSOURCE', 1)
|
|
|
|
bs = subproject('bestsource')
|
|
|
|
deps += bs.get_variable('bestsource_dep')
|
2022-08-11 02:05:16 +02:00
|
|
|
dep_avail += 'BestSource'
|
2022-08-08 02:14:31 +02:00
|
|
|
needs_ffmpeg = true
|
|
|
|
endif
|
|
|
|
|
|
|
|
if needs_ffmpeg
|
|
|
|
conf.set('WITH_FFMPEG', 1)
|
|
|
|
deps += [
|
|
|
|
dependency('libavutil', default_options: ['tests=disabled']),
|
|
|
|
dependency('libswscale', default_options: ['tests=disabled']),
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2020-03-06 06:15:07 +01:00
|
|
|
if get_option('avisynth').enabled()
|
2020-12-22 07:01:12 +01:00
|
|
|
conf.set('WITH_AVISYNTH', 1) # bundled separately with installer
|
2020-03-06 06:15:07 +01:00
|
|
|
dep_avail += 'AviSynth'
|
2022-07-05 01:12:10 +02:00
|
|
|
|
|
|
|
avs_opt = cmake.subproject_options()
|
|
|
|
avs_opt.add_cmake_defines({
|
|
|
|
'HEADERS_ONLY': true
|
|
|
|
})
|
|
|
|
|
|
|
|
avs = cmake.subproject('avisynth', options: avs_opt)
|
|
|
|
deps_inc += avs.include_directories('AviSynth-Headers')
|
2020-03-06 06:15:07 +01:00
|
|
|
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
deps += cc.find_library('avifil32', required: true)
|
|
|
|
endif
|
2020-12-22 07:01:12 +01:00
|
|
|
endif
|
|
|
|
|
2022-08-16 15:49:29 +02:00
|
|
|
if get_option('vapoursynth').enabled()
|
|
|
|
conf.set('WITH_VAPOURSYNTH', 1)
|
|
|
|
vs_sub = subproject('vapoursynth')
|
|
|
|
deps_inc += vs_sub.get_variable('vs_inc')
|
|
|
|
dep_avail += 'VapourSynth'
|
|
|
|
endif
|
|
|
|
|
2022-08-10 10:31:02 +02:00
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
if 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
|
|
|
|
|
|
|
|
dxguid_dep = cc.find_library('dxguid', required: true)
|
|
|
|
if dsound_dep.found() and winmm_dep.found() and ole32_dep.found() and dxguid_dep.found() and have_dsound_h
|
|
|
|
deps += [dsound_dep, winmm_dep, ole32_dep, dxguid_dep]
|
|
|
|
conf.set('WITH_DIRECTSOUND', 1)
|
|
|
|
dep_avail += 'DirectSound'
|
|
|
|
endif
|
2019-02-17 18:25:57 +01:00
|
|
|
endif
|
2020-04-12 21:51:28 +02:00
|
|
|
|
2022-08-10 10:31:02 +02:00
|
|
|
if not get_option('xaudio2').disabled()
|
|
|
|
have_xaudio_h = cc.has_header('xaudio2.h')
|
|
|
|
xaudio2_dep = cc.find_library('xaudio2', required: true)
|
2022-08-10 15:09:41 +02:00
|
|
|
if have_xaudio_h and xaudio2_dep.found()
|
2022-08-10 10:31:02 +02:00
|
|
|
deps += [xaudio2_dep]
|
|
|
|
conf.set('WITH_XAUDIO2', 1)
|
|
|
|
dep_avail += 'XAudio2'
|
2022-08-10 15:09:41 +02:00
|
|
|
# XAudio2 needs Windows 8 or newer, so we tell meson not to define an older windows or else it can break things.
|
|
|
|
add_project_arguments('-D_WIN32_WINNT=0x0602', language: 'cpp')
|
|
|
|
else
|
|
|
|
# Windows 8 not required if XAudio2 fails to be found. revert for compat.
|
|
|
|
add_project_arguments('-D_WIN32_WINNT=0x0601', language: 'cpp')
|
2022-08-10 10:31:02 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
if not have_dsound_h and get_option('xaudio2').enabled()
|
|
|
|
error('xaudio2 enabled but xaudio2.h not found')
|
|
|
|
endif
|
2022-08-10 15:09:41 +02:00
|
|
|
else
|
|
|
|
# Windows 8 not required if XAudio2 is disabled. revert for compat.
|
|
|
|
add_project_arguments('-D_WIN32_WINNT=0x0601', language: 'cpp')
|
2019-02-17 18:25:57 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-09-08 23:38:59 +02:00
|
|
|
if host_machine.system() == 'darwin'
|
2023-07-24 20:35:38 +02:00
|
|
|
frameworks_dep = dependency('appleframeworks', modules : ['CoreText', 'CoreFoundation', 'AppKit', 'Carbon', 'IOKit', 'QuartzCore'])
|
2019-09-08 23:38:59 +02:00
|
|
|
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'))
|
2021-05-23 23:33:27 +02:00
|
|
|
if luajit.found() and luajit.type_name() != 'internal'
|
2017-11-15 17:25:11 +01:00
|
|
|
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')
|
2021-01-21 12:23:28 +01:00
|
|
|
luajit_inc = luajit_sp.get_variable('src_inc')
|
2017-11-15 17:25:11 +01:00
|
|
|
deps += luajit_sp.get_variable('luajit_dep')
|
|
|
|
else
|
2021-05-23 23:41:44 +02:00
|
|
|
luajit_inc = include_directories(luajit.get_variable('includedir'))
|
2017-11-15 17:25:11 +01:00
|
|
|
endif
|
2022-09-27 16:54:15 +02:00
|
|
|
subdir('vendor/luabins/src')
|
2017-11-15 17:25:11 +01:00
|
|
|
|
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
|
2020-11-08 18:13:50 +01:00
|
|
|
if host_machine.system() == 'darwin'
|
|
|
|
conf.set('HAVE_OPENGL_GL_H', 1)
|
|
|
|
endif
|
2017-11-15 17:25:11 +01:00
|
|
|
|
|
|
|
if not dep_gl.found()
|
|
|
|
error('OpenGL implementation not found')
|
|
|
|
endif
|
|
|
|
|
|
|
|
deps += dep_gl
|
|
|
|
|
2021-01-30 15:04:22 +01:00
|
|
|
if not get_option('csri').disabled() and host_machine.system() == 'windows'
|
2021-01-30 14:57:39 +01:00
|
|
|
conf.set('WITH_CSRI', 1)
|
|
|
|
|
|
|
|
csri_sp = subproject('csri')
|
|
|
|
deps += csri_sp.get_variable('csri_dep')
|
|
|
|
endif
|
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')
|
2021-05-24 05:33:33 +02:00
|
|
|
subdir('tests')
|
2021-03-27 14:29:37 +01:00
|
|
|
|
|
|
|
aegisub_cpp_pch = ['src/include/agi_pre.h']
|
|
|
|
aegisub_c_pch = ['src/include/agi_pre_c.h']
|
|
|
|
|
2022-08-19 10:28:38 +02:00
|
|
|
link_args = []
|
2023-02-09 01:42:11 +01:00
|
|
|
link_depends = []
|
2022-08-19 10:28:38 +02:00
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
manifest_file = configure_file(copy: true, input: 'src/res/aegisub.exe.manifest', output: 'aegisub.exe.manifest')
|
|
|
|
link_args += ['/MANIFEST:EMBED', '/MANIFESTINPUT:@0@'.format(manifest_file)]
|
2023-02-09 01:42:11 +01:00
|
|
|
link_depends += manifest_file
|
2022-08-19 10:28:38 +02:00
|
|
|
endif
|
|
|
|
|
2023-08-01 14:07:56 +02:00
|
|
|
aegisub = executable('aegisub', aegisub_src, version_h, acconf, resrc,
|
2021-03-27 14:29:37 +01:00
|
|
|
link_with: [libresrc, libluabins, libaegisub],
|
2022-08-19 10:28:38 +02:00
|
|
|
link_args: link_args,
|
2023-02-09 01:42:11 +01:00
|
|
|
link_depends: link_depends,
|
2021-05-22 04:02:21 +02:00
|
|
|
include_directories: [libaegisub_inc, libresrc_inc, version_inc, deps_inc, include_directories('src')],
|
2021-03-27 14:29:37 +01:00
|
|
|
cpp_pch: aegisub_cpp_pch,
|
|
|
|
c_pch: aegisub_c_pch,
|
|
|
|
install: true,
|
|
|
|
install_dir: bindir,
|
|
|
|
dependencies: deps,
|
|
|
|
win_subsystem: 'windows')
|