Skip to content

Commit efb2989

Browse files
committed
Add Meson build files for project and source directory setup
1 parent ef2b378 commit efb2989

5 files changed

Lines changed: 115 additions & 0 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ build/*
3939
*/build/x64
4040
Test
4141

42+
# Meson
43+
/subprojects/*
44+
!/subprojects/avisynthplus.wrap
45+
!/subprojects/libass.wrap
46+
4247
# Build results
4348
[Dd]ebug/
4449
[Dd]ebugPublic/

meson.build

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
project(
2+
'assrender',
3+
['c', 'cpp'],
4+
default_options: [
5+
'default_library=static',
6+
'buildtype=release',
7+
'b_vscrt=static_from_buildtype',
8+
'c_std=c11',
9+
'cpp_std=c++17',
10+
'warning_level=3',
11+
],
12+
)
13+
14+
# Mirror the MinGW-specific behavior from CMake
15+
cc = meson.get_compiler('c')
16+
is_mingw = host_machine.system() == 'windows' and cc.get_id() == 'gcc'
17+
18+
if is_mingw
19+
add_project_arguments(
20+
'-Wpedantic',
21+
language: 'c',
22+
)
23+
24+
add_project_link_arguments(
25+
'-static-libgcc',
26+
'-Wl,--add-stdcall-alias',
27+
language: 'c',
28+
)
29+
30+
if get_option('buildtype') in ['release', 'minsize']
31+
add_project_link_arguments(
32+
'-s',
33+
language: 'c',
34+
)
35+
endif
36+
endif
37+
38+
subdir('src')

src/meson.build

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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

subprojects/avisynthplus.wrap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[wrap-git]
2+
directory=avisynthplus
3+
url=https://github.com/AviSynth/AviSynthPlus.git
4+
revision=v3.7.5

subprojects/libass.wrap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[wrap-git]
2+
directory=libass
3+
url=https://github.com/libass/libass.git
4+
revision=0.17.4

0 commit comments

Comments
 (0)