1bf215546Sopenharmony_ci# Copyright © 2017 Intel Corporation 2bf215546Sopenharmony_ci 3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy 4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal 5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights 6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is 8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions: 9bf215546Sopenharmony_ci 10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in 11bf215546Sopenharmony_ci# all copies or substantial portions of the Software. 12bf215546Sopenharmony_ci 13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19bf215546Sopenharmony_ci# SOFTWARE. 20bf215546Sopenharmony_ci 21bf215546Sopenharmony_ciosmesa_link_with = [] 22bf215546Sopenharmony_ciosmesa_link_args = [] 23bf215546Sopenharmony_ciosmesa_link_deps = [] 24bf215546Sopenharmony_ci 25bf215546Sopenharmony_ciif with_shared_glapi 26bf215546Sopenharmony_ci osmesa_link_with += libglapi 27bf215546Sopenharmony_ciendif 28bf215546Sopenharmony_ciif with_ld_version_script 29bf215546Sopenharmony_ci osmesa_link_args += [ 30bf215546Sopenharmony_ci '-Wl,--version-script', join_paths(meson.current_source_dir(), 'osmesa.sym') 31bf215546Sopenharmony_ci ] 32bf215546Sopenharmony_ci osmesa_link_deps += files('osmesa.sym') 33bf215546Sopenharmony_ciendif 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ciosmesa_def = custom_target( 36bf215546Sopenharmony_ci 'osmesa.def', 37bf215546Sopenharmony_ci input: 'osmesa.def.in', 38bf215546Sopenharmony_ci output : 'osmesa.def', 39bf215546Sopenharmony_ci command : [prog_python, gen_vs_module_defs_py, 40bf215546Sopenharmony_ci '--in_file', '@INPUT@', '--out_file', '@OUTPUT@', 41bf215546Sopenharmony_ci '--compiler_id', cc.get_argument_syntax(), '--cpu_family', host_machine.cpu_family()] 42bf215546Sopenharmony_ci) 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_cilibosmesa = shared_library( 45bf215546Sopenharmony_ci osmesa_lib_name, 46bf215546Sopenharmony_ci 'target.c', 47bf215546Sopenharmony_ci gnu_symbol_visibility : 'hidden', 48bf215546Sopenharmony_ci link_args : [ld_args_gc_sections, osmesa_link_args], 49bf215546Sopenharmony_ci vs_module_defs : osmesa_def, 50bf215546Sopenharmony_ci include_directories : [ 51bf215546Sopenharmony_ci inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_winsys, 52bf215546Sopenharmony_ci inc_gallium_drivers, 53bf215546Sopenharmony_ci ], 54bf215546Sopenharmony_ci link_depends : osmesa_link_deps, 55bf215546Sopenharmony_ci link_whole : [libosmesa_st, libglapi_static], 56bf215546Sopenharmony_ci link_with : [ 57bf215546Sopenharmony_ci libmesa, libgallium, libws_null, osmesa_link_with, 58bf215546Sopenharmony_ci ], 59bf215546Sopenharmony_ci dependencies : [ 60bf215546Sopenharmony_ci dep_ws2_32, dep_selinux, dep_thread, dep_clock, dep_unwind, driver_swrast 61bf215546Sopenharmony_ci ], 62bf215546Sopenharmony_ci name_prefix : host_machine.system() == 'windows' ? '' : 'lib', # otherwise mingw will create libosmesa.dll 63bf215546Sopenharmony_ci soversion : host_machine.system() == 'windows' ? '' : '8', 64bf215546Sopenharmony_ci version : '8.0.0', 65bf215546Sopenharmony_ci darwin_versions : '9.0.0', 66bf215546Sopenharmony_ci install : true, 67bf215546Sopenharmony_ci) 68bf215546Sopenharmony_ci 69bf215546Sopenharmony_cipkg.generate( 70bf215546Sopenharmony_ci name : 'osmesa', 71bf215546Sopenharmony_ci description : 'Mesa Off-screen Rendering Library', 72bf215546Sopenharmony_ci version : '8.0.0', 73bf215546Sopenharmony_ci libraries : libosmesa, 74bf215546Sopenharmony_ci libraries_private : gl_priv_libs, 75bf215546Sopenharmony_ci) 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ciif with_tests 78bf215546Sopenharmony_ci test('osmesa-render', 79bf215546Sopenharmony_ci executable( 80bf215546Sopenharmony_ci 'osmesa-render', 81bf215546Sopenharmony_ci 'test-render.cpp', 82bf215546Sopenharmony_ci include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 83bf215546Sopenharmony_ci link_with: libosmesa, 84bf215546Sopenharmony_ci dependencies : [idep_gtest], 85bf215546Sopenharmony_ci ), 86bf215546Sopenharmony_ci suite: 'gallium', 87bf215546Sopenharmony_ci protocol : gtest_test_protocol, 88bf215546Sopenharmony_ci ) 89bf215546Sopenharmony_ciendif 90