| 1 |
python_sources = [ |
| 2 |
'__init__.py', |
| 3 |
'__init__.pyi', |
| 4 |
'py.typed', |
| 5 |
] |
| 6 |
|
| 7 |
sources = [ |
| 8 |
'bufferproxy.c', |
| 9 |
'cairomodule.c', |
| 10 |
'context.c', |
| 11 |
'device.c', |
| 12 |
'enums.c', |
| 13 |
'error.c', |
| 14 |
'font.c', |
| 15 |
'glyph.c', |
| 16 |
'matrix.c', |
| 17 |
'misc.c', |
| 18 |
'path.c', |
| 19 |
'pattern.c', |
| 20 |
'rectangle.c', |
| 21 |
'region.c', |
| 22 |
'surface.c', |
| 23 |
'textcluster.c', |
| 24 |
'textextents.c', |
| 25 |
] |
| 26 |
|
| 27 |
foreach python_file : python_sources |
| 28 |
fs.copyfile(python_file, python_file) |
| 29 |
endforeach |
| 30 |
|
| 31 |
cairo_dep = dependency('cairo', version: cair_version_req, required: cc.get_id() != 'msvc') |
| 32 |
|
| 33 |
if cc.get_id() == 'msvc' and not cairo_dep.found() |
| 34 |
if cc.has_header('cairo.h') |
| 35 |
cairo_dep = cc.find_library('cairo') |
| 36 |
endif |
| 37 |
endif |
| 38 |
|
| 39 |
python.install_sources(python_sources, |
| 40 |
subdir : 'cairo' |
| 41 |
) |
| 42 |
|
| 43 |
install_data( |
| 44 |
'py3cairo.h', |
| 45 |
install_dir: python.get_install_dir(subdir: 'cairo/include') |
| 46 |
) |
| 47 |
if not for_wheel |
| 48 |
install_headers('py3cairo.h', subdir: 'pycairo') |
| 49 |
endif |
| 50 |
|
| 51 |
pyext = python.extension_module('_cairo', sources, |
| 52 |
dependencies : [cairo_dep], |
| 53 |
install: true, |
| 54 |
subdir : 'cairo', |
| 55 |
c_args: pyext_c_args + main_c_args, |
| 56 |
) |
| 57 |
|
| 58 |
if not for_wheel |
| 59 |
pkg = import('pkgconfig') |
| 60 |
|
| 61 |
pkg.generate( |
| 62 |
name: 'py3cairo', |
| 63 |
description: 'Python 3 bindings for cairo', |
| 64 |
subdirs: 'pycairo', |
| 65 |
requires: ['cairo'], |
| 66 |
) |
| 67 |
endif |
| 68 |
|
| 69 |
pycairo_dep = declare_dependency( |
| 70 |
version: pycairo_version, |
| 71 |
include_directories: [include_directories('.')], |
| 72 |
) |