Skip to content

Commit 7c4beca

Browse files
ylatuyakylophone
authored andcommitted
Fix models symbols names when vmaf is compiled as a subproject
Model symbols defined in `model.c` use the `src_` prefix + the model name. When vmaf is compiled as a subproject, xxd will use as prefix the subproject path. Instead of `src_vmaf_4k_v0_6_1neg_json` it will use as symbol `_subprojects_vmaf_3_0_0_libvmaf_src_vmaf_4k_v0_6_1neg_json` To fix it, pass the symbol name using `-n` to always use the same symbol names reagardless of the build path.
1 parent 1b08bb4 commit 7c4beca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

libvmaf/src/meson.build

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,13 @@ cdata.set10('VMAF_FLOAT_FEATURES', float_enabled)
128128

129129
if built_in_models_enabled
130130
xxd = find_program('xxd', required: false)
131+
131132
if xxd.found()
133+
xdd_supports_n = run_command(xxd, '-n', 'test', check: false).returncode() == 0
134+
if meson.is_subproject () and not xdd_supports_n
135+
error('xxd with support for -n option is required building as a subproject. Please install a newer version of xxd or disable built-in models.')
136+
endif
137+
132138
model_files = [
133139
'vmaf_v0.6.1.json',
134140
'vmaf_b_v0.6.3.json',
@@ -147,6 +153,11 @@ if built_in_models_enabled
147153
endif
148154

149155
foreach model_file : model_files
156+
if xdd_supports_n
157+
command = [xxd, '-i', '-n', 'src_@PLAINNAME@', '@INPUT@', '@OUTPUT@']
158+
else
159+
command = [xxd, '-i', '@INPUT@', '@OUTPUT@']
160+
endif
150161
json_model_c_sources += custom_target(
151162
model_file,
152163
output : '@PLAINNAME@.c',
@@ -155,7 +166,7 @@ if built_in_models_enabled
155166
output : model_file,
156167
copy: true
157168
),
158-
command : [xxd, '-i', '@INPUT@', '@OUTPUT@'],
169+
command : command,
159170
)
160171
endforeach
161172

0 commit comments

Comments
 (0)