1# Copyright © 2018 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 21 22opengl32_link_args = [] 23if cc.get_id() == 'gcc' and host_machine.cpu_family() != 'x86_64' 24 opengl32_link_args += ['-Wl,--enable-stdcall-fixup'] 25endif 26 27if cc.get_id() == 'gcc' and host_machine.cpu_family() != 'x86_64' 28 ogl_def = 'opengl32.mingw.def' 29else 30 ogl_def = 'opengl32.def' 31endif 32 33libopengl32 = shared_library( 34 'opengl32', 35 ['stw_wgl.c'], 36 vs_module_defs : ogl_def, 37 include_directories : [ 38 inc_include, inc_wgl, inc_src, 39 ], 40 link_with : [ 41 libgallium_wgl, libglapi_static, libglapi 42 ], 43 dependencies : [ 44 idep_mesautil 45 ], 46 c_args : ['-D_GDI32_'], 47 link_args : opengl32_link_args, 48 name_prefix : '', # otherwise mingw will create libopengl32.dll 49 install : true, 50) 51 52if with_tests 53 extra_test_defs = [] 54 55 # The generated MinGW 32-bits import libraries are always broken due to missing @nn suffix on 56 # symbols, no matter what we do. So instead we use the builtin libopengl32.a 57 extra_test_deps = [cpp.find_library('opengl32')] 58 59 if with_gallium_d3d12 60 extra_test_defs += ['-DGALLIUM_D3D12'] 61 extra_test_deps += [cpp.find_library('d3d12')] 62 endif 63 64 test_wgl = executable( 65 'test_wgl', 66 files('tests/wgl_tests.cpp'), 67 cpp_args : [cpp_msvc_compat_args, extra_test_defs], 68 dependencies : [idep_gtest, dep_dxheaders, extra_test_deps], 69 ) 70 71 # The CI pipeline for MinGW doesn't support creating a window, so don't run these tests there 72 if with_tests and cc.get_id() != 'gcc' 73 wgl_test_env = environment() 74 wgl_test_env.append('PATH', libgallium_wgl_build_dir) 75 if with_shared_glapi 76 wgl_test_env.append('PATH', libglapi_build_dir) 77 endif 78 79 test( 80 'wgl', 81 test_wgl, 82 suite : ['wgl'], 83 env : wgl_test_env, 84 depends : [libopengl32], 85 protocol : gtest_test_protocol, 86 ) 87 endif 88endif 89