summaryrefslogtreecommitdiff
path: root/libs/pixman-0.40.0/pixman/meson.build
blob: f48357f261c68b46da5a0ace82c93f5e7437a208 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright © 2018 Intel Corporation

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

config_h = configure_file(
  configuration : config,
  output : 'config.h'
)

version_h = configure_file(
  configuration : version_conf,
  input : 'pixman-version.h.in',
  output : 'pixman-version.h',
  install_dir : join_paths(get_option('prefix'), get_option('includedir'), 'pixman-1')
)

libpixman_extra_cargs = []
if cc.has_function_attribute('dllexport')
  libpixman_extra_cargs = ['-DPIXMAN_API=__declspec(dllexport)']
endif

pixman_simd_libs = []
simds = [
  # the mmx library can be compiled with mmx on x86/x86_64, iwmmxt on
  # some arm cores, or loongson mmi on loongson mips systems. The
  # libraries will all have the same name, "pixman-mmx", but there is
  # no chance of more than one version being built in the same build
  # because no system could have mmx, iwmmxt, and mmi, and it
  # simplifies the build logic to give them the same name.
  ['mmx', have_mmx, mmx_flags, []],
  ['mmx', have_loongson_mmi, loongson_mmi_flags, []],
  ['mmx', have_iwmmxt, iwmmxt_flags, []],

  ['sse2', have_sse2, sse2_flags, []],
  ['ssse3', have_ssse3, ssse3_flags, []],
  ['vmx', have_vmx, vmx_flags, []],
  ['arm-simd', have_armv6_simd, [],
   ['pixman-arm-simd-asm.S', 'pixman-arm-simd-asm-scaled.S']],
  ['arm-neon', have_neon, [],
   ['pixman-arm-neon-asm.S', 'pixman-arm-neon-asm-bilinear.S']],
  ['mips-dspr2', have_mips_dspr2, mips_dspr2_flags,
   ['pixman-mips-dspr2-asm.S', 'pixman-mips-memcpy-asm.S']],
]

foreach simd : simds
  if simd[1]
    name = 'pixman-' + simd[0]
    pixman_simd_libs += static_library(
      name,
      [name + '.c', config_h, version_h, simd[3]],
      c_args : simd[2]
    )
  endif
endforeach

pixman_files = files(
  'pixman.c',
  'pixman-access.c',
  'pixman-access-accessors.c',
  'pixman-bits-image.c',
  'pixman-combine32.c',
  'pixman-combine-float.c',
  'pixman-conical-gradient.c',
  'pixman-filter.c',
  'pixman-x86.c',
  'pixman-mips.c',
  'pixman-arm.c',
  'pixman-ppc.c',
  'pixman-edge.c',
  'pixman-edge-accessors.c',
  'pixman-fast-path.c',
  'pixman-glyph.c',
  'pixman-general.c',
  'pixman-gradient-walker.c',
  'pixman-image.c',
  'pixman-implementation.c',
  'pixman-linear-gradient.c',
  'pixman-matrix.c',
  'pixman-noop.c',
  'pixman-radial-gradient.c',
  'pixman-region16.c',
  'pixman-region32.c',
  'pixman-solid-fill.c',
  'pixman-timer.c',
  'pixman-trap.c',
  'pixman-utils.c',
)

# We cannot use 'link_with' or 'link_whole' because meson wont do the right
# thing for static archives.
_obs = []
foreach l : pixman_simd_libs
  _obs += l.extract_all_objects()
endforeach

libpixman = library(
  'pixman-1',
  [pixman_files, config_h, version_h],
  objects : _obs,
  c_args : libpixman_extra_cargs,
  dependencies : [dep_m, dep_threads],
  version : meson.project_version(),
  install : true,
)

inc_pixman = include_directories('.')

idep_pixman = declare_dependency(
  link_with: libpixman,
  include_directories : inc_pixman,
)

install_headers('pixman.h', subdir : 'pixman-1')