1 2# Python bindings require libutils for now. 3if not get_option('libutils') 4 pybindings_enabled = false 5 subdir_done() 6endif 7 8py3_dep = dependency('python3', required : get_option('pykms')) 9 10if py3_dep.found() == false 11 pybindings_enabled = false 12 subdir_done() 13endif 14 15pybind11_dep = dependency('pybind11', fallback : ['pybind11', 'pybind11_dep'], 16 required : get_option('pykms')) 17 18if pybind11_dep.found() == false 19 pybindings_enabled = false 20 subdir_done() 21endif 22 23pybindings_enabled = true 24 25pykms_sources = files([ 26 'pykmsbase.cpp', 27 'pykms.cpp', 28]) 29 30if get_option('libutils') 31 pykms_sources += files([ 32 'pykmsutil.cpp', 33 ]) 34endif 35 36if libdrmomap_dep.found() 37 pykms_sources += files([ 38 'pykmsomap.cpp', 39 ]) 40endif 41 42pykms_deps = [ 43 libkmsxx_dep, 44 py3_dep, 45 pybind11_dep, 46] 47 48if get_option('libutils') 49 pykms_deps += [ libkmsxxutil_dep ] 50endif 51 52pykms_args = [ '-fvisibility=hidden' ] 53 54destdir = get_option('libdir') / 'python' + py3_dep.version() / 'site-packages/pykms' 55 56pykms = shared_module('pykms', 57 pykms_sources, 58 install : true, 59 install_dir : destdir, 60 name_prefix : '', 61 dependencies : pykms_deps, 62 cpp_args : pykms_args) 63 64# Copy __init__.py to build dir so that we can run without installing 65configure_file(input: '__init__.py', output: '__init__.py', copy: true, 66 install : true, install_dir : destdir) 67