|
| 1 | +cc = meson.get_compiler('c') |
| 2 | + |
| 3 | +cmake_mod = import('cmake') |
| 4 | +win = import('windows') |
| 5 | + |
| 6 | +plugin_name = 'assrender' |
| 7 | + |
| 8 | +sources = files( |
| 9 | + 'assrender.c', |
| 10 | + 'render.c', |
| 11 | + 'sub.c', |
| 12 | + 'timecodes.c', |
| 13 | +) |
| 14 | + |
| 15 | +if host_machine.system() == 'windows' |
| 16 | + sources += win.compile_resources('ASSRender.rc') |
| 17 | +endif |
| 18 | + |
| 19 | +inc_public = include_directories('include') |
| 20 | + |
| 21 | +libass_dep = dependency( |
| 22 | + 'libass', |
| 23 | + required: true, |
| 24 | + version: '>=0.17.4', |
| 25 | +) |
| 26 | + |
| 27 | +avisynth_dep = dependency( |
| 28 | + 'avisynth', |
| 29 | + required: false, |
| 30 | + version: '>=3.7.3', |
| 31 | +) |
| 32 | + |
| 33 | +if not avisynth_dep.found() |
| 34 | + opt = cmake_mod.subproject_options() |
| 35 | + opt.add_cmake_defines({'HEADERS_ONLY': true}) |
| 36 | + |
| 37 | + avisynth_sp = cmake_mod.subproject('avisynthplus', options: opt) |
| 38 | + avisynth_dep = avisynth_sp.dependency('AviSynth-Headers') |
| 39 | +endif |
| 40 | + |
| 41 | +deps = [avisynth_dep, libass_dep] |
| 42 | +is_mingw = (host_machine.system() == 'windows' and cc.get_id() == 'gcc') |
| 43 | +need_defs = host_machine.system() == 'windows' and (not is_mingw) and host_machine.cpu_family() == 'x86' |
| 44 | + |
| 45 | +if need_defs |
| 46 | + assrender = shared_library( |
| 47 | + plugin_name, |
| 48 | + sources, |
| 49 | + include_directories: [inc_public], |
| 50 | + dependencies: deps, |
| 51 | + vs_module_defs: files('assrender.def'), |
| 52 | + install: true, |
| 53 | + install_dir: join_paths(get_option('libdir'), 'avisynth'), |
| 54 | + ) |
| 55 | +else |
| 56 | + assrender = shared_library( |
| 57 | + plugin_name, |
| 58 | + sources, |
| 59 | + include_directories: [inc_public], |
| 60 | + dependencies: deps, |
| 61 | + install: true, |
| 62 | + install_dir: join_paths(get_option('libdir'), 'avisynth'), |
| 63 | + ) |
| 64 | +endif |
0 commit comments