101e04c3fSmrg# Copyright © 2017 Intel Corporation
201e04c3fSmrg
301e04c3fSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy
401e04c3fSmrg# of this software and associated documentation files (the "Software"), to deal
501e04c3fSmrg# in the Software without restriction, including without limitation the rights
601e04c3fSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
701e04c3fSmrg# copies of the Software, and to permit persons to whom the Software is
801e04c3fSmrg# furnished to do so, subject to the following conditions:
901e04c3fSmrg
1001e04c3fSmrg# The above copyright notice and this permission notice shall be included in
1101e04c3fSmrg# all copies or substantial portions of the Software.
1201e04c3fSmrg
1301e04c3fSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1401e04c3fSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1501e04c3fSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1601e04c3fSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1701e04c3fSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1801e04c3fSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1901e04c3fSmrg# SOFTWARE.
2001e04c3fSmrg
2101e04c3fSmrginc_loader = include_directories('.')
2201e04c3fSmrg
2301e04c3fSmrgif with_platform_x11 and with_dri3
2401e04c3fSmrg  libloader_dri3_helper = static_library(
2501e04c3fSmrg    'loader_dri3_helper',
267ec681f3Smrg    'loader_dri3_helper.c',
277ec681f3Smrg    gnu_symbol_visibility : 'hidden',
289f464c52Smaya    include_directories : [inc_include, inc_src],
2901e04c3fSmrg    dependencies : [
3001e04c3fSmrg      dep_libdrm, dep_xcb_dri3, dep_xcb_present, dep_xcb_sync, dep_xshmfence,
317ec681f3Smrg      dep_xcb_xfixes,
3201e04c3fSmrg    ],
3301e04c3fSmrg    build_by_default : false,
3401e04c3fSmrg  )
3501e04c3fSmrgelse
3601e04c3fSmrg  libloader_dri3_helper = []
3701e04c3fSmrgendif
3801e04c3fSmrg
397ec681f3Smrgloader_c_args = [
407ec681f3Smrg  '-DUSE_DRICONF',
417ec681f3Smrg  '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
427ec681f3Smrg]
437ec681f3Smrg
447ec681f3Smrgif get_option('prefer-iris')
457ec681f3Smrg  loader_c_args += ['-DPREFER_IRIS']
467ec681f3Smrgendif
477ec681f3Smrg
487ec681f3Smrgif get_option('prefer-crocus')
497ec681f3Smrg  loader_c_args += ['-DPREFER_CROCUS']
507ec681f3Smrgendif
517ec681f3Smrg
5201e04c3fSmrglibloader = static_library(
5301e04c3fSmrg  'loader',
547ec681f3Smrg  ['loader_dri_helper.c', 'loader.c', 'pci_id_driver_map.c'],
557ec681f3Smrg  c_args : loader_c_args,
567ec681f3Smrg  gnu_symbol_visibility : 'hidden',
5701e04c3fSmrg  include_directories : [inc_include, inc_src, inc_util],
5801e04c3fSmrg  dependencies : [dep_libdrm, dep_thread],
5901e04c3fSmrg  build_by_default : false,
6001e04c3fSmrg)
61