1# Copyright © 2017 Intel Corporation 2 3# Permission is hereby granted, free of charge, to any person obtaining a copy 4# of this software and associated documentation files (the "Software"), to deal 5# in the Software without restriction, including without limitation the rights 6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7# copies of the Software, and to permit persons to whom the Software is 8# furnished to do so, subject to the following conditions: 9 10# The above copyright notice and this permission notice shall be included in 11# all copies or substantial portions of the Software. 12 13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19# SOFTWARE. 20 21inc_util = include_directories('.') 22 23subdir('xmlpool') 24 25files_mesa_util = files( 26 'bigmath.h', 27 'bitscan.c', 28 'bitscan.h', 29 'bitset.h', 30 'build_id.c', 31 'build_id.h', 32 'crc32.c', 33 'crc32.h', 34 'dag.c', 35 'debug.c', 36 'debug.h', 37 'disk_cache.c', 38 'disk_cache.h', 39 'fast_idiv_by_const.c', 40 'fast_idiv_by_const.h', 41 'format_r11g11b10f.h', 42 'format_rgb9e5.h', 43 'format_srgb.h', 44 'futex.h', 45 'half_float.c', 46 'half_float.h', 47 'hash_table.c', 48 'hash_table.h', 49 'list.h', 50 'macros.h', 51 'mesa-sha1.c', 52 'mesa-sha1.h', 53 'os_time.c', 54 'os_time.h', 55 'os_file.c', 56 'os_misc.c', 57 'os_misc.h', 58 'u_process.c', 59 'u_process.h', 60 'sha1/sha1.c', 61 'sha1/sha1.h', 62 'ralloc.c', 63 'ralloc.h', 64 'rand_xor.c', 65 'rand_xor.h', 66 'rb_tree.c', 67 'rb_tree.h', 68 'register_allocate.c', 69 'register_allocate.h', 70 'rgtc.c', 71 'rgtc.h', 72 'rounding.h', 73 'set.c', 74 'set.h', 75 'simple_list.h', 76 'simple_mtx.h', 77 'slab.c', 78 'slab.h', 79 'string_buffer.c', 80 'string_buffer.h', 81 'strndup.h', 82 'strtod.c', 83 'strtod.h', 84 'texcompress_rgtc_tmp.h', 85 'u_atomic.c', 86 'u_atomic.h', 87 'u_dynarray.h', 88 'u_endian.h', 89 'u_queue.c', 90 'u_queue.h', 91 'u_string.h', 92 'u_thread.h', 93 'u_vector.c', 94 'u_vector.h', 95 'u_math.c', 96 'u_math.h', 97 'u_debug.c', 98 'u_debug.h', 99 'u_cpu_detect.c', 100 'u_cpu_detect.h', 101 'vma.c', 102 'vma.h', 103) 104 105files_drirc = files('00-mesa-defaults.conf') 106 107install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d')) 108 109if with_tests 110 prog_xmllint = find_program('xmllint', required : false, native : true) 111 if prog_xmllint.found() 112 test( 113 'drirc xml validation', 114 prog_xmllint, 115 args : ['--noout', '--valid', files_drirc], 116 suite : ['util'], 117 ) 118 endif 119endif 120 121files_xmlconfig = files( 122 'xmlconfig.c', 123 'xmlconfig.h', 124) 125 126format_srgb = custom_target( 127 'format_srgb', 128 input : ['format_srgb.py'], 129 output : 'format_srgb.c', 130 command : [prog_python, '@INPUT0@'], 131 capture : true, 132) 133 134libmesa_util = static_library( 135 'mesa_util', 136 [files_mesa_util, format_srgb], 137 include_directories : inc_common, 138 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m], 139 c_args : [c_msvc_compat_args, c_vis_args], 140 build_by_default : false 141) 142 143libxmlconfig = static_library( 144 'xmlconfig', 145 files_xmlconfig, 146 include_directories : inc_common, 147 link_with : libmesa_util, 148 dependencies : [dep_expat, dep_m], 149 c_args : [ 150 c_msvc_compat_args, c_vis_args, 151 '-DSYSCONFDIR="@0@"'.format( 152 join_paths(get_option('prefix'), get_option('sysconfdir')) 153 ), 154 '-DDATADIR="@0@"'.format( 155 join_paths(get_option('prefix'), get_option('datadir')) 156 ), 157 ], 158 build_by_default : false, 159) 160 161if with_tests 162 test( 163 'u_atomic', 164 executable( 165 'u_atomic_test', 166 files('u_atomic_test.c'), 167 include_directories : inc_common, 168 link_with : libmesa_util, 169 c_args : [c_msvc_compat_args], 170 ), 171 suite : ['util'], 172 ) 173 174 test( 175 'roundeven', 176 executable( 177 'roundeven_test', 178 files('roundeven_test.c'), 179 include_directories : inc_common, 180 c_args : [c_msvc_compat_args], 181 dependencies : [dep_m], 182 ), 183 suite : ['util'], 184 ) 185 186 test( 187 'mesa-sha1', 188 executable( 189 'mesa-sha1_test', 190 files('mesa-sha1_test.c'), 191 include_directories : inc_common, 192 link_with : libmesa_util, 193 c_args : [c_msvc_compat_args], 194 ), 195 suite : ['util'], 196 ) 197 198 test( 199 'bitset', 200 executable( 201 'bitset_test', 202 files('bitset_test.cpp'), 203 include_directories : inc_common, 204 dependencies : [dep_thread, dep_dl, idep_gtest], 205 link_with : libmesa_util, 206 ), 207 suite : ['util'], 208 ) 209 210 subdir('tests/fast_idiv_by_const') 211 subdir('tests/hash_table') 212 subdir('tests/string_buffer') 213 subdir('tests/vma') 214 subdir('tests/set') 215endif 216