| 1 |
project( |
| 2 |
'edid-decode', |
| 3 |
'cpp', |
| 4 |
) |
| 5 |
|
| 6 |
fs = import('fs') |
| 7 |
|
| 8 |
edid_decode_args = [ |
| 9 |
'-Wno-missing-field-initializers', |
| 10 |
'-Wno-unused-parameter', |
| 11 |
'-Wimplicit-fallthrough', |
| 12 |
'-Wno-variadic-macros', |
| 13 |
'-include', meson.current_build_dir() / 'config.h', |
| 14 |
] |
| 15 |
edid_decode_link_args = [] |
| 16 |
|
| 17 |
git_sha = '' |
| 18 |
git_commit_cnt = '' |
| 19 |
git_commit_date = '' |
| 20 |
|
| 21 |
if fs.is_dir('../../../.git') |
| 22 |
prog_git = find_program('git') |
| 23 |
source_root = '../../..' |
| 24 |
git_sha = run_command(prog_git, '-C', source_root, 'rev-parse', '--short=12', 'HEAD', |
| 25 |
check : true).stdout().strip() |
| 26 |
git_commit_cnt = '-' + run_command(prog_git, '-C', source_root, 'rev-list', '--count', 'HEAD', |
| 27 |
check : true).stdout().strip() |
| 28 |
git_commit_date = run_command(prog_git, '-C', source_root, 'show', '--quiet', |
| 29 |
'--date=format-local:%F %T', '--format=%cd', |
| 30 |
env : ['TZ=UTC'], check : true).stdout().strip() |
| 31 |
endif |
| 32 |
|
| 33 |
conf = configuration_data() |
| 34 |
conf.set('GIT_SHA', git_sha) |
| 35 |
conf.set('GIT_COMMIT_CNT', git_commit_cnt) |
| 36 |
conf.set('GIT_COMMIT_DATE', git_commit_date) |
| 37 |
|
| 38 |
configure_file(output : 'config.h', configuration : conf) |
| 39 |
|
| 40 |
if target_machine.system() == 'emscripten' |
| 41 |
edid_decode_link_args += [ |
| 42 |
'-sEXPORTED_FUNCTIONS=_parse_edid', |
| 43 |
'-sEXPORTED_RUNTIME_METHODS=ccall,cwrap' |
| 44 |
] |
| 45 |
|
| 46 |
fs = import('fs') |
| 47 |
foreach filename : ['edid-decode.html', 'edid-decode.ico'] |
| 48 |
fs.copyfile( |
| 49 |
filename, |
| 50 |
install: true, |
| 51 |
install_dir: 'bin', |
| 52 |
) |
| 53 |
endforeach |
| 54 |
endif |
| 55 |
|
| 56 |
edid_decode_sources = [ |
| 57 |
'../calc-gtf-cvt.cpp', |
| 58 |
'../calc-ovt.cpp', |
| 59 |
'../edid-decode.cpp', |
| 60 |
'../parse-base-block.cpp', |
| 61 |
'../parse-cta-block.cpp', |
| 62 |
'../parse-di-ext-block.cpp', |
| 63 |
'../parse-displayid-block.cpp', |
| 64 |
'../parse-ls-ext-block.cpp', |
| 65 |
'../parse-vtb-ext-block.cpp', |
| 66 |
'../parse-if.cpp', |
| 67 |
] |
| 68 |
|
| 69 |
edid_decode = executable( |
| 70 |
'edid-decode', |
| 71 |
sources: edid_decode_sources, |
| 72 |
cpp_args: edid_decode_args, |
| 73 |
link_args: edid_decode_link_args, |
| 74 |
install: true, |
| 75 |
) |
| 76 |
|
| 77 |
meson.override_find_program( |
| 78 |
'edid-decode', |
| 79 |
edid_decode, |
| 80 |
) |