1# Copyright © 2018, VideoLAN and dav1d authors 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are met: 6# 7# 1. Redistributions of source code must retain the above copyright notice, this 8# list of conditions and the following disclaimer. 9# 10# 2. Redistributions in binary form must reproduce the above copyright notice, 11# this list of conditions and the following disclaimer in the documentation 12# and/or other materials provided with the distribution. 13# 14# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 25# Common source files used by tools and examples 26 27dav1d_input_sources = files( 28 'input/input.c', 29 'input/annexb.c', 30 'input/ivf.c', 31 'input/section5.c', 32) 33 34dav1d_output_sources = files( 35 'output/md5.c', 36 'output/null.c', 37 'output/output.c', 38 'output/y4m2.c', 39 'output/yuv.c', 40) 41 42# hacky check for xxhash.h to allow copying it to tools/output 43if not get_option('xxhash_muxer').disabled() 44 xxhash_include = '-I' + meson.current_source_dir() / 'output' 45 if cc.has_header_symbol('xxhash.h', 'XXH3_createState', args : xxhash_include) 46 dav1d_output_sources += 'output/xxhash.c' 47 xxh3_found = true 48 elif get_option('xxhash_muxer').enabled() 49 # manual error since 'required' kw arg in has_header_symbol() was only added in meson 0.50 50 error( 'C symbol XXH3_createState not found in header xxhash.h') 51 endif 52endif 53 54dav1d_input_objs = static_library('dav1d_input', 55 dav1d_input_sources, 56 57 include_directories : dav1d_inc_dirs, 58 install : false, 59 build_by_default : false, 60) 61 62dav1d_output_objs = static_library('dav1d_output', 63 dav1d_output_sources, 64 65 include_directories : dav1d_inc_dirs, 66 install : false, 67 build_by_default : false, 68) 69 70 71# Leave subdir if tools are disabled 72if not get_option('enable_tools') 73 subdir_done() 74endif 75 76 77# 78# Build definition for the dav1d tools 79# 80 81# Configuratin data for cli_config.h 82cli_cdata = configuration_data() 83 84cli_cdata.set10('HAVE_XXHASH_H', get_variable('xxh3_found', false)) 85 86cli_config_h_target = configure_file(output: 'cli_config.h', configuration: cli_cdata) 87 88# dav1d cli tool sources 89dav1d_sources = files( 90 'dav1d.c', 91 'dav1d_cli_parse.c', 92) 93 94if host_machine.system() == 'windows' 95 rc_file = configure_file( 96 input : 'dav1d.rc.in', 97 output : 'dav1d.rc', 98 configuration : rc_data 99 ) 100 101 dav1d_rc_obj = winmod.compile_resources(rc_file, 102 depend_files : files('dav1d.manifest'), 103 include_directories : include_directories('.') 104 ) 105else 106 dav1d_rc_obj = [] 107endif 108 109dav1d = executable('dav1d', 110 dav1d_sources, 111 dav1d_rc_obj, 112 rev_target, cli_config_h_target, 113 114 link_with : [libdav1d, dav1d_input_objs, dav1d_output_objs], 115 include_directories : [dav1d_inc_dirs], 116 dependencies : [ 117 getopt_dependency, 118 thread_dependency, 119 rt_dependency, 120 libm_dependency, 121 ], 122 install : true, 123) 124